xphone is a single library — no gateway, no PBX, no infrastructure to deploy. Add it to your project, point it at a SIP trunk, and you're making real phone calls. Available in Go and Rust.
phone := xphone.New(
xphone.WithCredentials(
"agent", "secret", "sip.provider.com",
),
)
phone.OnIncoming(func(call xphone.Call) {
call.Accept()
// call.PCMReader() → your STT pipeline
})
phone.Connect(ctx) // ← that's it. Real calls. |
let phone = Phone::new(Config {
username: "agent".into(),
password: "secret".into(),
host: "sip.provider.com".into(),
..Config::default()
});
phone.on_incoming(|call| {
call.accept()?;
// call.pcm_reader() → your STT pipeline
Ok(())
});
phone.connect()?; // ← that's it. Real calls. |
SIP registration, RTP media, codec negotiation, NAT traversal — xphone handles the protocol complexity. You get clean PCM audio frames in and out.
Use xphone directly in Go or Rust for full control over calls and media. Use xbridge when you want REST/WebSocket access from any language without writing SIP code.
- AI voice agent builders — pipe call audio into your STT/LLM/TTS pipeline without a telephony platform
- VoIP developers — embed SIP calling into any app with a clean, testable API
- Teams moving off hosted voice APIs — own the media path, run on your infra
SIP signaling · RTP media · SRTP (SDES; see per-project docs for transport security details) · G.711, G.722, Opus, G.729 · H.264, VP8 · STUN/TURN/ICE-Lite · hold, transfer, mute, DTMF · SIP MESSAGE, presence, BLF
- SIP trunks: Telnyx, Twilio SIP, VoIP.ms, Vonage
- PBXes: Asterisk, FreeSWITCH, 3CX
- Test infrastructure: fakepbx (in-process SIP server, real SIP over loopback) + xpbx (Dockerized Asterisk) in CI
- Unit tests: MockPhone & MockCall — test call flows without any SIP server
See each repo's README for detailed compatibility notes.
- Not a hosted platform. No cloud service, no dashboard, no managed infrastructure. You run it, you operate it.
- Not a full Twilio replacement. xphone is the voice data plane — SIP and media. Billing, number provisioning, call routing rules, recording storage, and HA are your responsibility.
- Not batteries-included for security. SRTP is SDES-based. DTLS-SRTP is not currently supported. See each repo's README for the current security surface.
xphone is in active development and used in internal production workloads. APIs may change between minor versions. If you're evaluating, start with the examples and xphone-go (the more mature implementation).
| Project | Status | What it does |
|---|---|---|
| xbridge | Active | Self-hosted voice gateway — exposes xphone as WebSocket audio + REST API. Single-node, stateless. For teams using Python, Node, or other languages without a native xphone library. |
| xpbx | Active | Dockerized Asterisk PBX with web UI — useful for local development and testing against a real PBX. |
| fakepbx | Stable | In-process SIP server for Go tests. Real SIP over loopback — no Docker, no Asterisk. |
| fakepbx-rust | Stable | Same concept for Rust tests. |
| demos | Active | Working examples for the x-phone ecosystem. Start here if you're evaluating. |
MIT Licensed · Built with Rust and Go