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

Steve Edwards asterisk.org at sedwards.com
Thu Jul 7 14:37:50 CDT 2011


>> 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'?

On Thu, 7 Jul 2011, Steve Edwards wrote:

>> I would do this in an AGI written in C -- but that's just me...

On Thu, 7 Jul 2011, Tim Nelson wrote:

> Let's assume, "hypothetically", I'm looking for a simpler solution 
> directly in the dialplan or via a quick run of System(). :-)

There is no such thing as 'a quick run of System()', relatively speaking.

Even a simple system, echo, pipe, sed creates multiple processes. Process 
creation is among the most expensive operations (in terms of host 
resources) you can do.

A single AGI is much more efficient. A few statements in dialplan are even 
more efficient in terms of host resources but can quickly spiral out of 
control as complexity rises.

I really like the 'black box' aspect of AGIs, especially when database 
access is added.

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000



More information about the asterisk-users mailing list