Python API reference¶
This section is the complete reference for the siphon Python module that
SIPhon injects into your scripts at runtime — every namespace, object,
property, and method a handler can touch.
It is generated directly from the docstrings and type annotations of the
siphon-sip package (import name
siphon_sdk), a pure-Python mock of the siphon module. The mock mirrors the
Rust engine's API one-for-one and is the single source of truth for these
signatures, so what you read here is exactly what runs in production.
The mock package doubles as a testing and authoring aid:
- Unit-test your scripts without the Rust binary — the test harness simulates incoming SIP messages and captures the actions your handlers take (reply, relay, fork, reject, …) so you can assert on them with pytest.
- Author scripts with an LLM — every method carries rich docstrings and
type hints, so
pip install siphon-sipgives a model enough context to generate correct SIPhon scripts.
At runtime you never construct these objects yourself; the engine hands them to your handlers. Import the namespaces you need:
from siphon import proxy, registrar, b2bua, auth, log, cache
from siphon import gateway, cdr, diameter, presence, li, registration
from siphon import timer, metrics, sdp, sbi, ipsec, rtpengine, isc
How this reference is organised¶
| Page | What it covers |
|---|---|
| Request | The inbound SIP request passed to @proxy.on_request handlers |
| Reply | The response object passed to @proxy.on_reply / @proxy.on_failure |
| Call | The B2BUA call object and its media handle |
| SDP | The sdp namespace, parsed SDP bodies, and media sections |
| SIP types | SipUri, Contact, Flow, and the captured Action record |
| Proxy & B2BUA | Routing handlers, forking, and subscription-dialog state |
| Registrar | Location service plus outbound trunk registration |
| Auth & security | Digest / IMS-AKA auth, IPsec sec-agree, STIR/SHAKEN |
| Media | RTPEngine media control and the QoS SDP-to-flow helper |
| Gateway | Health-probed destination groups and load balancing |
| Least-Cost Routing | The lcr namespace, the external API's JSON contract, and the typed request/response models |
| Diameter | Cx / Rx / Sh / Rf interfaces and inbound-request handling |
| IMS control | iFC evaluation, SBI/N5, presence, lawful intercept, SRS |
| Observability | Logging, cache, CDR, custom metrics, timers |
| CDR records | The record a CDR sink writes, typed for collectors |
| LCR API contract | The JSON siphon exchanges with an external least-cost-routing API |
| Control plane (remote SDKs) | Driving handed-over calls from an out-of-process app (pip install siphon-control, cargo add siphon-control-client) |
| Testing harness | The pytest harness and its result objects |
| Registrant provisioning | The registrant.backend sources, their JSON contract, and the typed row models |
| Gateway provisioning | The gateway.backend sources, their JSON contract, and the typed row models |