SIP Peers marked unreachable

Asterisk ver 11.14.2
CentOS - release 6.5

I am seeing a number of our SIP peers marked UNREACHABLE and then REACHABLE 10 seconds later. The peers are both phones and trunks. If I run a TCPDUMP on my asterisk server, I see the Qualify message being sent to the peer and I see the reply received from the peer with a SIP/2.0 200 OK message.

Here is an example what I am seeing the log:

[2015-02-13 15:54:20] NOTICE[21932] chan_sip.c: Peer ‘fpbx-1-749052d6’ is now UNREACHABLE! Last qualify: 41
[2015-02-13 15:54:20] NOTICE[21932] chan_sip.c: Peer ‘fpbx-1-749052d6’ is now UNREACHABLE! Last qualify: 41
[2015-02-13 15:54:30] NOTICE[21932] chan_sip.c: Peer ‘fpbx-1-749052d6’ is now Reachable. (41ms / 2000ms)
[2015-02-13 15:54:30] NOTICE[21932] chan_sip.c: Peer ‘fpbx-1-749052d6’ is now Reachable. (41ms / 2000ms)

Here is the out from the TCPDUMP:
15:54:15.085118 IP (tos 0x60, ttl 64, id 5961, offset 0, flags [none], proto UDP (17), length 578)
192.168.185.85.sip > static.192.159.66.3.cyberlynk.net.sip: SIP, length: 550
OPTIONS sip:trunk1.freepbx.com SIP/2.0
Via: SIP/2.0/UDP 70.62.110.170:5060;branch=z9hG4bK46f9ebe7;rport
Max-Forwards: 70
From: “Unknown” sip:Unknown@70.62.110.170;tag=as06140c11
To: sip:trunk1.freepbx.com
Contact: sip:Unknown@70.62.110.170:5060
Call-ID: 79c51590352150e152c7e1d54eb56eec@70.62.110.170:5060
CSeq: 102 OPTIONS
User-Agent: FPBX-2.11.0(11.14.2)
Date: Fri, 13 Feb 2015 20:54:15 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0

15:54:15.126892 IP (tos 0x0, ttl 51, id 58989, offset 0, flags [none], proto UDP (17), length 721)
static.192.159.66.3.cyberlynk.net.sip > 192.168.185.85.sip: SIP, length: 693
SIP/2.0 200 OK
Via: SIP/2.0/UDP 70.62.110.170:5060;branch=z9hG4bK46f9ebe7;rport=5060
From: “Unknown” sip:Unknown@70.62.110.170;tag=as06140c11
To: sip:trunk1.freepbx.com;tag=Z2DQXQ8H5rSpN
Call-ID: 79c51590352150e152c7e1d54eb56eec@70.62.110.170:5060
CSeq: 102 OPTIONS
Contact: sip:192.159.66.3
User-Agent: SIPStation 2.11.3
Accept: application/sdp
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, precondition, path, replaces
Allow-Events: talk, hold, conference, presence, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
Content-Length: 0

15:54:20.125546 IP (tos 0x60, ttl 64, id 5962, offset 0, flags [none], proto UDP (17), length 578)
192.168.185.85.sip > static.192.159.66.3.cyberlynk.net.sip: SIP, length: 550
OPTIONS sip:trunk1.freepbx.com SIP/2.0
Via: SIP/2.0/UDP 70.62.110.170:5060;branch=z9hG4bK46f9ebe7;rport
Max-Forwards: 70
From: “Unknown” sip:Unknown@70.62.110.170;tag=as06140c11
To: sip:trunk1.freepbx.com
Contact: sip:Unknown@70.62.110.170:5060
Call-ID: 79c51590352150e152c7e1d54eb56eec@70.62.110.170:5060
CSeq: 102 OPTIONS
User-Agent: FPBX-2.11.0(11.14.2)
Date: Fri, 13 Feb 2015 20:54:15 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0

