Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

py-iax2

A complete, pure-Python implementation of the IAX2 VoIP protocol (RFC 5456) for asyncio, built to interoperate with Asterisk — including AllStarLink app_rpt nodes. Where the RFC is vague or Asterisk differs, py-iax2 does what Asterisk 22 LTS does, and its test suite runs against a live Asterisk.

import asyncio
import iax2

async def main():
    async with iax2.Endpoint(port=0) as ep:
        call = await ep.dial("pbx.example.org", "600", username="me", secret="s3cret")
        await call.play_pcm(iax2.audio.tone(440, 2000))
        await call.hangup()

asyncio.run(main())

Features

  • Calls, outgoing and incoming, with Asterisk-exact sequencing, ACKs, retransmission and timestamps; ringing, answer, reject, hangup causes.
  • Authentication: MD5, RSA (Asterisk key files) and plaintext; call tokens as client and server.
  • AES-128 encryption with key rotation, compatible with Asterisk's encryption=aes128.
  • Media: μ-law, A-law, slin, slin16 built in (no dependencies), pluggable codecs, payload pass-through for any format, adaptive jitter buffer, trunking, video, DTMF, text, URL and image frames.
  • Registration client and registrar, POKE qualification, PING/LAGRQ statistics, dialplan queries, native transfers (endpoint and server).
  • A blocking API (iax2.sync) for non-asyncio code.
  • iax2-tool CLI: poke, call, serve, register, decode.
  • Examples: echo server, mini PBX, AllStarLink client, and more.

Install

pip install iax2              # core, pure Python
pip install "iax2[crypto]"    # + RSA authentication and AES encryption

Python 3.11+. A debian/ directory builds a python3-iax2 package.

Answering calls

import asyncio
import iax2

async def echo(call):
    await call.answer()
    async for frame in call.audio():
        call.send_audio(frame.payload)

async def main():
    users = {"alice": iax2.Credentials(secret="s3cret")}
    async with iax2.Endpoint(port=4569, users=users, allow_guest=False) as ep:
        async for call in ep.incoming():
            asyncio.create_task(echo(call))

asyncio.run(main())

Command line

iax2-tool poke pbx.example.org
iax2-tool call pbx.example.org 600 -u me -s s3cret --tone 440 --record out.wav
iax2-tool serve -u alice:s3cret

Documentation

Full documentation (user guide, Asterisk/AllStarLink notes, protocol notes, API reference) is at https://py-iax2.readthedocs.io/. The source is in docs/; build it locally with sphinx-build -b html docs docs/_build/html.

Testing

pytest                                          # unit + loopback tests
sudo python3 tests/interop/setup_asterisk.py    # configure a *test* Asterisk
pytest -m interop tests/interop                 # interoperability tests

Versioning and API stability

py-iax2 follows Semantic Versioning. While the version is 0.x, minor releases (0.1 → 0.2) may change the public API; such changes are listed in CHANGELOG.md, and where practical the old API keeps working with a DeprecationWarning for at least one minor release. Patch releases (0.1.0 → 0.1.1) are bug fixes only. The public API is everything exported from iax2 and documented in the API reference; names starting with _ and the iax2.session module (other than the SessionStats returned by Call.stats) are internal. From 1.0 onward, breaking changes only happen in major releases.

Contributing and security

See CONTRIBUTING.md and, for vulnerabilities, SECURITY.md.

License

GPL-2.0-only (matching Asterisk). Copyright © 2026 Jason D. McCormick.

Metadata

Release files for iax2 0.1.0b2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iax2 0.1.0b2
File Size Uploaded Provenance Actions
iax2-0.1.0b2.tar.gz 122.0 kB With provenance Details for iax2-0.1.0b2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for iax2 0.1.0b2
File Interpreter ABI Platform Actions
iax2-0.1.0b2-py3-none-any.whl Python 3 none any Details for iax2-0.1.0b2-py3-none-any.whl

Total release size: 219.3 kB

Release files / iax2-0.1.0b2.tar.gz

Download URL iax2-0.1.0b2.tar.gz
Size 122.0 kB
Tags Source
SHA-256 checksum
How to use checksums
dedb2d811ba17a8096ff53302b6f1f30dbb3c0e45176d748a17307dc43a5a712
BLAKE2b-256 checksum
How to use checksums
08e9717824e2cf529ee4cd4d8aba9a4a398823b1794693586cd16f4558004a6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / iax2-0.1.0b2-py3-none-any.whl

Download URL iax2-0.1.0b2-py3-none-any.whl
Size 97.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ea2cb84679d4b8485d264d11e0afc0d55bec6e7d378fd1a5a1acd128940ceee
BLAKE2b-256 checksum
How to use checksums
d97ed021ab8c545fdac8b420e0c8198be0f3a33ec542098956e3aa30c9f5acde
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Security for iax2 0.1.0b2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for iax2-0.1.0b2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page