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

Tim Nelson tnelson at rockbochs.com
Thu Jul 7 14:50:12 CDT 2011


----- Original Message -----
> >> 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.

Yes, I'm aware of that. By 'quick' I of course meant implementation effort, not overall system resource usage. :)

> 
> 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 agree. In fact, I've noticed many of your posts are Asterisk 1.2.x and AGI/C oriented which is very unique. Maybe lots of other people use AGI, but it doesn't get much 'press' on the lists I guess. When I have some of that mythical 'free time' I've been hearing so much about, it's on my list to learn more about AGI. I know a little C, but would likely start out using PHPAGI as it's more familiar to me. I know, not as efficient, but a stepping stone.

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

I'm currently running some database code in dialplan and its *NASTY*. If anything, DB access would be the incentive for me to dive into AGI.

--Tim



More information about the asterisk-users mailing list