Pjsip trunk becoming unreachable precisely every 300 seconds (five minutes)

Question is: Any ideas how to resolve a trunk becoming unreachable every 300 seconds?

Howdy, I have an asterisk server hosted in Amazon on CentOS as a playground. A trunk is becoming unreachable precisely every 300 seconds (every 5 minutes) and then reachable approximately 60 seconds later. I’m losing what’s left of my sanity trying to track down the cause. It sure feels to me like a timer of some sort, but my trunk registration look to be 3600 seconds (an hour) not 5 minutes.

I sure appreciate any pointers. I tried a kludge of croning every minute the following.

          • /usr/sbin/asterisk -x “pjsip send register *all” >/dev/null 2>&1

Below is the most recent last 60 or so Lines from /var/log/asterisk/full log file.

[2018-12-12 20:25:08] VERBOSE[18961] res_pjsip/pjsip_configuration.c: Endpoint voip-local-trunk is now Unreachable
[2018-12-12 20:25:08] VERBOSE[18961] res_pjsip/pjsip_options.c: Contact voip-local-trunk/sip:voippbx007@dallas.voipservice.com:5060 is now Unreachable. RTT: 0.000 msec
[2018-12-12 20:26:01] VERBOSE[6340] asterisk.c: Remote UNIX connection
[2018-12-12 20:26:02] VERBOSE[15949] asterisk.c: Remote UNIX connection disconnected
[2018-12-12 20:26:05] VERBOSE[28881] res_pjsip/pjsip_configuration.c: Endpoint voip-local-trunk is now Reachable
[2018-12-12 20:26:05] VERBOSE[28881] res_pjsip/pjsip_options.c: Contact voip-local-trunk/sip:voippbx007@dallas.voipservice.com:5060 is now Reachable. RTT: 15.198 msec
[2018-12-12 20:27:01] VERBOSE[6340] asterisk.c: Remote UNIX connection
[2018-12-12 20:27:01] VERBOSE[16082] asterisk.c: Remote UNIX connection disconnected
[2018-12-12 20:28:01] VERBOSE[6340] asterisk.c: Remote UNIX connection
[2018-12-12 20:28:01] VERBOSE[16233] asterisk.c: Remote UNIX connection disconnected
[2018-12-12 20:29:01] VERBOSE[6340] asterisk.c: Remote UNIX connection
[2018-12-12 20:29:01] VERBOSE[16384] asterisk.c: Remote UNIX connection disconnected
[2018-12-12 20:30:01] VERBOSE[6340] asterisk.c: Remote UNIX connection
[2018-12-12 20:30:01] VERBOSE[16527] asterisk.c: Remote UNIX connection disconnected
[2018-12-12 20:30:08] VERBOSE[32459] res_pjsip/pjsip_configuration.c: Endpoint voip-local-trunk is now Unreachable
[2018-12-12 20:30:08] VERBOSE[32459] res_pjsip/pjsip_options.c: Contact voip-local-trunk/sip:voippbx007@dallas.voipservice.com:5060 is now Unreachable. RTT: 0.000 msec
[2018-12-12 20:31:01] VERBOSE[6340] asterisk.c: Remote UNIX connection
[2018-12-12 20:31:01] VERBOSE[17071] asterisk.c: Remote UNIX connection disconnected
[2018-12-12 20:31:05] VERBOSE[12811] res_pjsip/pjsip_configuration.c: Endpoint voip-local-trunk is now Reachable
[2018-12-12 20:31:05] VERBOSE[12811] res_pjsip/pjsip_options.c: Contact voip-local-trunk/sip:voippbx007@dallas.voipservice.com:5060 is now Reachable. RTT: 15.062 msec
[2018-12-12 20:32:01] VERBOSE[6340] asterisk.c: Remote UNIX connection
[2018-12-12 20:32:01] VERBOSE[17496] asterisk.c: Remote UNIX connection disconnected
[2018-12-12 20:33:01] VERBOSE[6340] asterisk.c: Remote UNIX connection
[2018-12-12 20:33:01] VERBOSE[17693] asterisk.c: Remote UNIX connection disconnected
[2018-12-12 20:34:01] VERBOSE[6340] asterisk.c: Remote UNIX connection
[2018-12-12 20:34:01] VERBOSE[17863] asterisk.c: Remote UNIX connection disconnected
[2018-12-12 20:35:01] VERBOSE[6340] asterisk.c: Remote UNIX connection
[2018-12-12 20:35:01] VERBOSE[18015] asterisk.c: Remote UNIX connection disconnected
[2018-12-12 20:35:08] VERBOSE[32459] res_pjsip/pjsip_configuration.c: Endpoint voip-local-trunk is now Unreachable
[2018-12-12 20:35:08] VERBOSE[32459] res_pjsip/pjsip_options.c: Contact voip-local-trunk/sip:voippbx007@dallas.voipservice.com:5060 is now Unreachable. RTT: 0.000 msec
[2018-12-12 20:36:01] VERBOSE[6340] asterisk.c: Remote UNIX connection
[2018-12-12 20:36:01] VERBOSE[18209] asterisk.c: Remote UNIX connection disconnected
[2018-12-12 20:36:05] VERBOSE[18961] res_pjsip/pjsip_configuration.c: Endpoint voip-local-trunk is now Reachable
[2018-12-12 20:36:05] VERBOSE[18961] res_pjsip/pjsip_options.c: Contact voip-local-trunk/sip:voippbx007@dallas.voipservice.com:5060 is now Reachable. RTT: 15.612 msec
[2018-12-12 20:37:01] VERBOSE[6340] asterisk.c: Remote UNIX connection
[2018-12-12 20:37:01] VERBOSE[18351] asterisk.c: Remote UNIX connection disconnected
[2018-12-12 20:38:01] VERBOSE[6340] asterisk.c: Remote UNIX connection
[2018-12-12 20:38:01] VERBOSE[18497] asterisk.c: Remote UNIX connection disconnected
[2018-12-12 20:39:01] VERBOSE[6340] asterisk.c: Remote UNIX connection
[2018-12-12 20:39:01] VERBOSE[18646] asterisk.c: Remote UNIX connection disconnected
[2018-12-12 20:40:01] VERBOSE[6340] asterisk.c: Remote UNIX connection
[2018-12-12 20:40:01] VERBOSE[18792] asterisk.c: Remote UNIX connection disconnected
[2018-12-12 20:40:08] VERBOSE[18961] res_pjsip/pjsip_configuration.c: Endpoint voip-local-trunk is now Unreachable
[2018-12-12 20:40:08] VERBOSE[18961] res_pjsip/pjsip_options.c: Contact voip-local-trunk/sip:voippbx007@dallas.voipservice.com:5060 is now Unreachable. RTT: 0.000 msec
[2018-12-12 20:41:01] VERBOSE[6340] asterisk.c: Remote UNIX connection
[2018-12-12 20:41:01] VERBOSE[18986] asterisk.c: Remote UNIX connection disconnected
[2018-12-12 20:41:05] VERBOSE[4279] res_pjsip/pjsip_configuration.c: Endpoint voip-local-trunk is now Reachable
[2018-12-12 20:41:05] VERBOSE[4279] res_pjsip/pjsip_options.c: Contact voip-local-trunk/sip:voippbx007@dallas.voipservice.com:5060 is now Reachable. RTT: 14.429 msec
[2018-12-12 20:42:01] VERBOSE[6340] asterisk.c: Remote UNIX connection
[2018-12-12 20:42:01] VERBOSE[19139] asterisk.c: Remote UNIX connection disconnected
[2018-12-12 20:43:01] VERBOSE[6340] asterisk.c: Remote UNIX connection
[2018-12-12 20:43:01] VERBOSE[19302] asterisk.c: Remote UNIX connection disconnected
[2018-12-12 20:44:01] VERBOSE[6340] asterisk.c: Remote UNIX connection
[2018-12-12 20:44:01] VERBOSE[19429] asterisk.c: Remote UNIX connection disconnected
[2018-12-12 20:45:01] VERBOSE[6340] asterisk.c: Remote UNIX connection
[2018-12-12 20:45:01] VERBOSE[19589] asterisk.c: Remote UNIX connection disconnected
[2018-12-12 20:45:08] VERBOSE[28881] res_pjsip/pjsip_configuration.c: Endpoint voip-local-trunk is now Unreachable
[2018-12-12 20:45:08] VERBOSE[28881] res_pjsip/pjsip_options.c: Contact voip-local-trunk/sip:voippbx007@dallas.voipservice.com:5060 is now Unreachable. RTT: 0.000 msec

