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

Faisal Hanif faisal at vopium.com
Thu Jul 7 23:53:11 CDT 2011


Use Filter command in dia-plan to get numeric only string,

Set(MYNEWCLI=${FILTER(0123456789,${CALLERID(number)})

Regards,

Faisal

-----Original Message-----
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Tim Nelson
Sent: Thursday, July 07, 2011 9:44 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: [asterisk-users] Stripping characters from ${CALLERID(num)} ?

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

--
_____________________________________________________________________
-- 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




More information about the asterisk-users mailing list