Twilio inbound route without allowing anonymous calls

Hello everyone,
there are plentiful discussions on this topic here, but I can’t seem to find anything that resembles my situation.
Outbound route works with Twilio (FreePBX 14).
Separate outbound routes have been created for all 4 IPs with the following User Details for Incoming Tab:

type=peer
insecure=port,invite
host=35.156.191.128
context=from-pstn-e164-us
canreinivite=no

However upon attempting a call, on the Twilio side I see Authentication error 401, on FreePBX side the following line:
NOTICE[24262]: res_pjsip/pjsip_distributor.c:649 log_failed_request: Request ‘INVITE’ from ‘“Unavailable” sip:[email protected]’ failed for ‘54.171.127.193:5060’ (callid: 2[email protected]) - No matching endpoint found.

I have spent several days looking for solution and trying various configuration options, but still unsuccessfully.

Any piece of advice would be greatly appreciated.

You appear to have created chan_sip trunks, but your inbound calls are arriving on the pjsip port. Adjust the port to which Twilio sends calls to match your chan_sip port.

1 Like

… or better yet, set up PJ-SIP trunks for these. We’ve talked quite a bit about Twilio trunking in the past and the consensus seems to be that Twilio works well with PJ-SIP.

You can have PJ-SIP and Chan-SIP trunks with all the same information, so you can do this as a test and make sure it’s going to do what you need.

4 Likes

It is also what is in their instructions now. But some older video guides get higher Google rankings and those use chan_sip.
All of their guides: https://www.twilio.com/docs/sip-trunking/sample-configuration
FreePBX: https://www.twilio.com/docs/documents/53/TwilioElasticSIPTrunking-FreePBX-Configuration-Guide-Version1-0-FINAL-06122018.pdf

2 Likes

Thank you @lgaetz, @cynjut and @sorvani very much for your suggestions!
I ended up creating Twilio chan_pjsip trunk that serves for both outgoing and incoming calls, and it works now in both directions flawlessly.
Since it was my second FreePBX setup at first I decided to go for plain chan_pjsip driver for both trunks and extensions, but my 12 trunks sporadically were loosing registration. Therefore I built all my trunks as chan_sip that proved to be much more stable. My extensions are still remaining on chan_pjsip driver. Both receiving and initiating calls works well for all my trunks, and only chan_sip Twilio inbound failed.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.