Outbound Trunks
Outbound Trunks
Outbound calls require an outbound SIP trunk (credentials for your SIP provider) so Siphon can dial the PSTN.
Provider-specific SIP examples (Twilio, Telnyx, Plivo, Wavix): Provider-specific quickstarts
SIPHON supports two approaches:
- Provide full trunk credentials (
sip_trunk_setup) so SIPHON can look up or create the trunk (recommended) - Or provide an existing outbound trunk ID (
sip_trunk_id)
Recommended: use sip_trunk_setup
If you don’t already have a trunk id, pass credentials and SIPHON will reuse or create an outbound trunk.
from siphon.telephony.outbound import Call
call = Call(
agent_name="Receptionist",
sip_trunk_setup={
"name": "telnyx-primary",
"sip_address": "sip.telnyx.com",
"sip_number": "+15550001",
"sip_username": "...",
"sip_password": "...",
},
number_to_call="+15550002",
)
SIPHON will:
- Reuse an existing outbound trunk with matching settings, or
- Create a new outbound trunk.
Use an existing outbound trunk ID
from siphon.telephony.outbound import Call
call = Call(
agent_name="Receptionist",
sip_trunk_id="ST_xxx",
number_to_call_from="+15550001",
number_to_call="+15550002",
)
If you omit number_to_call_from, SIPHON will attempt to infer it from the trunk.
Create an outbound trunk manually
If you want to create a trunk yourself (and then reference it by sip_trunk_id), you can use the trunk helper directly.
import asyncio
from siphon.telephony.outbound import Trunk
async def main():
trunk = Trunk()
result = await trunk.create_trunk(
name="telnyx-primary",
sip_address="sip.telnyx.com",
sip_number="+15550001",
sip_username="...",
sip_password="...",
)
print(result) # {"trunk_id": "ST_..."}
if __name__ == "__main__":
asyncio.run(main())
Then pass the returned trunk_id into Call(..., sip_trunk_id=...).