[asterisk-users] Dial cmd help

Joseph L. Casale JCasale at activenetwerx.com
Sun Jul 5 23:40:44 CDT 2009


>Is there some way to simply add some logic above it such that
>if the EXTEN coming in starts with a "1", remove it so I don't
>have to hack this extensions.conf all to heck?

Ok, a bit more searching and maybe I have it (I'm remote and cant
test this, so before I call in tomorrow I'd like to get it as close
as possible to keep the disruption to a minimum)?

exten => s,n,GotoIf($["${ARG1}" = "[^1][0-9]{9}"]?Dial1:Dial2)
exten => s,n(Dial1),Dial(SIP/1${ARG1}@sip_peer,60,T)
exten => s,n,Goto(Resume)
exten => s,n(Dial2),Dial(SIP/{ARG1}@sip_peer,60,T)
exten => s,n(Resume),<the rest of my original dial plan>

If I understand this right, the number being dialed, ARG1, will be
matched against the regex which loosely looks for a 10 digit number
not beginning with a "1". If it does, it dials the peer as expected
(by adding a one) and if it does have a one, it dials the peer as is.

My pattern match going into this sequence only catches 10 or 11 digit
numbers and I handle intl differently so I think the regex will work
so long as asterisk supports this?

Thanks for any pointers!
jlc



More information about the asterisk-users mailing list