[Freeswitch-users] Matching destination number
Sean Devoy
sdevoy at bizfocused.com
Wed Mar 12 03:16:24 MSK 2014
Whoa!!! Thanks Avi - the light came on.
The first ^0 means "starts with a ZERO", but the second ^0 means "anything BUT a zero"!!!! There are always multiple ways to "regex" something, I probably would have gone with ^0([1-9]\d+)$.
Learned something.
Thanks,
Sean
From: freeswitch-users-bounces at lists.freeswitch.org [mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Avi Marcus
Sent: Tuesday, March 11, 2014 6:18 PM
To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] Matching destination number
Only matcha 0 followed by a non zero.
That way only one of the ref ex matches.
-Avi
On Mar 11, 2014 11:21 PM, "Sean Devoy" <sdevoy at bizfocused.com<mailto:sdevoy at bizfocused.com>> wrote:
Hi,
Please explain what the [^0] does in that regex - ^0([^0]\d+)$
Sean
From: freeswitch-users-bounces at lists.freeswitch.org<mailto:freeswitch-users-bounces at lists.freeswitch.org> [mailto:freeswitch-users-bounces at lists.freeswitch.org<mailto:freeswitch-users-bounces at lists.freeswitch.org>] On Behalf Of mbo
Sent: Tuesday, March 11, 2014 4:12 PM
To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] Matching destination number
That works,
Thanks!
Markus
Am 11.03.2014 um 20:49 schrieb Avi Marcus <avi at avimarcus.net<mailto:avi at avimarcus.net>>:
Both are matching.
You might want this for your second match, so that there's only 1x leading zero:
^0([^0]\d+)$
-Avi
On Tue, Mar 11, 2014 at 8:49 PM, mbo <mbodbg at gmx.net<mailto:mbodbg at gmx.net>> wrote:
Hello,
I have the following dial plan:
<extension name="international destination_number" continue="true">
<condition field="destination_number" expression="^00(\d+)$">
<action application="log" data="CONSOLE *** international number ${destination_number} ***"/>
<action application="set_profile_var" data="destination_number=$1"/>
</condition>
</extension>
<extension name="national destination_number" continue="true">
<condition field="destination_number" expression="^0(\d+)$">
<action application="log" data="CONSOLE *** international number ${destination_number}"/>
<action application="set_profile_var" data="destination_number=49$1"/>
</condition>
</extension>
If I dial number 001234567, I get the following output in the console:
2014-03-11 19:43:42.945392 [CONSOLE] mod_dptools.c:1569 *** international number 001234567 ***
2014-03-11 19:43:42.945392 [CONSOLE] mod_dptools.c:1569 *** international number 1234567
The second extension is matching, however in the first extension the destination_number has been overridden and does not have any leading zeros. Why is it matching anyway?
Thanks
Markus
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org<mailto:consulting at freeswitch.org>
http://www.freeswitchsolutions.com<http://www.freeswitchsolutions.com/>
</>
Official FreeSWITCH Sites
http://www.freeswitch.org<http://www.freeswitch.org/>
http://wiki.freeswitch.org<http://wiki.freeswitch.org/>
http://www.cluecon.com<http://www.cluecon.com/>
FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org<mailto:FreeSWITCH-users at lists.freeswitch.org>
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org<http://www.freeswitch.org/>
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org<mailto:consulting at freeswitch.org>
http://www.freeswitchsolutions.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org<mailto:FreeSWITCH-users at lists.freeswitch.org>
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org<mailto:consulting at freeswitch.org>
http://www.freeswitchsolutions.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org<mailto:FreeSWITCH-users at lists.freeswitch.org>
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20140312/5eb58a45/attachment-0001.html
Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-users
mailing list