[Freeswitch-users] Some little help with regexp and extensions
Diego Viola
diego.viola at gmail.com
Wed Jul 30 17:41:26 PDT 2008
mercutioviz in #freeswitch already solved it for me, a big thanks for you =D
The trick was to use ^9(\d{10})$. I need to get off and learn a bit of
regexp ;-)
Here is the log in case if someone wants to read it, maybe it will help some:
19:39 < mercutioviz> diegoviola: i've had a fair amount of success
with regexps in the dialplan
19:40 < mercutioviz> what are you hoping to accomplish?
19:40 < mercutioviz> gimme the plain english and i'll help u with a regexp
19:41 < diegoviola> mercutioviz: well i had a 9(\d+)$ for dialing out
through my gateway and at the same time i have the default extensions
for echo (9996) etc... and my dial out regexp extension also matches
9996
19:41 < mercutioviz> yep, classic problem
19:42 < mercutioviz> how many digits will the caller dial after
dialing 9? like 9 12345678
19:42 < diegoviola> normally is 9-1-number
19:42 < mercutioviz> no prob
19:42 < diegoviola> that's what i was using
19:43 < diegoviola> wait
19:43 < diegoviola> ^(\d+)$ works fine for me
19:43 < diegoviola> no need for the 9 first i think
19:43 < mercutioviz> try this: ^9(\d{10,})$
19:43 < mercutioviz> it depends on how fancy you want to get
19:44 < mercutioviz> example: 9+phone number goes out one provider,
8+phone number goes out another provider
19:44 < mercutioviz> etc.
19:44 < mercutioviz> the above regexp says "Match if I see 9 plus at
least ten consecutive digits"
19:44 < diegoviola> with ^(\d+)$ i can't dial 3030, etc
19:44 < mercutioviz> that way 9996 won't match
19:45 < mercutioviz> the problem with ^(\d+)$ is that it will match
*any* consecutive string of digits
19:45 < diegoviola> interesting
Thanks, FS rocks =D
Diego
Jul 30, 2008 at 5:29 PM, Diego Viola <diego.viola at gmail.com> wrote:
> Hi everyone,
>
> I have this in my default dialplan for dialing out:
>
> <extension name="outbound">
> <condition field="destination_number" expression="^9(\d+)$">
> <action application="bridge" data="sofia/gateway/teliax/$1"/>
> </condition>
> </extension>
>
> It works fairly well... but when I try to dial other extensions that
> start with "9", like 9996 (echo extension) I get this:
> http://pastebin.freeswitch.org/5026 and in my softphone I get "service
> or option unavailable".
>
> If I remove the "outbound" extension works.
>
> I know it might be something simple... but I'm not very familiar with
> regular expressions yet, so if you can help me with this I will be
> really thankful.
>
> Thanks everyone... FreeSWITCH rocks =D
>
> Diego
>
More information about the FreeSWITCH-users
mailing list