Hello, I got a number from twilio, setup the sip t...
# telephony
a
Hello, I got a number from twilio, setup the sip trunk, my freeswitch server receives the call and tries to bridge to livekit. but livekit returns 503. Here is the summary of the problem Phone number +19793169351 configured in LiveKit SIP trunk returns "503 Service Unavailable" when called. Other phone numbers on the same FreeSWITCH server, using the same LiveKit trunk and dispatch rule, work correctly. ## Observable Facts ### The Failing Number - Number: +19793169351 - Provider: Twilio Elastic SIP Trunk - Caller origin: +15106049930 - Response: 503 Service Unavailable from LiveKit (within 1ms) ### Working Numbers (Examples) - Number: +902162351219 (Provider: Verimor) - Number: +902162125830 (Provider: Wespoke) - Same response flow: 100 → 180 → 183 → 200 OK → Call connects ### Infrastructure (Same for All) - FreeSWITCH server: 91.98.71.57 - LiveKit trunk: ST_CxLmHYdYMLRy - LiveKit dispatch rule: SDR_xZ8LxKK2tDtd - LiveKit endpoint: 567c09dlu6y.eu.sip.livekit.cloud:5060 (UDP) - Agent infrastructure: Running and working ## SIP Message Details ### INVITE FreeSWITCH Sends to LiveKit (Failing Number) INVITE sip:19793169351@567c09dlu6y.eu.sip.livekit.cloud:5060 SIP/2.0 From: "UJDDGMFMON" sip:freeswitch_uz@567c09dlu6y.eu.sip.livekit.cloud To: sip:19793169351@567c09dlu6y.eu.sip.livekit.cloud:5060 X-DID: 19793169351 X-From: +15106049930 X-Called-Number: 19793169351 X-Caller-Number: +15106049930 X-Call-ID: 37e84faa-ad2c-4786-aabc-5e395d12f5e2 X-FreeSWITCH-Server: http://91.98.71.57:8888 X-FreeSWITCH-UUID: 37e84faa-ad2c-4786-aabc-5e395d12f5e2 ### LiveKit Response (Failing Number) SIP/2.0 503 Service Unavailable Reason: Q.850;cause=16;text="NORMAL_CLEARING" LiveKit Configuration SIP Trunk Numbers Array "numbers": [ "+19793169351", "19793169351", "9793169351", "+902162351219", "902162351219", "2162351219", "+902162125830", "902162125830", "2162125830" ] SIP Trunk Settings { "allowedAddresses": ["93.174.164.26", "91.98.71.57", "10.1.99.0"], "authUsername": "freeswitch_uz", "authPassword": "LiveKit2024SecurePass!", "headersToAttributes": { "X-DID": "did", "X-From": "from_number", "X-Called-Number": "did", "X-Caller-Number": "from_number" } } Dispatch Rule { "rule": { "dispatchRuleIndividual": { "roomPrefix": "call" } }, "trunkIds": ["ST_CxLmHYdYMLRy"], "metadata": "{\"dispatch\":\"agent\",\"trunk\": \"freeswitch-93.174.164.26\", \"assistant_id\": \"${assistant_id}\", \"phone_number\": \"${from_number}\", \"call_id\": \"${call_id}\", \"did\": \"${did}\"}", "roomConfig": { "agents": [ { "metadata": "{\"assistant_id\": \"${assistant_id}\", \"phone_number\": \"${from_number}\", \"call_id\": \"${call_id}\", \"did\": \"${did}\"}" } ] } } FreeSWITCH Configuration Failing Number Dialplan Wespok e1|\+19793169351|19793169351|9793169351)$" action application="set" data="sip_h_X-DID=19793169351"/ action application="set" data="full_did=+19793169351"/ <action application="system" data="/usr/local/freeswitch/scripts/call-workaround.sh '${full_did}' '${uuid}' '${caller_id_number}' '$${freeswitch_server_url}' '$${sip_media_shared_token}'"/> <action application="bridge" data="{sip_h_X-DID=19793169351,...}sofia/g ateway/livekit_udp/19793169351"/> /condition Working Number Dialplan (Example) <condition field="destination_number" expression="^(gw\+VERIMOR|gw\+902162351219|902162351219|2162351219)$"> action application="set" data="sip_h_X-DID=902162351219"/ action application="set" data="full_did=+902162351219"/ <action application="system" data="/usr/local/freeswitch/scripts/call-workaround.sh '${full_did}' '${uuid}' '${caller_id_number}' '$${freeswitch_server_url}' '$${sip_media_shared_token}'"/> <action application="bridge" data="{sip_h_X-DID=902162351219,...}sofia/ gateway/livekit_udp/2162351219"/> /condition What We've Verified - ✅ Number is in trunk's numbers array (3 formats) - ✅ Source IP (91.98.71.57) is in allowedAddresses - ✅ Authentication succeeds (no 401/407) - ✅ Trunk ID matches dispatch rule trunkIds - ✅ Backend assigns assistant successfully - ✅ FreeSWITCH sends INVITE to LiveKit - ❌ LiveKit immediately returns 503 Question What causes LiveKit to immediately return 503 Service Unavailable for this specific phone number configuration while accepting other numbers on the same trunk with the same dispatch rule?
r
I am seeing
twirp error failed_precondition: Multiple SIP Trunks matched for ..."
. This can happen if you define the phone number twice for instance if you were to do
+<PHONE_NUMBER>
and
<PHONE_NUMBER>
in the same SIP trunk
a
yes, this was the problem indeed, thank you @refined-appointment-81829!!
👍🏼 1