Good evening all of you FreePBX-ers far smarter than I appear to be. I have been struggling with this problem for days and I’m at my wits end.
I’m using Twilio elastic trunking for my trunk and it works without issue.
First, let me say that the system appears to be functioning properly. Dial my number, IVR picks up, transfer to extension and then answer or voice mail. Works great. Thrilled. Couldn’t be happier. All outgoing dialing works with the different formats so it looks like my dial pattern on my outgoing trunk is setup correctly.
And then it happened…
I tried to enable the Follow Me to ring a cell phone and HAVE GOTTEN NOWHERE. It never works and the format of the number that is being sent to Twilio is incorrect. if I enter 9735551212 in the Follow me config, then that’s what twilio gets. If I enter 19735551212 in the FM config, then that’s what twilio gets. IT NEVER gets +19732228747 - which it does if I type it in from any of my phones.
Anybody who can provide some guidance here will save me from pulling out what little hair I have left.
asterisk -x “dialplan show [email protected]”
Pastebin 0df72c31! (since it tells me new users can’t include links in messages)
Of course, the system also won’t let me put a jpg of my dial patterns here - but I can say they work without issue from every phone.
Thank you in advance to anyone who saves my sanity!
The problem is not with the destination number, but with caller ID. Log paste line 1047: X-Twilio-Error: 32204 The caller-ID 9735551212 is unverified. SIP Trunking terminating calls to PSTN must use a valid Caller ID in the From Field. A Valid Caller ID is either a DID you have purchased from Twilio or a verified Caller ID.
By default, Follow Me sends the original caller’s number as caller ID, which Twilio does not permit.
The quick fix: In the Follow Me config, set Change External CID Configuration to Outside Calls Fixed CID Value, and set Fixed CID Value to +19845551212.
Going forward, you need to decide whether you need to pass arbitrary caller IDs. If so, you could consider an inexpensive trunking provider such as AnveoDirect, for these calls and as a backup to Twilio. Or, consider a provider such as Telnyx as a replacement for Twilio; they are a carrier in Raleigh rate center and should be able to port your Garner numbers. I believe that Twilio is using a third-party CLEC for your numbers. However, first take a look at Telnyx rate card; there are ~50 high-rate NXX in 919, though none in 984.
If you don’t care about the original caller’s number, you could add a dial plan hook to check for outside numbers and replace them with your main company number. Or, if you don’t care about outbound caller ID at all and are happy to always send your main company number, just set Force Trunk CID in the trunk.
Thank you for your response. You are correct about line 1047 in the log. I opened a ticket with Twilio and 9735551212 is a verified number with them, but they are expecting it as +19735551212 and therefore rejecting it. Is there no way to get Follow Me or FreePBX to add the + to the beginning of the number? Are calls going out via FM not using the dial patterns on the trunk? FM seems to pass them blindly. Again, if I put the cell phone number in as 9735551212 that is how it is delivered to Twilio or if I put it in as 19732228747 that is how it is delivered. If I put the + in front of the 1, it get stripped somewhere.
I will try your quick fix just to see if I can make the calls go through but it seems that the above situation isn’t correct.
First, FreePBX doesn’t have a coherent system for dealing with phone numbers. It has sophisticated rules for rewriting outbound destination numbers (in both Outbound Routes and Trunks), crude tools such as the from-pstn-e164-us context for rewriting inbound caller ID and destination numbers, but nothing at all for rewriting outbound caller ID. You can fix your present issue with a hook that prepends +1 to CALLERID(num) on calls to the Twilio trunk:
However, I didn’t mention this in my previous post, because it wouldn’t help if the original caller was e.g. a customer whose number would not have been verified with Twilio. I know little about Twilio and they might be willing to send numbers that are not yours if you sign a suitable agreement, or perhaps with some technical change that allows them to track your calls properly (FreePBX already adds a Diversion header, but it may not be in the format Twilio wants).
Finally, what is your application? If it is acceptable to send your main company number on all calls, force the Trunk CID and call it a day. If you need to send customer numbers on Follow Me, you will either have to work this out with Twilio or use another provider, at least for forwarded calls. However, if you want a hybrid solution, sending the original number when verified but a fixed number otherwise, that requires custom dial plan to implement.