Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-19444

Asterisk Template Detection of PJSIP Registration Status

    XMLWordPrintable

Details

    • Problem report
    • Status: Open
    • Trivial
    • Resolution: Unresolved
    • 5.0.11
    • None
    • Templates (T)
    • None
    • asterisk 16

    Description

      In current template only network status of PJSIP is detected (i.e. if remote PJSIP is not available) than 'PJSIP trunk "{#OBJECTNAME}": PJSIP trunk {#OBJECTNAME} has a state Unavailable' based on state of '

      {[Template Tel Asterisk by HTTP:asterisk.pjsip.trunk.devicestate[\{#OBJECTNAME}

      ]|https://zabbix.managed-it.a1.by/disc_prototypes.php?form=update&itemid=91461&parent_discoveryid=91455].last()}="Unavailable"' is fired.

      But if remote PJSIP is available but credentials is not correct then no any items/triggers exists.

      Following changes is needed in js code to monitor PJSIP registration status through PJSIPShowRegistrationsOutbound AMI comman:

      <code>

      +++ asterisk.js 2021-02-01 19:45:11.132350027 +0300
      @@ -71,6 +71,7 @@
      },
      pjsip:

      { trunks: [], + registrations: [], available: 0, unavailable: 0, total: 0 @@ -192,6 +193,14 @@ }

      );
      }

      +function getPjsipShowRegistrationOutbound() {
      + response = Ami.request(url, 'PJSIPShowRegistrationsOutbound');
      + elements = text2Object(response.body);
      + asterisk.pjsip.registrations = elements.filter(function (element)

      { + return ( element.ObjectName.search(Ami.params.trunk) != -1 && element.Event.search('OutboundRegistrationDetail') != -1 ); + }

      );
      +}
      +
      function getQueueSummary() {

      function getQueueSummary() {
      response = Ami.request(url, 'QueueSummary');
      asterisk.queue.queues = text2Object(response.body);
      @@ -248,6 +257,9 @@
      if (list.includes('PJSIPShowEndpoints'))

      { getPjsipShowEndpoints(); }

      +if (list.includes('PJSIPShowRegistrationsOutbound'))

      { + getPjsipShowRegistrationOutbound(); +}

      if (list.includes('QueueSummary'))

      { getQueueSummary(); }

      </code>

       

      And following trigger is created 

      {[Template Tel Asterisk by HTTP:asterisk.pjsip.registrations.status[\{#OBJECTNAME}

      ]

      https://zabbix.managed-it.a1.by/disc_prototypes.php?form=update&itemid=133965&parent_discoveryid=91455].last()}<>"Registered"
      based on state of new 'asterisk.pjsip.registrations.status{#OBJECTNAME}' item
       
      PS: It will be better to put this state to smth like asterisk.pjsip.trunk.registrationstate{#OBJECTNAME} but it is beyond my JS skills.
       

      Attachments

        Activity

          People

            ssimonenko Sergey Simonenko
            barzog Oleg Gawriloff
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: