ContactStatus oscilating between Removed and Reachable

Hello all,

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.

What version of Asterisk is in use?

I am using Asterisk certified/16.8-cert2

What is the full realtime configuration?

Thanks for your response. Please find the full real time config of the user:

mysql> select * from ps_aors where id = '200'\G
*************************** 1. row ***************************
                  id: 200
             contact: NULL
  default_expiration: NULL
           mailboxes: NULL
        max_contacts: 1
  minimum_expiration: NULL
     remove_existing: yes
   qualify_frequency: 15
authenticate_qualify: NULL
  maximum_expiration: NULL
      outbound_proxy: NULL
        support_path: NULL
     qualify_timeout: NULL
 voicemail_extension: NULL
mysql> select * from ps_auths where id = '200'\G
*************************** 1. row ***************************
            id: 200
     auth_type: userpass
nonce_lifetime: NULL
      md5_cred: NULL
      password: secure_pass
         realm: NULL
      username: 200
mysql> select * from ps_endpoints where id = '200'\G
*************************** 1. row ***************************
                                id: 200
                         transport: transport-udp
                              aors: 200
                              auth: 200
                           context: inbound
                          disallow: all
                             allow: ulaw
                      direct_media: no
             connected_line_method: NULL
               direct_media_method: NULL
     direct_media_glare_mitigation: NULL
       disable_direct_media_on_nat: NULL
                         dtmf_mode: NULL
            external_media_address: NULL
                       force_rport: yes
                       ice_support: NULL
                       identify_by: NULL
                         mailboxes: NULL
                       moh_suggest: NULL
                     outbound_auth: NULL
                    outbound_proxy: NULL
                   rewrite_contact: yes
                          rtp_ipv6: NULL
                     rtp_symmetric: yes
                    send_diversion: NULL
                          send_pai: NULL
                         send_rpid: NULL
                     timers_min_se: NULL
                            timers: NULL
               timers_sess_expires: NULL
                          callerid: NULL
                  callerid_privacy: NULL
                      callerid_tag: NULL
                            100rel: NULL
                     aggregate_mwi: NULL
                  trust_id_inbound: NULL
                 trust_id_outbound: NULL
                         use_ptime: NULL
                          use_avpf: NULL
                  media_encryption: NULL
                   inband_progress: NULL
                        call_group: NULL
                      pickup_group: NULL
                  named_call_group: NULL
                named_pickup_group: NULL
              device_state_busy_at: NULL
                        fax_detect: NULL
                         t38_udptl: NULL
                      t38_udptl_ec: NULL
             t38_udptl_maxdatagram: NULL
                     t38_udptl_nat: NULL
                    t38_udptl_ipv6: NULL
                         tone_zone: NULL
                          language: NULL
               one_touch_recording: NULL
                 record_on_feature: NULL
                record_off_feature: NULL
                        rtp_engine: NULL
                    allow_transfer: NULL
                   allow_subscribe: NULL
                         sdp_owner: NULL
                       sdp_session: NULL
                         tos_audio: NULL
                         tos_video: NULL
                    sub_min_expiry: NULL
                       from_domain: NULL
                         from_user: NULL
                     mwi_from_user: NULL
                       dtls_verify: NULL
                        dtls_rekey: NULL
                    dtls_cert_file: NULL
                  dtls_private_key: NULL
                       dtls_cipher: NULL
                      dtls_ca_file: NULL
                      dtls_ca_path: NULL
                        dtls_setup: NULL
                       srtp_tag_32: NULL
                     media_address: NULL
                   redirect_method: NULL
                           set_var: NULL
                         cos_audio: NULL
                         cos_video: NULL
                   message_context: NULL
                         force_avp: NULL
      media_use_received_transport: NULL
                       accountcode: NULL
                     user_eq_phone: NULL
                   moh_passthrough: NULL
       media_encryption_optimistic: NULL
                    rpid_immediate: NULL
                 g726_non_standard: NULL
                     rtp_keepalive: NULL
                       rtp_timeout: NULL
                  rtp_timeout_hold: NULL
         bind_rtp_to_media_address: NULL
               voicemail_extension: NULL
mwi_subscribe_replaces_unsolicited: NULL
                              deny: NULL
                            permit: NULL
                               acl: NULL
                      contact_deny: NULL
                    contact_permit: NULL
                       contact_acl: NULL
                 subscribe_context: NULL
                fax_detect_timeout: NULL
                      contact_user: NULL
              preferred_codec_only: NULL
              asymmetric_rtp_codec: NULL
                          rtcp_mux: NULL
                     allow_overlap: NULL
              refer_blind_progress: NULL
        notify_early_inuse_ringing: NULL
                 max_audio_streams: NULL
                 max_video_streams: NULL
                            webrtc: NULL
                  dtls_fingerprint: NULL
              incoming_mwi_mailbox: NULL
                            bundle: NULL
           dtls_auto_generate_cert: NULL
           follow_early_media_fork: NULL
       accept_multiple_sdp_answers: NULL
      suppress_q850_reason_headers: NULL
              trust_connected_line: NULL
               send_connected_line: NULL
            ignore_183_without_sdp: NULL

@jcolp Did you get a chance to look at this? Any more information needed?

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.

[1] https://issues.asterisk.org/jira

Thanks, I will open an issue in jira.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.