Make a sip trace to the OPTION request package and verify if is the remote peer that it is not responding.

also what it is your endpoint section configuration

Thanks #ambiorixg12

It doesn’t appear to have added any depth to the logging though. Did I do something wrong?

[root@pbx007 asterisk]# asterisk -x "sip set debug on"
SIP Debugging enabled
[root@pbx007 asterisk]# tail -f /var/log/asterisk/full

[2018-12-12 21:20:01] VERBOSE[6340] asterisk.c: Remote UNIX connection
[2018-12-12 21:20:01] VERBOSE[25773] asterisk.c: Remote UNIX connection disconnected
[2018-12-12 21:20:08] VERBOSE[12811] res_pjsip/pjsip_configuration.c: Endpoint voip-local-trunk is now Unreachable
[2018-12-12 21:20:08] VERBOSE[12811] res_pjsip/pjsip_options.c: Contact voip-local-trunk/sip:voippbx007@dallas.voipservice.com:5060 is now Unreachable. RTT: 0.000 msec
[2018-12-12 21:21:01] VERBOSE[6340] asterisk.c: Remote UNIX connection
[2018-12-12 21:21:01] VERBOSE[25956] asterisk.c: Remote UNIX connection disconnected
[2018-12-12 21:21:05] VERBOSE[32459] res_pjsip/pjsip_configuration.c: Endpoint voip-local-trunk is now Reachable
[2018-12-12 21:21:05] VERBOSE[32459] res_pjsip/pjsip_options.c: Contact voip-local-trunk/sip:voippbx007@dallas.voipservice.com:5060 is now Reachable. RTT: 15.129 msec

if you are using pjsip the command is pjsip set logger on

Doh! oh, man. Sorry bout that. I’ve got it set and I’ll wait five minutes to see what develops. I see the verbose depth has been added to the log already.

[root@pbx007 asterisk]# asterisk -x “pjsip set logger on”

PJSIP Logging enabled

[root@pbx007 asterisk]#

[root@pbx007 asterisk]#

[root@pbx007 asterisk]# tail -f /var/log/asterisk/full

Alrighty. Here’s the log. Thank you very much @ambiorixg12

Here it is in pastebin My sincere apologies for the terrible length of the log but it’s only about 7 minutes worth to capture the failure.

https://pastebin.com/zrjadbrm

I cant analyze 7 minutes of logs, you will have to do it your self and if you find something you cant understand ask it here and we will help

Heh, right. Thanks @ambiorixg12