[asterisk-commits] res_prometheus: Optional load res_pjsip_outbound_registration.so (asterisk[19])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 5 06:37:14 CDT 2022


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/18676 )

Change subject: res_prometheus: Optional load res_pjsip_outbound_registration.so
......................................................................

res_prometheus: Optional load res_pjsip_outbound_registration.so

Switched res_pjsip_outbound_registration.so dep to optional. Added
module loaded check before using it.

ASTERISK-30101 #close

Change-Id: Ia34f1684d984e821fbdd4de8911f930337703666
---
M res/res_prometheus.c
1 file changed, 9 insertions(+), 3 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, approved
  Kevin Harwell: Looks good to me, but someone else must approve
  Friendly Automation: Approved for Submit



diff --git a/res/res_prometheus.c b/res/res_prometheus.c
index 4aacf6e..5d277f1 100644
--- a/res/res_prometheus.c
+++ b/res/res_prometheus.c
@@ -974,8 +974,13 @@
 	if (cli_init()
 		|| channel_metrics_init()
 		|| endpoint_metrics_init()
-		|| bridge_metrics_init()
-		|| pjsip_outbound_registration_metrics_init()) {
+		|| bridge_metrics_init()) {
+		goto cleanup;
+	}
+	
+	if(ast_module_check("res_pjsip_outbound_registration.so")) {
+		/* Call a local function, used in the core prometheus code only */
+		if (pjsip_outbound_registration_metrics_init())
 		goto cleanup;
 	}
 
@@ -1004,6 +1009,7 @@
 	.load_pri = AST_MODPRI_DEFAULT,
 #ifdef HAVE_PJPROJECT
 	/* This module explicitly calls into res_pjsip if Asterisk is built with PJSIP support, so they are required. */
-	.requires = "res_pjsip,res_pjsip_outbound_registration",
+	.requires = "res_pjsip",
+	.optional_modules = "res_pjsip_outbound_registration",
 #endif
 );

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18676
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 19
Gerrit-Change-Id: Ia34f1684d984e821fbdd4de8911f930337703666
Gerrit-Change-Number: 18676
Gerrit-PatchSet: 3
Gerrit-Owner: Boris P. Korzun <drtr0jan at yandex.ru>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20220705/723ab3ee/attachment.html>


More information about the asterisk-commits mailing list