I have an asterisk system with SIP phones connecting from internet. I want to know how stable the SIP connectivity is and if phones are getting disconnected from Asterisk frequently.
To monitor it, I am listening to AMI events using a python program (using panoramisk library), specifically, I am listening to ContactStatus events and I can see that the SIP status is frequently oscillating between Removed and Reachable.
A typical log looks like:
16:08:06 PJSIP/200 is now reachable with latency 23.559ms from 2xx.yy.zz.75
16:09:06 ContactStatus of PJSIP/200 is now Removed
16:09:06 ContactStatus of PJSIP/200 is now NonQualified
16:09:06 ContactStatus of PJSIP/200 is now Reachable
16:09:06 PJSIP/200 is now reachable with latency 28.466ms from 2xx.yy.zz.75
16:10:07 ContactStatus of PJSIP/200 is now Removed
16:10:07 ContactStatus of PJSIP/200 is now NonQualified
16:10:07 ContactStatus of PJSIP/200 is now Reachable
16:10:07 PJSIP/200 is now reachable with latency 24.357ms from 2xx.yy.zz.75
16:11:07 ContactStatus of PJSIP/200 is now Removed
16:11:07 ContactStatus of PJSIP/200 is now NonQualified
16:11:07 ContactStatus of PJSIP/200 is now Reachable
16:11:07 PJSIP/200 is now reachable with latency 33.349ms from 2xx.yy.zz.75
16:12:07 ContactStatus of PJSIP/200 is now Removed
16:12:07 ContactStatus of PJSIP/200 is now NonQualified
16:12:07 ContactStatus of PJSIP/200 is now Reachable
16:12:07 PJSIP/200 is now reachable with latency 23.624ms from 2xx.yy.zz.75
16:14:08 ContactStatus of PJSIP/200 is now Removed
16:14:08 ContactStatus of PJSIP/200 is now NonQualified
16:14:08 ContactStatus of PJSIP/200 is now Reachable
16:14:08 PJSIP/200 is now reachable with latency 24.539ms from 2xx.yy.zz.75
From the logs its clear that with in the same second, it cycles from Removed to NonQualified and then becomes Reachable again. It stays in Reachable for some time and then the cycle repeates.
I have checked other SIP related events too like DeviceStateChange and PeerStatus. They too display similar behaviour.
I am using realtime with MySQL backend to configure PJSIP and qualify_frequency is 15 and qualify_timeout is NULL.
Is this the expected behaviour? I think the connection from SIP client to Asterisk is stable, but the status is some how getting confused.
I haven’t looked deeply at this. For such analysis things should go to the issue tracker[1]. I can say though that I haven’t heard of anyone else experiencing such a problem, and I’m aware of deployments using realtime and such.