On Thu, 7 Jul 2011, Tim Nelson wrote:
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 would do this in an AGI written in C -- but that's just me...
At the start of most of my client's dialplans I do something like:
exten = _!.,1, verbose(1,[${EXTEN}@${CONTEXT}])
exten = _!.,n, set(ANI=${EXTEN})
exten = _!.,n, agi(block-ani,--verbose)
The block-ani AGI does something like:
) Set the BLOCK channel variable to YES
) Read the ANI channel variable
) Strips leading '+'
) Strips leading '1'
) Strips anything non-numeric
) If the preceding steps changed anything, re-set the ANI channel variable
) Looks up the NPA to see if it should be blocked, return if true
) Looks up the NPA-NXX to see if it should be blocked, return if true
) Looks up the NPA-NXX-XXXX to see if it should be blocked, return if true
) Set the BLOCK channel variable to NO
) Return to the dialplan
--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards [email protected] Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000
--
_____________________________________________________________________
-- 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