[ZBX-19444] Asterisk Template Detection of PJSIP Registration Status Created: 2021 May 24  Updated: 2025 May 19  Resolved: 2025 May 19

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Templates (T)
Affects Version/s: 5.0.11
Fix Version/s: None

Type: Problem report Priority: Trivial
Reporter: Oleg Gawriloff Assignee: Zabbix Support Team
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

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.
 


 Comments   
Comment by Julianna Wilamowska (Inactive) [ 2025 Apr 15 ]

Hello,
Thank You for contacting Zabbix.
I see that Your ticket was created in 2021, please let Us know if You still require our help. 
If You don't respond in this ticket in the next two weeks we will close it.
Kind regards, 
Julianna

Generated at Fri Jul 04 07:47:09 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.