Change incoming number CID to international format

Hi All,
I’m a newbie at FreePBX, I’ve setup a basic system to forward calls from my home line to my mobile via a SIP trunk.
Setup is as follows:
FXO - FreePBX - RingGroup - 00447889123456 - SIP trunk
The issue is that I need to change the incoming CID to international format, so the SIP trunk will accept it. I know all the routing works, as if I force CLI in the Ring Group the call routes OK.

I’ve followed this post: Manipulating incoming CID
I edited extensions_custom.conf and added the following, then rebooted:

exten => _[0-9]./_[0]X.,1,Set(CALLERID(num)=+44${CALLERID(num):1})
exten => _X.,n,Goto(from-trunk,${EXTEN},1)

I’ve added from-trunk-international as the context for the outgoing SIP trunk

However looking at the log, the CLI does not appear to change, if someone could point me in the right direction, I would be very grateful :slight_smile:

Here is my log (Numbers have been changed for privacy):CID - FreePBX Pastebin

PS I’m calling from 07469123456, destination is 07889123456 amd FXO DID is 02086691234

In /etc/asterisk/extensions.conf is a context


you can template that to build


(or ask for a copy from someone who has been there)

The Context for a trunk is used only on incoming calls, so your code didn’t get executed.
You could set a Context for the FXO (or just use a Set CallerID object), but that would also change the number displayed on your internal devices to international format, which you may not want. In which case use a hook on the outbound trunk. rate to +447889 (which they claim is UK O2 mobile) is $0.1806 (Value) and $0.5892 (Premium). Do you know that Value will pass caller ID reliably? The Premium rate seems exhorbitant.

Can you just ring a SIP app on your mobile instead? That would be free (though you may have to pay once for the app) and you could send any caller ID you like.

Or, Voxbeam’s Platinum rate to +447889 (which they claim is Telefonica) is a very reasonable $0.0101.

And, if your number was ported (I can’t tell because it’s redacted), it could be with a different operator.

Edit: sorry, I didn’t realize that O2 is just a brand name of Telefonica, so the rate cards are consistent.

Thank you, I’ll have a search to see if anyone has published anything.


Thank you for your prompt reply and suggestions.

Ah, I thought it meant “from PBX to trunk”, I have now moved it to the FXO and that works. Thank you.
As an added bonus, if I amend from +44 to 0044, I hopefully can get redial to work from phones :slight_smile:

I looked at hooks and got very confused. A couple of articles say it is in “/etc/asterisk/extensions_custom.conf” and commented out, my file is blank?

Yes, I got pulled in by their headline price, once my credit as run out I’ll be saying good bye.

That is my next project :slight_smile:

Thanks, I’ll take a look