This release is a pre-release and may not be stable for production use.
baresip-python
Python bindings for the baresip SIP stack — a complete, embeddable SIP user agent for Python applications: registration, inbound and outbound calls, programmatic PCM audio access, and DTMF, with an asyncio-native API.
Status: alpha, under active development. Current release:
v0.2.0a1on PyPI. The API may still change between pre-releases; every break is called out in the CHANGELOG.
What this is
pip install baresip-python,import baresip— no compiler, no system SIP stack needed (wheels statically bundle libre and libbaresip).- A generic binding: nothing framework-specific inside. Audio can go to/from WAV files
(baresip's built-in drivers) or to/from your application as raw PCM (the
aumemdriver) — which is how frameworks like pipecat consume it. - BSD-2-Clause, on top of baresip/libre (BSD-3). No GPL code is ever published in our binaries.
Quick start
Until the first release lands on PyPI, install from a source checkout. You need
uv, a C compiler, cmake, and the OpenSSL and opus development
headers (apt install cmake libssl-dev libopus-dev on Debian/Ubuntu,
brew install cmake openssl@3 opus on macOS):
git clone --recurse-submodules https://github.com/daily-co/baresip-python.git
cd baresip-python
uv sync --group dev
make native ext
Everything below runs against the bundled FreeSWITCH bench — a docker compose setup with
test users (1001/1002, password bench1234) and an echo service at extension 9196
(see bench/README.md):
make bench-up
The examples are the tutorial, written to be read in order. Each is self-contained,
heavily commented, and configured entirely through SIP_USER/SIP_PASS/SIP_DOMAIN
environment variables whose defaults match the bench.
01 — register. The core lifecycle: one Runtime per process
(it owns the SIP thread), a UserAgent bound to an Account, register(), a clean
shutdown. Re-registration is automatic while it runs.
uv run python examples/01_register.py
02 — dial. An outbound call to the echo service and a call that
fails: dial(), wait_established(), custom INVITE headers, and telephony outcomes as
typed exceptions (CallBusy, CallDeclined, ...) instead of error codes.
uv run python examples/02_dial.py
03 — programmatic audio. The aumem driver, the shape a
voice agent needs: call.audio.read() returns the far end's PCM, call.audio.write()
queues yours — plain bytes, no sound card, no files.
uv run python examples/03_echo_aumem.py
04 — answer + WAV bot. A bot with zero custom audio code: answer an incoming call, play a greeting from a WAV file, record the caller — audio drivers as pure configuration. Have the bench call the bot from a second terminal:
uv run python examples/04_answer_wav_bot.py
docker exec baresip-bench-freeswitch fs_cli -x "originate user/1001 &echo()"
05 — DTMF IVR. DTMF in both directions: run one instance as a mini-IVR (press 1 for a tone, 2 to hang up), a second as the caller that presses the keys.
uv run python examples/05_dtmf_ivr.py
SIP_USER=1002 SIP_PASS=bench1234 uv run python examples/05_dtmf_ivr.py sip:1001@127.0.0.1:15060
06 — softphone. Real speakers-and-microphone audio: the
platform's hardware driver is picked automatically (coreaudio on macOS, alsa on Linux).
Register and auto-answer the first call, or set SIP_DIAL to dial out; type digits + Enter
to send DTMF, received digits are printed, h hangs up. Dialing the bench's echo service
lets you hear yourself — use a headset, there is no echo cancellation.
SIP_DIAL=sip:9196@127.0.0.1:15060 uv run python examples/06_softphone.py
07 — warm transfer. The receptionist pattern: answer a caller, consult a second destination, bridge the two calls in Python audio while staying in the path, then splice the parties together with an attended transfer and drop out. Run the bot, then call it with the softphone example from a second terminal (the caller must reach the bot bridged through the switch — see the example's docstring):
SIP_USER=1001 SIP_PASS=bench1234 uv run python examples/07_warm_transfer.py
SIP_USER=1002 SIP_DIAL=sip:1001@127.0.0.1:15060 uv run python examples/06_softphone.py
Audio and device selection
Audio drivers are chosen when the runtime starts — Config(audio_source=..., audio_player=...), one driver per direction — and stay put for the runtime's lifetime;
there is no mid-call driver switching. This is deliberate: audio a program decides
on at runtime is what the aumem driver is for (it is just bytes your code reads and
writes), and richer switching APIs are planned for a later release. What a "device" means
belongs to each driver: a WAV path for aufile, a tone frequency for ausine, the sound
card for the hardware drivers (coreaudio on macOS, alsa on Linux), nothing at all for
aumem.
Custom headers
Outbound INVITEs take custom headers directly: ua.dial(uri, headers={...}) (example 02).
On the receiving side, Config(expose_headers=[...]) allowlists header names whose values
then ride along on call events.
One deliberate absence: the 100 Trying that answers an incoming INVITE cannot carry
custom headers. The stack sends it automatically, before the application ever sees the
call — and it is a hop-by-hop response, so a header on it would die at the first proxy
anyway. Headers on the final response (answer/reject) are planned for a later release.
Transfers and hold
Hold/resume (call.hold(), with the far end's hold state in call.remote_on_hold), blind
transfer (call.transfer(uri)), attended transfer (call.attended_transfer(consult)), and
the receiving side — a peer's REFER as a typed TransferRequest, governed by a
transfer_policy that defaults to manual because a transfer is the far end instructing
your agent to place a call. The semantics have real surprises (a successful transfer
closes your call; that is the protocol, not the binding) — read
docs/TRANSFER.md before building on them. Example 07 is the runnable
version.
SIP trunks
Trunk-style connections — no registration, and a digest username that differs from the URI
user — are Account(reg_interval=0) and Account(auth_user=...). What each means, which
provider products want which shape (Twilio's SIP Domains vs Elastic SIP Trunking split as
the worked example), and the fail-fast behaviors around them are in
docs/TRUNKS.md.
Fleet operations
Two controls for running agents at scale. Config(max_concurrent_calls=...) caps the
runtime's calls natively — beyond the limit, inbound INVITEs are refused with 486 before
any call object exists. The default is 2 (one conversation plus a consultation leg, the
warm-transfer shape); None removes the cap. await runtime.drain() is the rollout half
of shutdown: new inbound calls are refused on the SIP thread, dial() raises
DrainingError, and the call resolves once the last live call ends — drain, then
close(), and the fleet can retire the instance without dropping anyone mid-sentence.
Logging
The library logs into the standard baresip.* logger hierarchy and never touches handlers
or output itself. Records carry correlation fields in extra — most importantly
sip_call_id, the spine that ties Python-side events, native-stack lines, and SIP traces
to one call. The native stack's own logs surface under baresip.native, and a full SIP
message trace is available under baresip.native.sip. Per-call DEBUG on a busy server is a
filter problem, not a level problem — see PerCallFilter in
docs/LOGGING.md, along with the loguru bridge for applications (pipecat
among them) that log through loguru.
Platform support
Linux (x86_64, aarch64) and macOS (Apple Silicon and Intel), CPython 3.11–3.13. On Windows, WSL2 is the supported path for now — the Linux build runs there as-is; native Windows support is a design goal the code keeps its door open for, but it is not built or tested today.
Building with GPL codecs (H.264)
The published wheels never contain GPL code. H.264 via ffmpeg's avcodec is available as a
source-build opt-in — your machine, your build, your license terms — documented in
docs/GPL-CODECS.md, including the x264 encode-vs-decode nuance that
decides whether GPL applies at all. Support level, honestly: the avcodec build is
compile-verified weekly in CI (built and unit-tested, never distributed); its runtime
behavior is community-supported.
Security
See SECURITY.md — how to report a vulnerability, which versions receive fixes, and a short threat-model note for operators: a registered user agent is a server as well as a client, and a publicly addressable one will receive unsolicited INVITEs and scanner traffic.
API stability policy
The public API is exactly what baresip.__all__ exports and these docs describe; everything
else is internal. Versioning is SemVer with the 0.x caveat: minor bumps before 1.0 may break,
and every break is called out in the CHANGELOG. Deprecated names keep working for one minor
version with a DeprecationWarning before removal. The package is fully typed (py.typed).
License
BSD 2-Clause. Copyright (c) 2026, Daily. Bundled third-party components (libre, libbaresip) are BSD-3-Clause; their notices ship with every distribution. Built wheels additionally bundle OpenSSL and libopus — and, on Linux, ALSA's libasound — under their respective licenses; see docs/UPGRADING.md for how security releases in those propagate here.
Release files for baresip-python 0.2.0a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 40.1 MB
Release files / baresip_python-0.2.0a1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | baresip_python-0.2.0a1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 3.5 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
0efd31c00dc0a47906f81e49dfab11204097998b3b8b38c9ffa897e38755a38f
|
|
BLAKE2b-256 checksum How to use checksums |
5cd4c2dcf7bc2b58974e4e005bb7dc8176924722f11f2f254df0a09140d9d9b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 27, 2026.
Transparency logRelease files / baresip_python-0.2.0a1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
| Download URL | baresip_python-0.2.0a1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 3.4 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
ed5e3d6d469bdcf069ca61b18babf76f56467586c6061c6c8841192a464087c8
|
|
BLAKE2b-256 checksum How to use checksums |
d6716c283948fbb8a131d337206930cdb1b674bca3a7df03be492829ed6afa9c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 27, 2026.
Transparency logRelease files / baresip_python-0.2.0a1-cp313-cp313-macosx_15_0_x86_64.whl
| Download URL | baresip_python-0.2.0a1-cp313-cp313-macosx_15_0_x86_64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | CPython 3.13 macOS 15.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
d8892ba6a6c332037097d14aed9c2325f99c78e973271d958fbb42bdd1f90310
|
|
BLAKE2b-256 checksum How to use checksums |
f82518bbcd7eebfd3d4e65d1a5fa05a3ec430d7f9f2aea36cff570e15b29df03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 27, 2026.
Transparency logRelease files / baresip_python-0.2.0a1-cp313-cp313-macosx_15_0_arm64.whl
| Download URL | baresip_python-0.2.0a1-cp313-cp313-macosx_15_0_arm64.whl |
|---|---|
| Size | 3.3 MB |
| Tags | CPython 3.13 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b5b1e64644ca836f1a9ceee90cb0e03903cfa0913cc6655905441ed30a9419a6
|
|
BLAKE2b-256 checksum How to use checksums |
671d30895a3a7adf1a7085da2a1e0f313c8805a4cfd095472bf97a8398a348e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 27, 2026.
Transparency logRelease files / baresip_python-0.2.0a1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | baresip_python-0.2.0a1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 3.5 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
68e1dcc2b9a8e37b636eb32b8b91c9c0c01e8d74f2e5c4ea094fb8a4f596f536
|
|
BLAKE2b-256 checksum How to use checksums |
5f1abeb27e6d714fb61bec86f03dd11a9b8e95f7ce28fb17b74af4ed6d9b3ec5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 27, 2026.
Transparency logRelease files / baresip_python-0.2.0a1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
| Download URL | baresip_python-0.2.0a1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 3.4 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
c9e14721736b68abdda7a8c0f214c00100be3fb546e5d01da141ec61f2301a81
|
|
BLAKE2b-256 checksum How to use checksums |
191f953e522b9a4549d45207744ed544674a31e9d32f0ce693523a907d3fe021
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 27, 2026.
Transparency logRelease files / baresip_python-0.2.0a1-cp312-cp312-macosx_15_0_x86_64.whl
| Download URL | baresip_python-0.2.0a1-cp312-cp312-macosx_15_0_x86_64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | CPython 3.12 macOS 15.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
e1519054c1858d2ad4f5ca21af1af645d794716b44dc25f8d758875682e9e48d
|
|
BLAKE2b-256 checksum How to use checksums |
527570f3543099f0df01cb6888899b52fa4e6a574eb3313fd62e13eda59e9c25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 27, 2026.
Transparency logRelease files / baresip_python-0.2.0a1-cp312-cp312-macosx_15_0_arm64.whl
| Download URL | baresip_python-0.2.0a1-cp312-cp312-macosx_15_0_arm64.whl |
|---|---|
| Size | 3.3 MB |
| Tags | CPython 3.12 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
13e948ccfba2365370de4993901bf084dff19d080c5b4d4421ad7a14546d9537
|
|
BLAKE2b-256 checksum How to use checksums |
ee7a8f2941f172cc9254dea369cc67ad478ed569d4f7675579325f016ac07423
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 27, 2026.
Transparency logRelease files / baresip_python-0.2.0a1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | baresip_python-0.2.0a1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 3.5 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
a3a37eea539fc0fe8cc5df83f5253b81a7b15e05496bd4291d7c6f0fba3f0e80
|
|
BLAKE2b-256 checksum How to use checksums |
5ff79ca17ab4f5f1ee9ebb0119c59bdb404402fa4f98f6e3ef1cffd37a24b072
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 27, 2026.
Transparency logRelease files / baresip_python-0.2.0a1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
| Download URL | baresip_python-0.2.0a1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 3.4 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
187ef6b26ddd18833b1f09f21c80d5afa92041a71316935950a79637d5aaf31e
|
|
BLAKE2b-256 checksum How to use checksums |
f9e59ae5d2debd7fbfad4f67f58ae859e1f8b3a1e1527bc815537041bb06db8a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 27, 2026.
Transparency logRelease files / baresip_python-0.2.0a1-cp311-cp311-macosx_15_0_x86_64.whl
| Download URL | baresip_python-0.2.0a1-cp311-cp311-macosx_15_0_x86_64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | CPython 3.11 macOS 15.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
4f15fadcee88acc0c739cefb193c015fe193095100882a6793986bdf6b76c73a
|
|
BLAKE2b-256 checksum How to use checksums |
d4e0f0286466c55e3581a8cc6f0e3257e4c14b44c31cda27f813d1501cc8acad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 27, 2026.
Transparency logRelease files / baresip_python-0.2.0a1-cp311-cp311-macosx_15_0_arm64.whl
| Download URL | baresip_python-0.2.0a1-cp311-cp311-macosx_15_0_arm64.whl |
|---|---|
| Size | 3.3 MB |
| Tags | CPython 3.11 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1930d2511eb87af58bc99ec7e42e67d2f1353c8d711253a0141be328a4620c3e
|
|
BLAKE2b-256 checksum How to use checksums |
ae362faa786bd71d81f03ab57ccb0eddaf765c09324a72a6913fc5eddd34a09c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 27, 2026.
Transparency log