[asterisk-users] Stripping characters from ${CALLERID(num)} ?

Bryant Zimmerman BryantZ at zktech.com
Thu Jul 7 15:13:45 CDT 2011


Here is a simple way to strip the '-' 

Here is a concept solution.
I have not tested the code so there may be some syntax errors. 
It can work as I am doing stuff like this all the time. This example is 
using a check to only do the cut if there is more than one field. You may 
be able to just use step 3 from ctx and have what you want, but I am not 
sure if it will fall back gracefully if there is only 1 field. 

No AGI required.

exten => mycode,n,Gosub(ctx,1)

exten => ctx,1,Set(l_filedCNT=${FIELDQTY(CALLERID(num),-)})
exten => ctx,n,GotoIf($[${MATH(${l_filedCNT}>1)}=TRUE]?DoStrip:SkipStrip)
exten => ctx,n(doStrip),Set CALLERID(num)=${CUST(CALLERID(num), -, 1-)
exten => ctx,n(doSkip),NoOp(${CALLERID(num)})

Thanks
zktech


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20110707/4e47a6d3/attachment.htm>


More information about the asterisk-users mailing list