CID customization/override

Hi,

I configured an IAX trunk between two sites. the CID that is being passed from one site to the other is the internal one.

I would like to override that CID and customize it by adding digit to the start of it.

how should i do it?

Thanks!

AFAIK there’s no way to do this from within the FreePBX interface, but it’s certainly possible with a bit of custom code. Take a look at How to execute a custom dial plan fragment before sending a call to a trunk (for playing an announcement, etc.) - you may be able to use a custom fragment to add a digit to the CALLERID(num) variable, similar to what’s described in How to change incoming CallerID except you’d be doing it on the outbound side.

Hi,

I had a need to do this recently as our PSTN requires outbound CID to strip the leading 0 from the phone number, but our SIP provider wants the number in full.
I also wanted to adjust outbound DID’s between our office’s.

Following is how I did it

[macro-dialout-trunk-predial-hook]
exten => _.,1,Noop(*** Fixup Outbound CID for specific trunk ***)
exten => .,n,GotoIf($["Z${OUT${DIAL_TRUNK}}" = “ZSIP/SomeTrunk”]?AddZ
exten => _.,n,Goto(Skip)
exten => _.,n(AddZ),Set(CALLERID(all)=0${CALLERID(number)})
exten => _.,n(Skip),Noop

exten => .,n,GotoIf($["Z${OUT${DIAL_TRUNK}}" = “ZIAX2/InterOffice”]?AddZ1
exten => _.,n,Goto(Skip1)
exten => _.,n(AddZ1),Set(CALLERID(all)=${CALLERID(number):6})
exten => _.,n(Skip1),Noop

SIP/SomeTrunk is the name of the trunk in FreePBX’s trunk page. This has been working for us for a few days now.

Have a look in extension.conf for the same macro and you should see how it gets called.

Andrew

exten => _.,n,GotoIf($["Z${OUT_${DIAL_TRUNK}}" = "ZSIP/SomeTrunk"]?AddZ
exten => _.,n,Goto(Skip)
exten => _.,n(AddZ),Set(CALLERID(all)=0${CALLERID(number)})
exten => _.,n(Skip),Noop

may be be more simply written as

exten => _.,n,GotoIf($["Z${OUT_${DIAL_TRUNK}}" = "ZSIP/SomeTrunk"]?AddZ:Skip)
exten => _.,n(AddZ),Set(CALLERID(all)=0${CALLERID(number)})
exten => _.,n(Skip),Noop