15:54:20.167270 IP (tos 0x0, ttl 51, id 58990, offset 0, flags [none], proto UDP (17), length 721)
static.192.159.66.3.cyberlynk.net.sip > 192.168.185.85.sip: SIP, length: 693
SIP/2.0 200 OK
Via: SIP/2.0/UDP 70.62.110.170:5060;branch=z9hG4bK46f9ebe7;rport=5060
From: “Unknown” sip:Unknown@70.62.110.170;tag=as06140c11
To: sip:trunk1.freepbx.com;tag=Z2DQXQ8H5rSpN
Call-ID: 79c51590352150e152c7e1d54eb56eec@70.62.110.170:5060
CSeq: 102 OPTIONS
Contact: sip:192.159.66.3
User-Agent: SIPStation 2.11.3
Accept: application/sdp
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, precondition, path, replaces
Allow-Events: talk, hold, conference, presence, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
Content-Length: 0

15:54:30.125590 IP (tos 0x60, ttl 64, id 5963, offset 0, flags [none], proto UDP (17), length 578)
192.168.185.85.sip > static.192.159.66.3.cyberlynk.net.sip: SIP, length: 550
OPTIONS sip:trunk1.freepbx.com SIP/2.0
Via: SIP/2.0/UDP 70.62.110.170:5060;branch=z9hG4bK4662e20c;rport
Max-Forwards: 70
From: “Unknown” sip:Unknown@70.62.110.170;tag=as778b7910
To: sip:trunk1.freepbx.com
Contact: sip:Unknown@70.62.110.170:5060
Call-ID: 2a52eda60cbf9ac16142d61162c9c902@70.62.110.170:5060
CSeq: 102 OPTIONS
User-Agent: FPBX-2.11.0(11.14.2)
Date: Fri, 13 Feb 2015 20:54:30 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0

15:54:30.167049 IP (tos 0x0, ttl 51, id 58991, offset 0, flags [none], proto UDP (17), length 721)
static.192.159.66.3.cyberlynk.net.sip > 192.168.185.85.sip: SIP, length: 693
SIP/2.0 200 OK
Via: SIP/2.0/UDP 70.62.110.170:5060;branch=z9hG4bK4662e20c;rport=5060
From: “Unknown” sip:Unknown@70.62.110.170;tag=as778b7910
To: sip:trunk1.freepbx.com;tag=a394Zmj1B7gaK
Call-ID: 2a52eda60cbf9ac16142d61162c9c902@70.62.110.170:5060
CSeq: 102 OPTIONS
Contact: sip:192.159.66.3
User-Agent: SIPStation 2.11.3
Accept: application/sdp
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, precondition, path, replaces
Allow-Events: talk, hold, conference, presence, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
Content-Length: 0

From my limited knowledge of asterisk, it appears that the peer is replying within 2000ms. This trunk is marked unreachable every 15 to 30 minutes. I don’t really understand why the peer is marked unreachable if it is replying in timely manner to the qualify message. Any ideas what would cause this? I have tried disabling fail2ban and iptables.

Dont use qualify or increase the time to qualify your peers

I have not configured a qualify time and it is my understanding that the default is 2000ms. If my peers reply in less than 50 ms how is increasing the time to qualify going to help?

Unreachable generally means you have qualify=yes, but the peer is ignoring OPTIONS requests.

But I personally think that your problem, is beyond any qualify setting.

could be possible that you lose network connectivity with the remote peer, did you check ICMP echo reply , when peer is reachable and then is unreachable

I have a continuous ping going to peer with no packet loss.

Peers are always marked reachable 10 seconds after they are marked unreachable.

This is more of a workaround but try adding:

To sip.conf. It’s a new feature as of Asterisk v11
wiki.asterisk.org/wiki/display/ … +Keepalive

If it still does it try set [quote]qualify=no[/quote]

To the extension.

The keepalive=yes will take care of keeping the NAT port opened so technically qualify=yes is no longer needed if that is the case.

I personally think this qualify OPTIONS reply problem is a long standing Asterisk bug of some sort. If you do a search you see a lot of people having this problem randomly and not necessarily because they have a lot of extensions or certain brands/models of hardware. Messing around with configs doesn’t always solve it unless it involves workarounds

1 Like

I am new to the thread. I’m having same “unreachable” problems, and in a few seconds I get “reachable” messages again. Im running Asterisk 11.x and realtime database.

Some of the “unreachable” messages are understandable because console shows a lag time longer that 2 seconds. But other warnings don’t show any lag time, asterisk just sets them as unreachable without any info message.

If I try to fix with “qualify = no”, ¿how can I know if a peer is reachable?