[Freeswitch-users] Channel variables for npdi and rn on LRN dipped calls.
Victor Chukalovskiy
victor.chukalovskiy at gmail.com
Thu Jan 10 19:03:10 MSK 2013
Michael and Ken,
Thanks for setting me on the right track! What I end-up configuring for
now is:
^(?:1)?([2-9]\d{2}[2-9]\d{6})(?:;npdi=(?:yes|no))?(?:;rn=([2-9]\d{2}[2-9]\d{6}))?(?:;npdi=(?:yes|no))?
It puts destination number in $1. It also puts LRN in $2 provided it's
supplied. Either yes or no are allowed for npdi=. I'm not capturing
npdi= into any variable because as I realized all I really need is LRN.
For example, all of these:
6045555555;npdi=yes;rn=7785550001
6045555555;rn=7785550001;npdi=yes
16045555555;npdi=yes;rn=7785550001
6045555555;rn=7785550001
Will pass and result in:
$1=6045555555
$2=7785550001
And all of these:
6045555555
16045555555
6045555555;npdi=yes
6045555555;npdi=no
Will also pass and give:
$1=6045555555
$2=empty
I'll be glad if this regexp example helps someone.
Cheers,
-Victor
On 13-01-07 08:59 PM, Michael Collins wrote:
> In this case the ? modifies the *, so there's .* (greedy) and .*? (not
> greedy)
>
> You want your .* to match as little as possible instead of as much as
> possible. If you use .* instead of .*? then your $2 would contain both
> the ndpi info but also it would have ";rn=18005551212" b/c the .*
> would grab all that stuff. The .*? would only grab up to the ";rn".
>
> Just adding that info for posterity's sake. :)
>
> -MC
>
> On Mon, Jan 7, 2013 at 5:05 PM, Ken Rice <krice at freeswitch.org
> <mailto:krice at freeswitch.org>> wrote:
>
> Ooops yeah I mean .*... The ? Is pretty useless there... Since
> there should always be something if they send ndpi=
>
>
> On 1/7/13 7:00 PM, "Michael Collins" <msc at freeswitch.org
> <http://msc@freeswitch.org>> wrote:
>
>
> Just a quick FYI... be careful when you use .* because it will
> try to match EVERYTHING. Also, Ken accidentally typed (*.)
> which I'm sure wasn't what he was aiming for. ;)
>
> Maybe this would be more effective:
> ^(?:+1|1)?([2-9]\d{2}[2-9]\d{6});ndpi=(.*?);rn=([2-9]\d{2}[2-9]\d{6})$
>
> -MC
>
> ------------------------------------------------------------------------
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org <http://consulting@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
> <http://FreeSWITCH-users@lists.freeswitch.org>
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
> --
> Ken
> _http://www.FreeSWITCH.org
> http://www.ClueCon.com
> http://www.OSTAG.org
> _irc.freenode.net <http://irc.freenode.net> #freeswitch
>
> _________________________________________________________________________
> 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
>
>
>
>
> --
> Michael S Collins
> Twitter: @mercutioviz
> http://www.FreeSWITCH.org
> http://www.ClueCon.com
> http://www.OSTAG.org
>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> 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
> 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/20130110/8a7761bf/attachment.html
Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users
mailing list