I’m trying to get FreePBX to make outbound calls using Twilio. I’m attempting to use PJSIP as provided by Twilio documentation but for some reason, the PBX is unable to route the calls out. I ran some debugs and this is where I get lost.
Here are the relevant logs when I was debugging:
-- Executing [s@macro-dialout-trunk:33] ExecIf("PJSIP/100-0000000a", "0?Set(DIAL_TRUNK_OPTIONS=)") in new stack
-- Executing [s@macro-dialout-trunk:34] Dial("PJSIP/100-0000000a", "PJSIP/+1XXXXXXXXXX@TwilioTrunk,300,Tb(func-apply-sipheaders^s^1,(1))") in new stack
[2020-01-11 16:12:55] ERROR[25420]: chan_pjsip.c:2486 request: Unable to create PJSIP channel - endpoint 'TwilioTrunk' was not found
[2020-01-11 16:12:55] WARNING[1692][C-0000000b]: app_dial.c:2512 dial_exec_full: Unable to create channel of type 'PJSIP' (cause 3 - No route to destination)
== Everyone is busy/congested at this time (1:0/0/1)
-- Executing [s@macro-dialout-trunk:35] NoOp("PJSIP/100-0000000a", "Dial failed for some reason with DIALSTATUS = CHANUNAVAIL and HANGUPCAUSE = 3") in new stack
Firewall is disabled and as mentioned in the post, the PBX is able to reach Twilio when using chanSIP. So I think from a network perspective, we should be good.
I believe you may be getting hit by a filed issue[1] where FreePBX is generating configuration that doesn’t work with Asterisk 15. I’d suggest upgrading to Asterisk 16 if you can, as that would both solve this and also get you onto a version of Asterisk that is still supported and receiving security fixes.
Thanks for the info. I switched to asterisk 16 and made a test call.
Here are the logs for the new outbound call:
[2020-01-11 18:19:30] ERROR[16620]: res_pjsip.c:3533 ast_sip_create_dialog_uac: Endpoint ‘TwilioTrunk’: Could not create dialog to invalid URI ‘TwilioTrunk’. Is endpoint registered and reachable?
[2020-01-11 18:19:30] ERROR[16620]: chan_pjsip.c:2649 request: Failed to create outgoing session to endpoint ‘TwilioTrunk’
[2020-01-11 18:19:30] WARNING[18732][C-00000002]: app_dial.c:2578 dial_exec_full: Unable to create channel of type ‘PJSIP’ (cause 3 - No route to destination)
I do see this new error:
[2020-01-11 18:19:39] ERROR[16620]: res_pjsip.c:4261 endpt_send_request: Error 320047 ‘No answer record in the DNS response (PJLIB_UTIL_EDNSNOANSWERREC)’ sending OPTIONS request to endpoint TwilioTrunk
[2020-01-11 18:20:39] ERROR[16620]: res_pjsip.c:4261 endpt_send_request: Error 320047 ‘No answer record in the DNS response (PJLIB_UTIL_EDNSNOANSWERREC)’ sending OPTIONS request to endpoint TwilioTrunk
[2020-01-11 18:21:39] ERROR[16620]: res_pjsip.c:4261 endpt_send_request: Error 320047 ‘No answer record in the DNS response (PJLIB_UTIL_EDNSNOANSWERREC)’ sending OPTIONS request to endpoint TwilioTrunk