Outbound CID manipulation

I’m in Australia where our inbound and outbound PRI CID’s contain a single digit area code and the number. eg 912345678 where 9 is the area code.

My problem is I have a SIP provider that requires outbound CID to have a leading 0 (AU national numbers are dial like (09)12345678)

I need to add a 0 to the CID but only for a specific trunk. I know how to code this in dial plan, but how do I get it to occur where it’s needed.

Eg, the trunk I’m using looks like this (from extensions_additional.conf)

include => from-trunk-Sip-Nehos-custom
exten => _.,1,Set(GROUP()=OUT_9)
exten => _.,n,Goto(from-trunk,${EXTEN},1)

I could do it in from-trunk-Sip-Nehos-custom but every attempt I have tried never gets executed.

Does anyone know how to get something like the following to work

exten _.,1,Noop(FIX CID HERE)

the above never gets executed.


It appears that you’ve omitted the “=>”. You wrote,

exten _.,1,Noop(FIX CID HERE)

should be,

exten => _.,1,Noop(FIX CID HERE)
exten => _.,n,Set(CALLERID(nun)="0${CALLERID(nun)}")

oh, and remember to reload the config

$ asterisk -vvvrx reload

Isn’t from-trunk-… only used for incoming calls?

If you add ‘exten => _.,n,Set(CALLERID(nun)=“0${CALLERID(nun)}”)’ in this context, does that modify CLI on outgoing calls?

Most likely, yes, this adjusts the in-bound callerid(num). It was a correction to the context presented. Same “0${CALLERID(num)}” suggestion applies to an outbound context.


Yes, that was an oversight but I still dont think that would have worked.

My eventual solution was the following


exten => _.,1,Noop(*** Fixup Outbound CID ***)
exten => .,n,GotoIf($["Z${OUT${DIAL_TRUNK}}" = “ZSIP/Sip-SomeProvider”]?Add
exten => _.,n,Goto(Skip)
exten => _.,n(Add),Set(CALLERID(all)=0${CALLERID(number)})
exten => _.,n(Skip),Noop

The above macro is mentioned in extensions.conf as follows

; this macro intentially left blank so it may be safely overwritten for any custom
; requirements that an installatin may have.
; if set to “BYPASS” then this trunk will be skipped

Thanks anyway,