How do you remove United States access code in CallerID from twilio

Hi,

I was wondering if anybody could point us in the right direction we have been trying to fix this issue for days, I have even contacted support but they keep pointing us to the same document that we have replicated time and time again with no success.

The problem we facing with our provider called Twilio, is that when we use one of their UK DDI they present the number with an access code from the United States 011 and then the 44 and the rest of the number.

We need this access code not to be presented on FREEPBX as it causes significant issues with our CDR for the third-party software that we use.

To see a copy of the documentation please look up this in twilio support ( /hc/en-us/articles/223183008-Formatting-International-Phone-Numbersthey)

This document tells you to follow these steps in order to stop this issue, but once we have implemented the changes we still receive the usa access code in front of the local access country code. is this something in freepbx we missing or is there something we need to make changes to in order to stop this from happening ? Any help that can be provided on this issue would be truly and greatly appreciated.

It’s not clear if you need to fix the CID, the DID or both. You can pre-process inbound calls by hitting your own context before the inbound route. Something like:

[from-twilio-preprocess]
exten => _01144X.,1,Noop(Entering user defined context from-twilio-preprocess in extensions_custom.conf
exten => _01144X.,n,Set(CALLERID(number)=${CALLERID(number):3})   ; strip leading leftmost 3 digits from CID 
exten => _01144X.,n,Goto(from-trunk,${EXTEN:3},1)        ; strip 3 leftmost digits from DID on all calls starting with 01144

;catchall
exten => _.,1,Goto(from-trunk,${EXTEN},1)

Hi Lorne,

I really appreciate your reply I believe it may possibly be the CID however the entire project now has been left to myself as we are using our backup system and our old provider until we get this issue fixed and unfortunately I am more of a GUI user myself,

I understand your reply as possibly creating a new context files to fix this issue however, I would not be a complete confident user in altering context code file with ssh, altho I could look at trying to do it but I have got to admit that I would be out of my Comfort zone and depth when it come to the back end of freepbx programming via ssh with nano.

If I have picked this up wrong or need to elaborate slightly more please do let me know and I can try and provide as much information as possible, once again any help is truly am greatly appreciated at this point as I feel like I’m going to have no hair left by the end of this, as I keep pulling it out trying to figure out what’s going wrong.

No need for ssh
image

Paste in the code above. Click save and apply changes.

Then go to your Twilio tgrunk and change the context to from-twilio-preprocess

Submit and apply changes.

2 Likes

Thank you so much this has solved the problem
This is why I love free PBX and its community it’s amazing I learn something new every single time I have to reinstall or develop it in some shape or form it is awesome and the community are the best and most helpful knowledgeable people I have ever got to speak to thank you so much I totally appreciate your help.

1 Like

Thank you SO much for all your help in relation to the issue above, I hope you don’t mind me asking for just one piece of advice would you be able to point me in the right direction in making a simple change to this code so it only sends the number (caller id) to look like this 0X. and not 44X. when being passed over to the CRD and the phones.

I sincerely apologise I should’ve stated that in the original post it was the caller id needing fixed, also the first part the code is doing its job by removing the 011 and leaving the 44X. of the incoming caller id, but I need the caller id to display one of two ways in the uk format, of something like this +44X. or 0X.

If you could let me know where to make a small change you would be a lifesaver once again I sincerely appreciate your help on this point you have been absolutely amazing and I truly appreciate all your help.

I assume that like Japan, your users are used to dialing 0+number?

@lgaetz I assume this comment should say leading leftmost 3?

exten => _01144X.,n,Set(CALLERID(number)=${CALLERID(number):3})   ; strip leading rightmost 3 digits from CID 

Assuming that is the case, this should do what you want @freepbxisking

exten => _01144X.,n,Set(CALLERID(number)=0${CALLERID(number):5})   ; strip 5 leading digits from CID and prepend a 0
1 Like

Hi Sorvani,

Once again thank you for your reply you’re awesome, when we call a local number with in the uk it would start something like this for a landline or cell phone 07 this is normally mobile or cell phone number start with.

And a UK landline number would look something like this starting 01 or 02 0r possibly 03 or 08 and 09 as a non-geographical number, but if you were calling from a European mobile or cell number outside of the UK you call it from a cell phone like this +44 or from a landline 0044 or in the above mentioned issue from the usa you would call 01144 and drop the first 0 and then input the rest of the number

But because the provider supplies the number with the following access code for some reason I need that to change to show the two previous mentioned prefixes +44 or drop the +44 and sent the uk umber with a (0) in front of the number so it would show up in the CDR as mentioned above.

I hope I have been able to explain this a wee bit better, I’ve never come across this problem before as our last supplier was a UK supplier, and the caller ID that would was sent to the system with the following prefix, +44, but twilio only shows 01144X. But need it to have the +44 and not 01144, I need to the caller id to be some like this 0X. or +44X. if there is a missed call then I can use the recall button and this would also match the outgoing call route.

I truly appreciate any help that can be given in relation to this small issue as we have moved VoIP provider and upgrading the the freepbx from FreePBX 2.10, I think? it an old system I know that much, and as there has been so many development and changes with an Asterisk and FreePBX it’s a complete learning curve again.

Yes, it should. Fixed now.

I am so sorry to ask this, but could you print the whole layout with the right code in the right place so i don’t miss something, as i’m not sure what line of code goes where at this point.

i’m so sorry to have to ask and this is the extensions_custom.conf i have running now.

============================================

[from-twilio-preprocess]
exten => _01144X.,1,Noop(Entering user defined context from-twilio-preprocess in extensions_custom.conf
exten => _01144X.,n,Set(CALLERID(number)=${CALLERID(number):3}) ; strip leading rightmost 3 digits from CID
exten => _01144X.,n,Goto(from-trunk,${EXTEN:3},1) ; strip 3 leftmost digits from DID on all calls starting with 01144

;catchall
exten => _.,1,Goto(from-trunk,${EXTEN},1)

=======================================

Thank you so much.

You are matching the request URI (possibly the same as the DID), not the CID, in your dialplan fragment. You need a pattern, or literal, to match the request URI user part, followed by a “/”, before the pattern to match the caller ID.

I would have assumed you would also need to provide code to add 00, in front of North American numbers, and one to strip 011 and add 00 when 011 is not followed by 44.

I’m not really a FreePBX user, so my first thought would be to do it in the above way, but it looks, to me that you could define inbound routes, for that trunk, for each of the above three cases, and connect them to CallerID modules, to the transformation, before going on to the normal call handling.

I suggest you seriously consider canonicalising everything to the +44 type format, which is what Microsoft do in the products.

You generally talk as though you are in the UK; why are you using a provider that seems targetted to the US market, but for calls originating from the UK? That doesn’t seem an efficient or resilient configuration. What would happen if transatlantic fibres were taken out?

All he wants is inbound calls from a specific trunk to have the CID cleaned up.

But I assume that that trunk could carry traffic from all over the world, all of it presented as though locally dialled in the USA, and the OP wants the CID to be rewritten as though it were a number dialled in the UK. Using a US based trunk and not carrying US originated phone calls doesn’t make sense to me.

Maybe less assuming and more answering what he asks.

[from-twilio-preprocess]
exten => _01144X.,1,Noop(Entering user defined context from-twilio-preprocess in extensions_custom.conf
exten => _01144X.,n,Set(CALLERID(number)=0${CALLERID(number):5})   ; strip leading leftmost 5 digits from CID and prepend a 0.
exten => _01144X.,n,Goto(from-trunk,${EXTEN:3},1)        ; strip 3 leftmost digits from DID on all calls starting with 01144

;catchall
exten => _.,1,Goto(from-trunk,${EXTEN},1)

What I think he wants is something like the following, but I generally work on the principle that, for unpaid support, one should address general principles, and not give detailed solutions, so that the next time something similar comes, up the first reaction is to reapply the principles, rather than ask for another worked solution.

NB the following is untested.

exten => _./_01144.,1,Set(CALLERID(number)=0${CALLERID(number):5})
exten => _./_011.,s,Set(CALLERID(number)=00${CALLERID(number):3))
exten => _.,s,Set(CALLERID(number)=00${CALLERID(number)}
; Should probably cover carrier select codes, not just the 1 for default carrier case.
exten => _.,n,Goto(from-trunk,${EXTEN},1)

HI David,

Thank you very much for the reply really appreciate your input extremely helpful, ideally yes the code that was supplied to make the changes works perfectly but does not include a + sign I don’t know what part of the code to update to make it do that.

In relation to the outbound call roots I got that to work fine with a call made starting 44 or starting with a 0, the other part of your question was in relation to why use a company that seems to be orientated around United States customers, twilio also supplies UK customers with servers in the same location i.e dublin and london, we want to use them for inbound DID’s as they supply the number range that we are looking to use within our system setup.

Unfortunately our last supplier has been acquired buy a company that we have dealt with in the past that supplies Voip services and the voice quality of service is very poor, and this is something that we do not want to go back to and this is the reason for jumping ship.

The other reason for this type of post is because I have not had to work on our free PBX system for many years and I am very much out of touch with FreePBX and voip as our old systems just worked and was almost forgot about until now, and a lot of changes has been made to Asterisk and FreePBX and also the way trunks and the way calling works with today’s standards, if our old sever system hadn’t of need updated we probably would still be using it as it was not open to the world apart from out vpn to the voip supplier, so you could say that this is back to the drawing board and classroom for me.

This is the reason that it was decided to use the latest version of FreePBX on our new HPE ProLiant ML350 Gen10 servers

Can any one please help with this small update ? just looking the code to sent the caller id as +44 and not 44thank you in return

Just put “+” in the appropriate place in the string expression for the transformed CLI (and, although you didn’t mention the access code, remove the international access code that was there before).