Strange Behavior with Twilio Toll-Free Elastic SIP Numbers Terminating in FreePBX Failing

We have about 100 numbers with Twilio that are connected to our FreePBX server with Twilio’s Elastic SIP trunking.

Calls received at our ten-digit US numbers are being connected to FreePBX with no issues.

Our toll-free numbers, with different NXXs (833, 844, 855, 877, etc.), are mostly being rejected. FreePBX shows nothing, as far as we can see, in the logs for these calls; but, Twilio shows the following error for the calls:

Request timeout with sip:[email protected]
ErrorCode 32011,Error communicating with SIP destination

All calls (regular and toll-free) are connected with the same SIP trunk to FreePBX.

If we disable the firewall in FreePBX, the test calls come through, at least as many as we tested. We have added the Twilio IP ranges and ports for all of their SIP addresses to the firewall, but still continue to reject calls.

As a work around, we are answering the calls with Twilio and using a TWiML script to simply redirect the calls to their SIP address in FreePBX, and the calls complete with no issues.

Any thoughts on what might be causing most of the toll-free calls to be rejected, with no logging in FreePBX?

Thanks.

So it seems reasonably certain that either
Twilio is sending those calls from an IP address not in their IP range document, FreePBX Firewall is misinterpreting your Trusted list, or you made an error entering them.

Either use sngrep (which listens ahead of the Firewall) or temporarily disable the Firewall and use pjsip logger to see from where the calls are being sent. Compare with Twilio docs and your Trusted list.

(following. we are looking to use Twilio as well and seeing what issues may be out there)

Are you using their SMS texting as well ? If so, Can I hit you with some questions ?

We are not using SMS. The last time I used Twilio SMS was before 10DLC was a thing, so I’m probably way to rusty to be of help.

Thanks for the tip on sngrep, that has been helpful, but we still don’t have a solution.

It appears that calls coming in on 54.244.51.x, are being rejected as “401 UNAUTHORIZED”, while 54.172.60.x, are successful.

In intrustion detection, we have 54.172.60.0/30 and 54.244.51.0/30 whitelisted, and the firewall is responsive, so we cannot explicitely add IPs to the rules.

The calls coming in from 54.244.51.0/30 are being rejected, and show as such in the sngrep log, even when the firewall and/or intrustion detection are turned off.

Does FreePBX have the ability to reject calls, outside of the firewall, based on IP?

Add both of these netblocks to Match (Permit) for the trunk.

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