Channel variables for npdi and rn on LRN dipped calls.
Hello and Happy New year! A SIP call comes in that was previously dipped. I'd like to be able to have "rn" and "npdi" available as channel variables that I can use in regex expressions. Is there a way to configure FreeSWITCH to put "rn" and "npdi" into separate channel variable? So far, info application shows me the following channel variables that contain LRN: Caller-Destination-Number: [5551234567;npdi=yes;rn=5555550001] variable_sip_req_user: [5551234567;npdi=yes;rn=5555550001] variable_sip_req_uri: [5551234567;npdi=yes;rn=5555550001@1.2.3.4:5060] I can probably dissect those and put "rn" and "npdi" into separate variables. But this means extra steps in dial-plan. In case there is a built-in way to accomplish the same task, it would be great! Could you please let me know. Thank you, Victor
What the.. I thought "Caller-Destination-Number" was always the cleaned dialed number (i.e. 5551234567) - is this not the case? Cal On Fri, Jan 4, 2013 at 5:38 PM, Victor Chukalovskiy < victor.chukalovskiy@gmail.com> wrote:
Hello and Happy New year!
A SIP call comes in that was previously dipped. I'd like to be able to have "rn" and "npdi" available as channel variables that I can use in regex expressions. Is there a way to configure FreeSWITCH to put "rn" and "npdi" into separate channel variable?
So far, info application shows me the following channel variables that contain LRN:
Caller-Destination-Number: [5551234567;npdi=yes;rn=5555550001] variable_sip_req_user: [5551234567;npdi=yes;rn=5555550001] variable_sip_req_uri: [5551234567;npdi=yes;rn=5555550001@1.2.3.4:5060]
I can probably dissect those and put "rn" and "npdi" into separate variables. But this means extra steps in dial-plan. In case there is a built-in way to accomplish the same task, it would be great!
Could you please let me know.
Thank you, Victor
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list 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
You have to parse out the NDPI and RN values... Just use a regex like ^(?:+1|1)?([2-9]\d{2}[2-9]\d{6});ndpi=(*.);rn=([2-9]\d{2}[2-9]\d{6})$ That will get dialed digits in $1, ndpi value in $2, then LRN in $3, I would warn against trusting the LRN you are sent if you do not explicitly trust the customer sending you said LRN... Its not like its hard to spoof the LRN replacnig the LRN from a high cost ratecenter with a low cost ratecenter K On 1/6/13 8:12 AM, "Cal Leeming [Simplicity Media Ltd]" <cal.leeming@simplicitymedialtd.co.uk> wrote:
What the..
I thought "Caller-Destination-Number" was always the cleaned dialed number (i.e. 5551234567) - is this not the case?
Cal
On Fri, Jan 4, 2013 at 5:38 PM, Victor Chukalovskiy <victor.chukalovskiy@gmail.com> wrote:
Hello and Happy New year!
A SIP call comes in that was previously dipped. I'd like to be able to have "rn" and "npdi" available as channel variables that I can use in regex expressions. Is there a way to configure FreeSWITCH to put "rn" and "npdi" into separate channel variable?
So far, info application shows me the following channel variables that contain LRN:
Caller-Destination-Number: [5551234567;npdi=yes;rn=5555550001] variable_sip_req_user: [5551234567;npdi=yes;rn=5555550001] variable_sip_req_uri: [5551234567;npdi=yes;rn=5555550001@1.2.3.4:5060 <http://5555550001@1.2.3.4:5060> ]
I can probably dissect those and put "rn" and "npdi" into separate variables. But this means extra steps in dial-plan. In case there is a built-in way to accomplish the same task, it would be great!
Could you please let me know.
Thank you, Victor
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list 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
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list 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 #freeswitch
Ken, Thank you very much for feedback. I'll then follow your regex example to parse it. -Victor On 13-01-06 12:19 PM, Ken Rice wrote:
Re: [Freeswitch-users] Channel variables for npdi and rn on LRN dipped calls. You have to parse out the NDPI and RN values...
Just use a regex like ^(?:+1|1)?([2-9]\d{2}[2-9]\d{6});ndpi=(*.);rn=([2-9]\d{2}[2-9]\d{6})$ That will get dialed digits in $1, ndpi value in $2, then LRN in $3,
I would warn against trusting the LRN you are sent if you do not explicitly trust the customer sending you said LRN... Its not like its hard to spoof the LRN replacnig the LRN from a high cost ratecenter with a low cost ratecenter
K
On 1/6/13 8:12 AM, "Cal Leeming [Simplicity Media Ltd]" <cal.leeming@simplicitymedialtd.co.uk> wrote:
What the..
I thought "Caller-Destination-Number" was always the cleaned dialed number (i.e. 5551234567) - is this not the case?
Cal
On Fri, Jan 4, 2013 at 5:38 PM, Victor Chukalovskiy <victor.chukalovskiy@gmail.com> wrote:
Hello and Happy New year!
A SIP call comes in that was previously dipped. I'd like to be able to have "rn" and "npdi" available as channel variables that I can use in regex expressions. Is there a way to configure FreeSWITCH to put "rn" and "npdi" into separate channel variable?
So far, info application shows me the following channel variables that contain LRN:
Caller-Destination-Number: [5551234567;npdi=yes;rn=5555550001] variable_sip_req_user: [5551234567;npdi=yes;rn=5555550001] variable_sip_req_uri: [5551234567;npdi=yes;rn=5555550001@1.2.3.4:5060 <http://5555550001@1.2.3.4:5060> ]
I can probably dissect those and put "rn" and "npdi" into separate variables. But this means extra steps in dial-plan. In case there is a built-in way to accomplish the same task, it would be great!
Could you please let me know.
Thank you, Victor
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list 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
------------------------------------------------------------------------ _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list 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 #freeswitch
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list 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
On Mon, Jan 7, 2013 at 12:45 PM, Victor Chukalovskiy < victor.chukalovskiy@gmail.com> wrote:
Ken,
Thank you very much for feedback. I'll then follow your regex example to parse it.
-Victor
On 13-01-06 12:19 PM, Ken Rice wrote:
You have to parse out the NDPI and RN values...
Just use a regex like ^(?:+1|1)?([2-9]\d{2}[2-9]\d{6});ndpi=(*.);rn=([2-9]\d{2}[2-9]\d{6})$ That will get dialed digits in $1, ndpi value in $2, then LRN in $3,
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
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@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@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list 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 #freeswitch
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@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@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@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list 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 #freeswitch
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list 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
-- Michael S Collins Twitter: @mercutioviz http://www.FreeSWITCH.org http://www.ClueCon.com http://www.OSTAG.org
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@freeswitch.org <mailto:krice@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@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@freeswitch.org <http://consulting@freeswitch.org> http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@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@freeswitch.org <mailto:consulting@freeswitch.org> http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org <mailto: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
-- Michael S Collins Twitter: @mercutioviz http://www.FreeSWITCH.org http://www.ClueCon.com http://www.OSTAG.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list 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
participants (4)
-
Cal Leeming [Simplicity Media Ltd]
-
Ken Rice
-
Michael Collins
-
Victor Chukalovskiy