FS uses external IP address for Contact in 200 to internal server
Comrades! I'm using FreeSWITCH (FS) as a proxy between an internal server that makes calls and an external SIP provider. The internal server is a speech recognition server that has a telephony component to originate and terminate calls. Here's the sequence of messages between the internal server (IS) and FS: Starting the call, we see: IS (internal IP) == INVITE ==> FS (internal IP) IS (internal IP) <== 100 == FS (internal IP) IS (internal IP) <== 183 == FS (internal IP) FS gets a connection to SIP provider, and the internal call continues: IS (internal IP) <== 200 OK == FS (internal IP) But the 200 OK from FS contains, in the Contact field, the *external* IP address: Contact: <sip:xxxxx@(external IP):5060;transport=udp> As a result, the IS sends a response to the *external* IP address: IS (external IP) == ACK ==> FS (external IP) FS resends several 200's, which IS properly ignores. Eventually FS gives up on hearing from IS and sends a BYE with a Reason of 408 ACK Timeout. I'm not clear which server is to "blame," if either. FS has "inbound-proxy-media" set to true in (my-dialplan).xml, and I would therefore expect that the Contact field would treat internal servers as internal and use internal IP addresses exclusively. Or is FS correct? Is the problem that IS attempting to do NAT based on the Contact and making an error? (I tried disabling IS's NAT, and almost certainly did it correctly, but that does not seem to help.) Variables set in (my_dialplan).xml: <param name="inbound-proxy-media" value="true"/> <param name="local-network-acl" value="localnet.auto"/> <param name="ext-rtp-ip" value="$${external_rtp_ip}"/> <param name="ext-sip-ip" value="$${external_sip_ip}"/> And the next two were added on in an attempt to fix this, but failed to do so: <param name="aggressive-nat-detection" value="true"/> <param name="NDLB-force-rport" value="true"/> So, any ideas? -- Moshe Yudkowsky Disaggregate Corporation 2952 W Fargo Chicago, IL 60645 USA +1 773 764 8727 speech@pobox.com http://www.Disaggregate.com http://www.PebbleAndAvalanche.com
Hi,
<param name="inbound-proxy-media" value="true"/> <param name="local-network-acl" value="localnet.auto"/> <param name="ext-rtp-ip" value="$${external_rtp_ip}"/> <param name="ext-sip-ip" value="$${external_sip_ip}"/>
These are not channel variables but profile params. So they have to be set on the profile configuration file under sip_profiles. And for your case, if all your traffic is internal on this profile, remove the last 2 params (ext-sip-ip and est-rtp-ip) as freeswitch use them to set the public ip on the contact and SDP if your server is nated. Best Regards, -- Vallimamod Abdullah SIP Solutions vma@sip.solutions <mailto:vma@sip.solutions> linkedin.com/in/vallimamod <http://linkedin.com/in/vallimamod> .
On 24 May 2018, at 22:43, M Yudkowsky <speech@pobox.com <mailto:speech@pobox.com>> wrote:
Comrades!
I'm using FreeSWITCH (FS) as a proxy between an internal server that makes calls and an external SIP provider. The internal server is a speech recognition server that has a telephony component to originate and terminate calls.
Here's the sequence of messages between the internal server (IS) and FS:
Starting the call, we see:
IS (internal IP) == INVITE ==> FS (internal IP) IS (internal IP) <== 100 == FS (internal IP) IS (internal IP) <== 183 == FS (internal IP)
FS gets a connection to SIP provider, and the internal call continues:
IS (internal IP) <== 200 OK == FS (internal IP)
But the 200 OK from FS contains, in the Contact field, the *external* IP address: Contact: <sip:xxxxx@ <sip:xxxxx@>(external IP):5060;transport=udp> As a result, the IS sends a response to the *external* IP address:
IS (external IP) == ACK ==> FS (external IP)
FS resends several 200's, which IS properly ignores. Eventually FS gives up on hearing from IS and sends a BYE with a Reason of 408 ACK Timeout.
I'm not clear which server is to "blame," if either. FS has "inbound-proxy-media" set to true in (my-dialplan).xml, and I would therefore expect that the Contact field would treat internal servers as internal and use internal IP addresses exclusively. Or is FS correct? Is the problem that IS attempting to do NAT based on the Contact and making an error? (I tried disabling IS's NAT, and almost certainly did it correctly, but that does not seem to help.)
Variables set in (my_dialplan).xml:
<param name="inbound-proxy-media" value="true"/> <param name="local-network-acl" value="localnet.auto"/> <param name="ext-rtp-ip" value="$${external_rtp_ip}"/> <param name="ext-sip-ip" value="$${external_sip_ip}"/>
And the next two were added on in an attempt to fix this, but failed to do so:
<param name="aggressive-nat-detection" value="true"/> <param name="NDLB-force-rport" value="true"/>
So, any ideas?
-- Moshe Yudkowsky Disaggregate Corporation 2952 W Fargo Chicago, IL 60645 USA
+1 773 764 8727 speech@pobox.com <mailto:speech@pobox.com>
http://www.Disaggregate.com <http://www.disaggregate.com/> http://www.PebbleAndAvalanche.com <http://www.pebbleandavalanche.com/>
Hi, Thanks for your response, quite helpful.
On May 25, 2018, at 03:56 , Vallimamod Abdullah <vma@vallimamod.org> wrote:
<param name="inbound-proxy-media" value="true"/> <param name="local-network-acl" value="localnet.auto"/> <param name="ext-rtp-ip" value="$${external_rtp_ip}"/> <param name="ext-sip-ip" value="$${external_sip_ip}"/>
These are not channel variables but profile params. So they have to be set on the profile configuration file under sip_profiles.
I expect I was not clear: the params are set in sip_profiles/(profile name).xml, where "profile name" is a valid profile name.
And for your case, if all your traffic is internal on this profile, remove the last 2 params (ext-sip-ip and est-rtp-ip) as freeswitch use them to set the public ip on the contact and SDP if your server is nated.
Going back to my original diagram, let me add the external leg explicitly: IS (internal IP) == INVITE ==> FS (internal IP) IS (internal IP) <== 100 == FS (internal IP) IS (internal IP) <== 183 == FS (internal IP) FS starts a call to the external provider: FS (external IP) == INVITE ==> SIP PROVIDER FS (external IP) <== 200 OK == SIP PROVIDER FS (external IP) == ACK ==> SIP PROVIDER FS continues the internal call: IS (internal IP) <== 200 OK == FS (internal IP) But the 200 OK from FS contains, in the Contact field, the *external* IP address: Contact: <sip:xxxxx@(external IP):5060;transport=udp> As a result, the IS sends a response to the *external* IP address: IS (external IP) == ACK ==> FS (external IP) FS resends several 200's, which IS properly ignores. Eventually FS gives up on hearing from IS and sends a BYE with a Reason of 408 ACK Timeout. Just to check, then: is the ext-rtp-ip and ext-sip-ip somehow too aggressive, and I should rely on NAT and localnet.auto and other automatic discovery mechanisms instead? Or is this configuration correct, and I have a different problem? -- Moshe Yudkowsky Disaggregate Corporation 2952 W Fargo Chicago, IL 60645 USA +1 773 764 8727 speech@pobox.com http://www.Disaggregate.com http://www.PebbleAndAvalanche.com
Hi, The ext-xxx-ip is only needed if your external IP is private and nated to a public one defined on your router. This setting tells freeswitch to put directly the public IP in the contact and the SDP. If it's not already the case, you should use a different internal profile (attached to your internal IP) to discuss with your IS. In this profile, you don't need to define any NAT setting. Best Regards, -- Vallimamod Abdullah SIP Solutions vma@sip.solutions <mailto:vma@sip.solutions> linkedin.com/in/vallimamod <http://linkedin.com/in/vallimamod> .
On 25 May 2018, at 14:46, M Yudkowsky <speech@pobox.com> wrote:
Hi,
Thanks for your response, quite helpful.
On May 25, 2018, at 03:56 , Vallimamod Abdullah <vma@vallimamod.org> wrote:
<param name="inbound-proxy-media" value="true"/> <param name="local-network-acl" value="localnet.auto"/> <param name="ext-rtp-ip" value="$${external_rtp_ip}"/> <param name="ext-sip-ip" value="$${external_sip_ip}"/>
These are not channel variables but profile params. So they have to be set on the profile configuration file under sip_profiles.
I expect I was not clear: the params are set in sip_profiles/(profile name).xml, where "profile name" is a valid profile name.
And for your case, if all your traffic is internal on this profile, remove the last 2 params (ext-sip-ip and est-rtp-ip) as freeswitch use them to set the public ip on the contact and SDP if your server is nated.
Going back to my original diagram, let me add the external leg explicitly:
IS (internal IP) == INVITE ==> FS (internal IP) IS (internal IP) <== 100 == FS (internal IP) IS (internal IP) <== 183 == FS (internal IP)
FS starts a call to the external provider:
FS (external IP) == INVITE ==> SIP PROVIDER FS (external IP) <== 200 OK == SIP PROVIDER FS (external IP) == ACK ==> SIP PROVIDER
FS continues the internal call:
IS (internal IP) <== 200 OK == FS (internal IP)
But the 200 OK from FS contains, in the Contact field, the *external* IP address: Contact: <sip:xxxxx@(external IP):5060;transport=udp> As a result, the IS sends a response to the *external* IP address:
IS (external IP) == ACK ==> FS (external IP)
FS resends several 200's, which IS properly ignores. Eventually FS gives up on hearing from IS and sends a BYE with a Reason of 408 ACK Timeout.
Just to check, then: is the and ext-sip-ip somehow too aggressive, and I should rely on NAT and localnet.auto and other automatic discovery mechanisms instead? Or is this configuration correct, and I have a different problem?
-- Moshe Yudkowsky Disaggregate Corporation 2952 W Fargo Chicago, IL 60645 USA
+1 773 764 8727 speech@pobox.com
http://www.Disaggregate.com http://www.PebbleAndAvalanche.com
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.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
<param name="ext-rtp-ip" value="$${external_rtp_ip}"/> <param name="ext-sip-ip" value="$${external_sip_ip}"/>
Change to: <param name="ext-rtp-ip" value="autonat:$${external_rtp_ip}"/> <param name="ext-sip-ip" value="autonat:$${external_sip_ip}"/> /b On Fri, May 25, 2018 at 8:15 AM, Vallimamod Abdullah <vma@vallimamod.org> wrote:
Hi,
The ext-xxx-ip is only needed if your external IP is private and nated to a public one defined on your router. This setting tells freeswitch to put directly the public IP in the contact and the SDP.
If it's not already the case, you should use a different internal profile (attached to your internal IP) to discuss with your IS. In this profile, you don't need to define any NAT setting.
Best Regards, -- Vallimamod Abdullah SIP Solutions vma@sip.solutions linkedin.com/in/vallimamod .
On 25 May 2018, at 14:46, M Yudkowsky <speech@pobox.com> wrote:
Hi,
Thanks for your response, quite helpful.
On May 25, 2018, at 03:56 , Vallimamod Abdullah <vma@vallimamod.org> wrote:
<param name="inbound-proxy-media" value="true"/> <param name="local-network-acl" value="localnet.auto"/> <param name="ext-rtp-ip" value="$${external_rtp_ip}"/> <param name="ext-sip-ip" value="$${external_sip_ip}"/>
These are not channel variables but profile params. So they have to be set on the profile configuration file under sip_profiles.
I expect I was not clear: the params are set in sip_profiles/(profile name).xml, where "profile name" is a valid profile name.
And for your case, if all your traffic is internal on this profile, remove the last 2 params (ext-sip-ip and est-rtp-ip) as freeswitch use them to set the public ip on the contact and SDP if your server is nated.
Going back to my original diagram, let me add the external leg explicitly:
IS (internal IP) == INVITE ==> FS (internal IP) IS (internal IP) <== 100 == FS (internal IP) IS (internal IP) <== 183 == FS (internal IP)
FS starts a call to the external provider:
FS (external IP) == INVITE ==> SIP PROVIDER FS (external IP) <== 200 OK == SIP PROVIDER FS (external IP) == ACK ==> SIP PROVIDER
FS continues the internal call:
IS (internal IP) <== 200 OK == FS (internal IP)
But the 200 OK from FS contains, in the Contact field, the *external* IP address: Contact: <sip:xxxxx@(external IP):5060;transport=udp> As a result, the IS sends a response to the *external* IP address:
IS (external IP) == ACK ==> FS (external IP)
FS resends several 200's, which IS properly ignores. Eventually FS gives up on hearing from IS and sends a BYE with a Reason of 408 ACK Timeout.
Just to check, then: is the and ext-sip-ip somehow too aggressive, and I should rely on NAT and localnet.auto and other automatic discovery mechanisms instead? Or is this configuration correct, and I have a different problem?
-- Moshe Yudkowsky Disaggregate Corporation 2952 W Fargo Chicago, IL 60645 USA
+1 773 764 8727 speech@pobox.com
http://www.Disaggregate.com http://www.PebbleAndAvalanche.com
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.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
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.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
-- Brian West | Co-founder and Developer Need Commercial support? email sales@freeswitch.com FreeSWITCH Solutions | 17345 Civic Drive #2531 Brookfield, WI 53045 <https://maps.google.com/?q=17345+Civic+Drive+%232531+Brookfield,+WI+53045&entry=gmail&source=g> Email: brian@freeswitch.com Mobile: 918-424-9378 Website: https://www.FreeSWITCH.com <https://www.freeswitch.com/> [image: https://www.facebook.com/signalwireinc?src=email] <https://www.facebook.com/freeswitch> [image: https://twitter.com/freeswitch] <https://twitter.com/freeswitch>
On May 25, 2018, at 08:48 , Brian West <brian@freeswitch.com> wrote:
<param name="ext-rtp-ip" value="autonat:$${external_rtp_ip}"/> <param name="ext-sip-ip" value="autonat:$${external_sip_ip}"/>\
This solution works perfectly with my current setup, thanks! I'd tried autonat in the past, but not after I made some other, recent improvements. I'll explore internal vs external profiles later, in my Copious Free Time, because it's likely a great idea. -- Moshe Yudkowsky Disaggregate Corporation 2952 W Fargo Chicago, IL 60645 USA +1 773 764 8727 speech@pobox.com http://www.Disaggregate.com http://www.PebbleAndAvalanche.com
Without autonat: local-network-acl will not come into play, this was to preserve backwards compatibility with previous behavior. /b On Fri, May 25, 2018 at 10:35 AM, M Yudkowsky <speech@pobox.com> wrote:
On May 25, 2018, at 08:48 , Brian West <brian@freeswitch.com> wrote:
<param name="ext-rtp-ip" value="autonat:$${external_rtp_ip}"/> <param name="ext-sip-ip" value="autonat:$${external_sip_ip}"/>\
This solution works perfectly with my current setup, thanks! I'd tried autonat in the past, but not after I made some other, recent improvements.
I'll explore internal vs external profiles later, in my Copious Free Time, because it's likely a great idea.
-- Moshe Yudkowsky Disaggregate Corporation 2952 W Fargo Chicago, IL 60645 USA
+1 773 764 8727 speech@pobox.com
http://www.Disaggregate.com http://www.PebbleAndAvalanche.com
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.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
-- Brian West | Co-founder and Developer Need Commercial support? email sales@freeswitch.com FreeSWITCH Solutions | 17345 Civic Drive #2531 Brookfield, WI 53045 <https://maps.google.com/?q=17345+Civic+Drive+%232531+Brookfield,+WI+53045&entry=gmail&source=g> Email: brian@freeswitch.com Mobile: 918-424-9378 Website: https://www.FreeSWITCH.com <https://www.freeswitch.com/> [image: https://www.facebook.com/signalwireinc?src=email] <https://www.facebook.com/freeswitch> [image: https://twitter.com/freeswitch] <https://twitter.com/freeswitch>
Hi,
On May 25, 2018, at 08:15 , Vallimamod Abdullah <vma@vallimamod.org> wrote: The ext-xxx-ip is only needed if your external IP is private and nated to a public one defined on your router. This setting tells freeswitch to put directly the public IP in the contact and the SDP.
That is crucial, undocumented (as far as I know) information. The external IP in my case is publicly visible.
If it's not already the case, you should use a different internal profile (attached to your internal IP) to discuss with your IS. In this profile, you don't need to define any NAT setting.
Oh, excellent. That's the missing piece of the puzzle: an internal profile. I didn't realize that was necessary, since it _almost_ worked in a single profile that did both. Use of the single profile is no doubt why I needed ext-sip-ip defined to get this working even partially. Now comes some testing and experimentation, to put it mildly. Thank you very much! -- Moshe Yudkowsky Disaggregate Corporation 2952 W Fargo Chicago, IL 60645 USA +1 773 764 8727 speech@pobox.com http://www.Disaggregate.com http://www.PebbleAndAvalanche.com
participants (3)
-
Brian West
-
M Yudkowsky
-
Vallimamod Abdullah