Inbound Trunks
Inbound Trunks
An inbound SIP trunk represents a phone number (or set of numbers) that LiveKit can receive calls on.
SIPHON can either:
- Look up / create a trunk from a phone number (
sip_number) (recommended) - Or use an existing trunk (
sip_trunk_id)
Provider-specific SIP examples (Twilio, Telnyx, Plivo, Wavix): Provider-specific quickstarts
Recommended: provide a phone number
from siphon.telephony.inbound import Dispatch
dispatch = Dispatch(
dispatch_name="customer-support",
agent_name="CustomerSupport",
sip_number="+15550100",
)
SIPHON will:
- Reuse an existing inbound trunk already configured for that number, or
- Create a new inbound trunk.
Use an existing inbound trunk ID
from siphon.telephony.inbound import Dispatch
dispatch = Dispatch(
dispatch_name="customer-support",
agent_name="CustomerSupport",
sip_trunk_id="ST_xxx",
)
If you don’t provide sip_number, SIPHON will attempt to infer it from the trunk.
Create an inbound 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.inbound import Trunk
async def main():
trunk = Trunk()
result = await trunk.create_trunk(
name="customer-support",
sip_number="+15550100",
)
print(result) # {"trunk_id": "ST_..."}
if __name__ == "__main__":
asyncio.run(main())
Then pass the returned trunk_id into Dispatch(..., sip_trunk_id=...).
Delete an inbound trunk
You can delete inbound SIP trunks by trunk ID or phone number.
Delete by trunk ID
import asyncio
from siphon.telephony.inbound import Trunk
async def main():
trunk = Trunk()
result = await trunk.delete_trunk(trunk_id="ST_abc123xyz")
print(result)
# {"success": True, "trunk_id": "ST_abc123xyz"}
if __name__ == "__main__":
asyncio.run(main())
Delete by phone number
import asyncio
from siphon.telephony.inbound import Trunk
async def main():
trunk = Trunk()
result = await trunk.delete_trunk(sip_number="+15550100")
print(result)
# {"success": True, "trunk_id": "ST_abc123xyz"}
if __name__ == "__main__":
asyncio.run(main())
When deleting by phone number, SIPHON will:
- Look up the trunk associated with that number
- Delete the trunk if found
- Return an error if no trunk exists for that number
Note: Deleting a trunk does NOT automatically delete associated dispatch rules. You must delete dispatch rules separately.
Notes
- The underlying helper is
siphon.telephony.inbound.Trunk. - You still need a dispatch rule to connect the trunk/number to an agent.