SOLVED 32 second call disconnection

Status
Not open for further replies.
Jul 15, 2021
102
9
18
34
I know there are many posts with this issue, I have tried all that is possible but it is still disconnecting.

Let me explain my setup.

I have a simple full cone NAT on a router which has an external IP and the internal LAN is 192.xx.xx.xx

Fusion PBX resides on a computer inside the LAN which doesn't know about the external IP.

I have setup an external sip profile and modified the external-rtp-ip host:hostname.com and external-sip-ip to host:hostname.com ----> Setting 1

This external sip runs on port 5090. On the router I have port forwarded tcp/udp from the internet to reach 5090 on the Fusion PBX.

With the above setting. When a sip client in the internet tries to register with the sip server using TCP, the registration never reaches fusion pbx.

I had to change the external-sip-ip to local-ip or nat.auto - for the registration to reach the freeswitch. ----> Setting 2

Now with the setting 2, SIP client from the internet registers via TCP, the client is able to make outgoing calls, but the call disconnects with a BYE from freeswitch to the SIP client, after 32 seconds saying Reason: SIP;cause=408;text="ACK Timeout"

I have seen everywhere people suggesting using TCP should solve this - I am using TCP but yet getting this.

Can you see a possible cause for this, when the server sends a BYE, the SIP client responds with a 200 OK

BYE sip:6002@externalipofsipclient:65073;transport=TCP SIP/2.0
Via: SIP/2.0/TCP internalipofpbx:5090;rport;branch=z9hG4bK52gXF5m5jSK8r
Max-Forwards: 70
From: <sip:mobilenumber@hostnameofpbx.com:11500>;tag=B306egDNBDZUm
To: <sip:6002@hostnameofpbx.com:11500;transport=TCP>;tag=dfd1fe6f
Call-ID: b4GrskLkTZZnXx7r063nsA..
CSeq: 39051233 BYE
Contact: <sip:mobilenumber@internaipofpbx:5090;transport=tcp>
User-Agent: FreeSWITCH
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY
Supported: timer, path, replaces
Reason: SIP;cause=408;text="ACK Timeout"
Content-Length: 0

recv 421 bytes from tcp/[externalipofsipclientfrominternet]:65073 at 16:17:30.096517:
------------------------------------------------------------------------
SIP/2.0 200 OK
Via: SIP/2.0/TCP 192.168.1.14:5090;rport=11500;branch=z9hG4bK52gXF5m5jSK8r;received=externalIPofSIPserver
Contact: <sip:6002@externalIPofSIPclientfrominternet:65073;transport=TCP>
To: <sip:6002@hostnameofpbx.com:11500;transport=TCP>;tag=dfd1fe6f
From: <sip:mobile@hostnameofpbx.com:11500>;tag=B306egDNBDZUm
Call-ID: b4GrskLkTZZnXx7r063nsA..
CSeq: 39051233 BYE
User-Agent: Zoiper rv2.10.12.3-mod
Content-Length: 0


However the following is the message that is repeatedly sent by the PBX to client which fails to get a response
SIP/2.0 200 OK
Via: SIP/2.0/TCP internalipofsipclient:45899;branch=z9hG4bK-524287-1---af9f403efa5df485;rport=65073;received=externalipofsipclient
From: <sip:6002@hostnameofpbx.com:11500;transport=TCP>;tag=dfd1fe6f
To: <sip:mobilenumber@hostnameofpbx.com:11500>;tag=B306egDNBDZUm
Call-ID: b4GrskLkTZZnXx7r063nsA..
CSeq: 2 INVITE
Contact: <sip:mobilenumber@internalipofpbx:5090;transport=tcp>
User-Agent: FreeSWITCH
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY
Supported: timer, path, replaces
Allow-Events: talk, hold, conference, refer
Session-Expires: 120;refresher=uas
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 247
Remote-Party-ID: "Outbound Call" <sip:mobilenumber@hostnameofpbx.com>;party=calling;privacy=off;screen=no
 
Last edited:
  • Like
Reactions: etsiot

hfoster

Active Member
Jan 28, 2019
677
80
28
34
You sure you didn't want to copy/edit the internal profile? You're talking about registering a SIP client, which will be the internal profile. The internal profile has NAT helpers enabled for clients, like NDLB-force-rport, and the NAT detection.

Behind NAT with remote extensions, the most I ever need to do is create a port forward for 5060 inbound, and modify the $${external_rtp_ip} and $${external_sip_ip} value to 'autonat:XXX.XXX.XXX.XXX'
 
Jul 15, 2021
102
9
18
34
I copied an externa profile, let me try comparing the internal profile with the other one. When you say 'autonat:XXX.XXX.XXX.XXX' what is the value of the ip address? internal or externa?
 

hfoster

Active Member
Jan 28, 2019
677
80
28
34
Public in this case, it's what will be given in the Contact header. Hostname should be fine too, I guess.
 
Jul 15, 2021
102
9
18
34
I copied an internal profile and modified it - with settings as suggested by you

'autonat:XXX.XXX.XXX.XXX' - with externalip - the profile doesn't start,

complains
2) The IP the profile is attempting to bind to is not local to this system. --- which is correct - as the system has only a local IP and is behind NAT - the external IP is that of the router.

When I do autonat:localip - with this new profile - call connects - but disconnects after 32 seconds.
 
