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

Tim Nelson tnelson at rockbochs.com
Thu Jul 7 13:25:18 CDT 2011


----- Original Message -----
> On Thu, Jul 07, 2011 at 12:55:37PM -0500, Tim Nelson wrote:
> > ----- 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'?
> > >
> > > I would do this in an AGI written in C -- but that's just me...
> > >
> > > <SNIP>
> >
> > Let's assume, "hypothetically", I'm looking for a simpler solution
> > directly in the dialplan or via a quick run of System(). :-)
> 
> I'm pretty sure that 1.2 has the FILTER dialplan function, so
> 
> exten => Set(CALLERID(num)=${FILTER(0123456789|${CALLERID(num)})})
> 
> should work.
> 

This works perfectly, with the minor change of using ',' as the delimiter instead of '|' with FILTER:

exten => _X.,n,Set(PROPERCID=${FILTER(1234567890,${CALLERID(num)})})

Thanks everyone for the help!

--Tim



More information about the asterisk-users mailing list