[SOLVED] Rewrite CallerID first digit

The caller id pattern the telco provides for me is X-AREA CODE-NUMBER, where X is most of the time 1 or 2, meaning something like “1 - regular subscriber” or “2 - special fees”.

How can I rewrite the first digit with 0 so it is always displayed like 0-ARE CODE-NUMBER?

Any pointers would be appreciated. Thanks.

EDIT [SOLVED]:

For future reference, I’ve managed to solve this by creating a custom context (in this case “from-algar” and making that context the entry point for the received calls.

This custom context replaces the first digit by running Set(CALLERID(num)=0${CALLERID(num):1}) and then it calls the context that would be usually called (“from-dahdi”):

File /etc/asterisk/chan_dahdi_groups.conf:

; Algar Tel 1
; Using default bell/ring for cidsignalling/cidstart
signalling=fxs_ks
context=from-algar
rxgain=-5.0
txgain=0.0
group=0
channel=>1


; Algar Tel 2
; Using default bell/ring for cidsignalling/cidstart
signalling=fxs_ks
context=from-algar
rxgain=-5.0
txgain=0.0
group=0
channel=>2

File /etc/asterisk/extension_custom.conf:

[from-algar]
exten => _.,1,NoOp(Rewriting caller id for Algar Telecom - Custom Context)
 same => n,NoOp(Caller ID is: ${CALLERID(num)})
 same => n,Set(CALLERID(num)=0${CALLERID(num):1})
 same => n,NoOp(New caller ID is: ${CALLERID(num)})
 same => n,Goto(from-dahdi,_X.,1)

Thanks.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.