Modification to incoming CID to remove +44 solved

I am posting this in case it helps anybody else with solving the issue of modifying the incoming CallerID. My SIP provider CallerID comes in the format +44123456789 but my database uses 0123456789 - so I needed to remove the ‘+44’ and add a ‘0’ to the callerid to allow it to query the user database. Easy way:

Create a new context in extensions_custom.conf as follows:

exten => _X.,1,Set(CALLERID(num)=0${CALLERID(num):3:12})
exten => _X.,n,Goto(from-trunk,${EXTEN},1)

then change the context in your SIP trunk to


Job done! :stuck_out_tongue:

Problem solved with major thanks to Rob Thomas (X-Rob) and ‘wiseowl’ through FreePBX IRC support. Much appreciated.

I tried watching the CLI, but I dont see it trying to use the custom context.

Someone have a tip on why it never hits my custom context?

Is it possible to remove digits from the end of an incoming caller ID?

I have a SIP provider which sends HK at the end of the 8-digit CID which means I can’t easily return calls.


Just random thoughts cos I’ve been solving similar probs…

Have you tried watching the asterisk cli as a call comes in, to see if it really does run the custom-from-trunk context

or mod said context to something like
exten => _.,1,SayDigits(1234)
and see if you get the voice


Thanks, that has been bothering us for way too long, now redial calls on our Cisco 7960’s work correctly, without the + sign messing things up.

Thanks so much.

My pleasure - I had battled with it for ages and then Rob Thomas gave me some guidance via the IRC support channel.


For the life of me, I cannot figure out why this doesnt work anymore.

I am on the latest Trixbox, with all modules updated.

No matter what context I put in the extension, rebooted, the result is the same.

We are trying to remove the + for incoming CID, so our Cisco phones can redial. If the CID has a + in it, the Cisco 7960 wont even try to dial and fails immediately with error: Reorder.

I must be missing something obvious!

Suggestions appreciated!