[Asterisk-code-review] res_pjsip: Add endpoint configuration -- log_subscription_error (asterisk[master])

Mark Murawski asteriskteam at digium.com
Sun May 10 16:11:23 CDT 2020


Mark Murawski has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/14405 )


Change subject: res_pjsip:  Add endpoint configuration -- log_subscription_error
......................................................................

res_pjsip:  Add endpoint configuration -- log_subscription_error

Turn off logging for any kind of PJSIP subscription error
Example: Endpoint '1000' state subscription failed: Extension '1010' does not exist in context....

Patches:
  master-6b2d9451741cadb080637190af65d40f692d67ed-pjsip-log_subscription_error.patch  submitted by Mark Murawski (license 1000250)

ASTERISK-28881 #close

Change-Id: I5dff21c3c8ac3a3e3aefbd89053581fb90bc7018
---
M include/asterisk/res_pjsip.h
M res/res_pjsip/pjsip_configuration.c
M res/res_pjsip_exten_state.c
3 files changed, 8 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/05/14405/1

diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h
index fd80581..846f929 100644
--- a/include/asterisk/res_pjsip.h
+++ b/include/asterisk/res_pjsip.h
@@ -598,6 +598,8 @@
 	struct ast_sip_mwi_configuration mwi;
 	/*! Context for SUBSCRIBE requests */
 	char context[AST_MAX_CONTEXT];
+	/*! Whether or not to log failed notify (Example: Endpoint '1000' state subscription failed: Extension '1010' does not exist in context.....) */
+	unsigned int log_subscription_error;
 };
 
 /*!
diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c
index f95ee9e..088c950 100644
--- a/res/res_pjsip/pjsip_configuration.c
+++ b/res/res_pjsip/pjsip_configuration.c
@@ -2025,6 +2025,7 @@
 		call_offer_pref_handler, incoming_call_offer_pref_to_str, NULL, 0, 0);
 	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "outgoing_call_offer_pref", "remote",
 		call_offer_pref_handler, outgoing_call_offer_pref_to_str, NULL, 0, 0);
+       ast_sorcery_object_field_register(sip_sorcery, "endpoint", "log_subscription_error", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, subscription.log_subscription_error));
 
 	if (ast_sip_initialize_sorcery_transport()) {
 		ast_log(LOG_ERROR, "Failed to register SIP transport support with sorcery\n");
diff --git a/res/res_pjsip_exten_state.c b/res/res_pjsip_exten_state.c
index df9a35f..9b72d69 100644
--- a/res/res_pjsip_exten_state.c
+++ b/res/res_pjsip_exten_state.c
@@ -415,9 +415,11 @@
 	const char *context = S_OR(endpoint->subscription.context, endpoint->context);
 
 	if (!ast_exists_extension(NULL, context, resource, PRIORITY_HINT, NULL)) {
-		ast_log(LOG_NOTICE, "Endpoint '%s' state subscription failed: "
-			"Extension '%s' does not exist in context '%s' or has no associated hint\n",
-			ast_sorcery_object_get_id(endpoint), resource, context);
+		if (endpoint->subscription.log_subscription_error) {
+			ast_log(LOG_NOTICE, "Endpoint '%s' state subscription failed: "
+				"Extension '%s' does not exist in context '%s' or has no associated hint\n",
+				ast_sorcery_object_get_id(endpoint), resource, context);
+		}
 		return 404;
 	}
 

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I5dff21c3c8ac3a3e3aefbd89053581fb90bc7018
Gerrit-Change-Number: 14405
Gerrit-PatchSet: 1
Gerrit-Owner: Mark Murawski <markm at intellasoft.net>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200510/52ceb5a2/attachment.html>


More information about the asterisk-code-review mailing list