Jul 15, 2021
102
9
18
34
Ok attached is the sip flow from the client side, after the call is established, the Freeswitch sends a session progress 183, then it keeps on sending SIP status OK 11 times- but the client doesn't send anything back - this appears nothing to do with NAT as the client is not trying to send anything anywhere after receiving the SIP status OK from freeswitch.

I am running the sip client Zoiper on the remote network and wireshark is running on the same device. I have captured the packets on the hardware which runs Zoiper - so no issue of router messing things up. Zoiper is not responding with an ACK message after receiving 200 OK message. Not sure why though.

In my LAN - I have Zoiper and when a call is established, the 200OK is sent by freeswitch and Zoiper sends an acknowledgment back

Please see this message 200 OK is sent 11 times by Freeswitch and the client receives it 11 times - I have packet captured at the client side- client is NOT attempting to send any acknowledgement.


SIP/2.0 200 OK
Via: SIP/2.0/TCP internalipofsipclient:45899;branch=z9hG4bK-524287-1---af9f403efa5df485;rport=65073;received=externalipofsipclient
From: <sip:6002@hostnameofpbx.com:11500;transport=TCP>;tag=dfd1fe6f
To: <sip:mobilenumber@hostnameofpbx.com:11500>;tag=B306egDNBDZUm
Call-ID: b4GrskLkTZZnXx7r063nsA..
CSeq: 2 INVITE
Contact: <sip:mobilenumber@internalipofpbx:5090;transport=tcp>
User-Agent: FreeSWITCH
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY
Supported: timer, path, replaces
Allow-Events: talk, hold, conference, refer
Session-Expires: 120;refresher=uas
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 247
Remote-Party-ID: "Outbound Call" <sip:mobilenumber@hostnameofpbx.com>;party=calling;privacy=off;screen=no

v=0
o=FreeSWITCH 1627185020 1627185021 IN IP4 freeswitchexternalIP
s=FreeSWITCH
c=IN IP4 freeswitchexternalIP
t=0 0
m=audio 24976 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:eek:ff - - - -
a=ptime:20
 
Last edited:

hfoster

Active Member
Jan 28, 2019
677
80
28
34
>2) The IP the profile is attempting to bind to is not local to this system. --- which is correct - as the system has only a local IP and is behind NAT - the external IP is that of the router.

You sure you're only changing ext-rtp-ip and ext-sip-ip? Whether directly on the profile or via variables? This is all I have on my profiles

1627310669555.png

Not liking the idea that the contact you seem to be sending is internal, though the SDP body looks OK.
 
Jul 15, 2021
102
9
18
34
I rebooted my machine and then added this one more time in the external profile
ext-rtp-ip host:hostname True
ext-sip-ip host:hostnameTrue


This seems to have fixed the contact headers, they now have the external IP - but now after the call is established there is no audio and it disconnects after 32 seconds as usual.
 
Jul 15, 2021
102
9
18
34
I did some playing around ext-sip-ip host:hostname -> this sets the contact header with external IP however no audio + 32 second disconnection
ext-sip-ip:autonat:externalip -> contact header set with external IP + audio works ---> 32 second disconnection
ext-sip-ip:autonat:localip --> header set with internal ip+ audio works ---> 32 second disconnection

ext-sip-ip autonat:host:hostname -> this doesn;t work - sip profile doesn't statup
 
Jul 15, 2021
102
9
18
34
OK, solved by adding the following in the external sip profile,

aggressive-nat-detection true True

now calls last beyond 32 seconds, the ACK is received by freeswitch.

if NDLB-force-rport is also present in the profile - there is no audio.

so I had to disable NDLB-force-rport

NDLB-force-rport true False


To summarise

I have to use

aggressive-nat-detection true True

ext-rtp-ip autonat:host:hostname True
ext-sip-ip host:hostname True

If autonat is added to ext-sip-ip then call will get established but there won't be any audio.

On another installation I had to have this like this to get rid of the 32 second problem which is behind the same router, so play with these settings to suit your setup

ext-rtp-ip autonat:host:hostname True
ext-sip-ip autonat:host:hostname True
 
Last edited:

hfoster

Active Member
Jan 28, 2019
677
80
28
34
Good to hear, it often takes the right combo for it to work behind NAT.

One of the reasons I pretty much mandate a public address for FusionPBX.
 
Jul 15, 2021
102
9
18
34
Just an update: I have tried several combinations and have figured out the crux of the issue in my case.

I have a router which is port forwarding, so external users connect to my sip server using a port number different to 5090, which gets port forwarded to 5090 which is the port on which the profile is listening.

However when a call gets established, an invite is sent to the remote sip client by the sip server, this invite - what ever you do with autonat, aggressive nat etc- will not know anything about your external port that gets forwarded. It still sends the internal port.

So with this setting, your contact header will have the external IP and port as 5090 or which ever port you chose the profile to run on. Most sip clients try to contact this port and fail as it is not accessible from the outside world. Zoiper Linphone etc use the contact header to send the ACK even if you use TCP. They don't seem to use the existing channel which is already open.

However Sipnetic client alone works with portforwarding from a different router port on WAN to different port on LAN for that you need setting 2.

For safer option run the profile on the same port as the one listened on the firewall.

aggressive-nat-detection true True
ext-rtp-ip autonat:host:hostname True
ext-sip-ip host:hostname True

This is ok as long as you have a static public IP - host:hostname gets resolved only when the profile starts up or when it is restarted, so if you are on a dynamic ip when the IP address changes, host:hostname stays with your last IP and it may give trouble
 
Last edited:
  • Like
Reactions: etsiot
Status
Not open for further replies.