[asterisk-users] How to manipulate a plus in a phone number

Tim Panton tim at mexuar.com
Tue Sep 5 03:21:43 MST 2006


I'm hoping someone has solved this problem before, because I'm stuck!

I get phone numbers from a database into my dial plan via AGI.
Some of the numbers use the + sign to denote an 'international'
number.
I need to re-write these numbers into a format my IAX provider
can deal with (ie a us style international number starting with 011).

So +3115162728 -> 00113115162728

Unfortunately all the ways I've tried to manipulate the number
in the dialplan fail because the + is an operator and I can't get
the parser to treat it as a 'normal' string.
Here are some things I have tried to use to detect the +

exten => 1,n,set(INNAT=${ATELNO:\+})

and

exten => 1,n,set(INNAT=${REGEX("^\+","${ATELNO}")})

and

exten => 1,n,set(INNAT=${FIELDQTY(+,${ATELNO})})

None of them work.....

I know I could get the database to do the rewriting, but then
I've got database code that is IAX provider dependent, which I'd like  
to avoid.

Anyone got any neat tricks??


Tim Panton

www.mexuar.com






More information about the asterisk-users mailing list