Guido Hecken
2005-Mar-22 06:00 UTC
[Asterisk-Users] Regex howto proof and change a dialed number
before inventing the wheel once more, I would like to ask the list Problem: the dial command does it's job by exten => _X.,1,Dial(SIP/${EXTEN}@192.168.161.135,60,tTr) now, if the given number (extension) is one of these +49(2244)870663 or +49(02244)870663 the dial command fails, since it cannot handle "(" ")" and "+" My idea was a regex, I use normaly within perl perl -p -i -e 's/^\+(\d\d)\((\d*)\)(\d*)/00$2$3/g' number this would change +49(2244)870663 to 002244870663 in every line of the file, named number. But how can I achieve this in asterisk dialplan? I did some googling and reading in the wiki, but still no glue. Perhaps with the system command and some perl stuff as above? Any hints are *really* welcome. Regards, and have a nice day outhere Guido Hecken
Scott Nelson
2005-Mar-22 07:20 UTC
[Asterisk-Users] Regex howto proof and change a dialed number
Guido Hecken wrote:> ... > this would change +49(2244)870663 to 002244870663 in every line of the > file, > named number. > > But how can I achieve this in asterisk dialplan? > ...It sounds like an AGI perl script would work well.
Guido Hecken
2005-Mar-22 08:28 UTC
[Asterisk-Users] Regex howto proof and change a dialed number
> > this would change +49(2244)870663 to 002244870663 in every line of the > > file, > > named number. > > > > But how can I achieve this in asterisk dialplan? > > ... > > It sounds like an AGI perl script would work well.Thanks for the tip with AGI I'll have a closer look at it. Neveretheless I put an easy number-manipulation tool on my asterisk wishlist. Wouldn't it be nice if something like this could do the job: exten => \+(XX)\((X.)\)(X.),1,Dial/SIP/00$1$2$3@gateway,60,tTr) Regards Guido Hecken