Re: [Freeswitch-users] Matching context based on sip_req_host
The following line: <condition field="sip_req_host" expression="^10\.0\.0\.1$"> Should be <condition field="sip_req_host" expression="^62\.180\.237\.73$"> Wrong sample. From: Grant Bagdasarian Sent: Wednesday, August 21, 2013 1:50 PM To: FreeSWITCH Users Help (freeswitch-users@lists.freeswitch.org) Subject: Matching context based on sip_req_host Hello, I want to match a context based on the value of sip_req_host, but the context isn't matched. <extension name="internal_to_external"> <condition field="sip_req_host" expression="^10\.0\.0\.1$"> <action application="set" data="hangup_after_bridge=false"/> <action application="set" data="continue_on_fail=true"/> <action application="bridge" data="sofia/external/${sip_req_uri}"/> </condition> </extension> Debug output: Dialplan: sofia/internal/31765727000@192.168.18.6<mailto:sofia/internal/31765727000@192.168.18.6> Regex (FAIL) [internal_to_external] sip_req_host() =~ /^62\.180\.237\.73$/ break=on-false I checked with an online regex validator and it seems that the first and last '/' character is causing it to not match. I'm not a regex expert, so I would appreciate it if someone could help me out with this. Thanks!
That should probably be: <condition field="${sip_req_host}" expression="^62\.180\.237\.73$"> /Peter 2013/8/21 Grant Bagdasarian <GB@cm.nl>
The following line: <condition field="sip_req_host" expression="^10\.0\.0\.1$">****
Should be <condition field="sip_req_host" expression="^62\.180\.237\.73$"> ****
** **
Wrong sample.****
** **
*From:* Grant Bagdasarian *Sent:* Wednesday, August 21, 2013 1:50 PM *To:* FreeSWITCH Users Help (freeswitch-users@lists.freeswitch.org) *Subject:* Matching context based on sip_req_host****
** **
Hello,****
** **
I want to match a context based on the value of sip_req_host, but the context isn’t matched.****
** **
<extension name="internal_to_external">****
<condition field="sip_req_host" expression="^10\.0\.0\.1$">****
<action application="set" data="hangup_after_bridge=false"/>****
<action application="set" data="continue_on_fail=true"/>****
<action application="bridge" data="sofia/external/${sip_req_uri}"/> ****
</condition>****
</extension>****
** **
Debug output:****
Dialplan: sofia/internal/31765727000@192.168.18.6 Regex (FAIL) [internal_to_external] sip_req_host() =~ /^62\.180\.237\.73$/ break=on-false ****
** **
I checked with an online regex validator and it seems that the first and last ‘/’ character is causing it to not match. I’m not a regex expert, so I would appreciate it if someone could help me out with this.****
** **
Thanks!****
_________________________________________________________________________ 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
If you are trying to match on the IP of the client, you probably really want network_addr which reports from the ip stack which ip the invite came from, using any other IP unless it is coming from a 100% trusted source leaves you vulnerable to people spoofing the IPs inside the sip packets. Also, the context on unauthenticated users goes with what is defined on the sip profile, so you may need a sorting context On 8/21/13 7:25 AM, "Peter Olsson" <peter@olssononline.se> wrote:
That should probably be: <condition field="${sip_req_host}" expression="^62\.180\.237\.73$">
/Peter
2013/8/21 Grant Bagdasarian <GB@cm.nl>
The following line: <condition field="sip_req_host" expression="^10\.0\.0\.1$"> Should be <condition field="sip_req_host" expression="^62\.180\.237\.73$"> Wrong sample.
From: Grant Bagdasarian Sent: Wednesday, August 21, 2013 1:50 PM To: FreeSWITCH Users Help (freeswitch-users@lists.freeswitch.org) Subject: Matching context based on sip_req_host Hello, I want to match a context based on the value of sip_req_host, but the context isn¹t matched. <extension name="internal_to_external"> <condition field="sip_req_host" expression="^10\.0\.0\.1$"> <action application="set" data="hangup_after_bridge=false"/> <action application="set" data="continue_on_fail=true"/> <action application="bridge" data="sofia/external/${sip_req_uri}"/> </condition> </extension> Debug output: Dialplan: sofia/internal/31765727000@192.168.18.6 Regex (FAIL) [internal_to_external] sip_req_host() =~ /^62\.180\.237\.73$/ break=on-false I checked with an online regex validator and it seems that the first and last /¹ character is causing it to not match. I¹m not a regex expert, so I would appreciate it if someone could help me out with this. Thanks!
_________________________________________________________________________ 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
Right, I forgot the ${...}. That did the trick. Thanks Peter! I'll keep that in mind Ken. I'm not matching the IP of the client. The R-URI is set by our SIP Proxy, and this FS instance functions as our SBC which is connected to multiple carriers. From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Ken Rice Sent: Wednesday, August 21, 2013 2:40 PM To: FreeSWITCH Users Help Subject: Re: [Freeswitch-users] Matching context based on sip_req_host If you are trying to match on the IP of the client, you probably really want network_addr which reports from the ip stack which ip the invite came from, using any other IP unless it is coming from a 100% trusted source leaves you vulnerable to people spoofing the IPs inside the sip packets. Also, the context on unauthenticated users goes with what is defined on the sip profile, so you may need a sorting context On 8/21/13 7:25 AM, "Peter Olsson" <peter@olssononline.se> wrote: That should probably be: <condition field="${sip_req_host}" expression="^62\.180\.237\.73$"> /Peter 2013/8/21 Grant Bagdasarian <GB@cm.nl> The following line: <condition field="sip_req_host" expression="^10\.0\.0\.1$"> Should be <condition field="sip_req_host" expression="^62\.180\.237\.73$"> Wrong sample. From: Grant Bagdasarian Sent: Wednesday, August 21, 2013 1:50 PM To: FreeSWITCH Users Help (freeswitch-users@lists.freeswitch.org) Subject: Matching context based on sip_req_host Hello, I want to match a context based on the value of sip_req_host, but the context isn't matched. <extension name="internal_to_external"> <condition field="sip_req_host" expression="^10\.0\.0\.1$"> <action application="set" data="hangup_after_bridge=false"/> <action application="set" data="continue_on_fail=true"/> <action application="bridge" data="sofia/external/${sip_req_uri}"/> </condition> </extension> Debug output: Dialplan: sofia/internal/31765727000@192.168.18.6 Regex (FAIL) [internal_to_external] sip_req_host() =~ /^62\.180\.237\.73$/ break=on-false I checked with an online regex validator and it seems that the first and last '/' character is causing it to not match. I'm not a regex expert, so I would appreciate it if someone could help me out with this. Thanks! _________________________________________________________________________ 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
Try with ${sip_reg_host} in field. François. On Wed, 2013-08-21 at 14:01 +0200, Grant Bagdasarian wrote:
The following line: <condition field="sip_req_host" expression="^10\.0 \.0\.1$">
Should be <condition field="sip_req_host" expression="^62\.180\.237 \.73$">
Wrong sample.
From: Grant Bagdasarian Sent: Wednesday, August 21, 2013 1:50 PM To: FreeSWITCH Users Help (freeswitch-users@lists.freeswitch.org) Subject: Matching context based on sip_req_host
Hello,
I want to match a context based on the value of sip_req_host, but the context isn’t matched.
<extension name="internal_to_external">
<condition field="sip_req_host" expression="^10\.0\.0\.1$">
<action application="set" data="hangup_after_bridge=false"/>
<action application="set" data="continue_on_fail=true"/>
<action application="bridge" data="sofia/external/${sip_req_uri}"/>
</condition>
</extension>
Debug output:
Dialplan: sofia/internal/31765727000@192.168.18.6 Regex (FAIL) [internal_to_external] sip_req_host() =~ /^62\.180\.237\.73$/ break=on-false
I checked with an online regex validator and it seems that the first and last ‘/’ character is causing it to not match. I’m not a regex expert, so I would appreciate it if someone could help me out with this.
Thanks!
_________________________________________________________________________ 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)
-
François
-
Grant Bagdasarian
-
Ken Rice
-
Peter Olsson