----------------------------------------
From: "Bryant Zimmerman" <[email protected]>
Sent: Thursday, July 07, 2011 4:14 PM
To: "Asterisk Users Mailing List - Non-Commercial Discussion"
<[email protected]>
Subject: Re: [asterisk-users] Stripping characters from ${CALLERID(num)} ?
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:doSkip)
exten => ctx,n(doStrip),Set (CALLERID(num)=${CUT(CALLERID(num), -, 1-)})
exten => ctx,n(doSkip),NoOp(${CALLERID(num)})
Thanks
zktech
Made a correct in the above to reflect the skip state doSkip vs SkpStrip
and made syntax correct to the Set/CUT line. There may still be a few more
syntax issues in there.
zktech
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users