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 in docs/; build it 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.0b1

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.0b1
File Size Uploaded Provenance Actions
iax2-0.1.0b1.tar.gz 121.9 kB With provenance Details for iax2-0.1.0b1.tar.gz

Built distribution (wheel)

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

Total release size: 219.2 kB

Release files / iax2-0.1.0b1.tar.gz

Download URL iax2-0.1.0b1.tar.gz
Size 121.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1707bc9e8c6f050238ff264dc193cd75720f71bf9e76d6910b9b3148aa40a9d1
BLAKE2b-256 checksum
How to use checksums
3b8b98acd0f2d59c04e23a286c787d030166f562bc798913072be2fc249a146f
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.0b1-py3-none-any.whl

Download URL iax2-0.1.0b1-py3-none-any.whl
Size 97.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b1d4cca220aca44df735ea9cb20914701206183cac94c7b0066ec1e97a9b30d
BLAKE2b-256 checksum
How to use checksums
71c48609df476a3e072fc1c9acf5f858ab23e0aa70dd995d538dd8bb11597a73
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.0b1

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.0b1.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