[asterisk-users] Stripping characters from ${CALLERID(num)} ?
Tim Nelson
tnelson at rockbochs.com
Thu Jul 7 11:43:42 CDT 2011
Greetings-
On occasion, I have calls coming into an Asterisk 1.2.x system where the ${CALLERID(num)} includes '-'. Ex:
123-456-7890
How can I strip the dashes from the number, leaving me with '1234567890'?
I've tried the following which does not appear to be working:
Dialplan:
exten => _X.,n,Set(PROPERCID=System(echo ${CALLERID(num)} | sed s/\-//g))
exten => _X.,n,NoOp(Fixed proper CID is ${PROPERCID}
Console Output:
-- Executing [1111111111 at cidmangletest:4] Set("SIP/w.x.y.z-b4d55ce8", "PROPERCID=System(echo 123-456-7890 | sed s/\-//g)")
-- Executing [1111111111 at cidmangletest:5] NoOp("SIP/w.x.y.z-b4d55ce8", "Fixed proper CID is System(echo 123-456-7890 | sed s/-//g)")
Obviously, I'm trying to throw the CID through sed via System() to strip the dashes. Can anyone explain how to accomplish this? Or even better yet, how to strip the dashes directly in the dialplan without the use of System()?
Thanks!
--Tim
More information about the asterisk-users
mailing list