[Asterisk-code-review] res_pjsip_pubsub: add endpoint to some warning (...asterisk[16])

Alexei Gradinari asteriskteam at digium.com
Tue Sep 24 14:24:06 CDT 2019


Alexei Gradinari has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/12952


Change subject: res_pjsip_pubsub: add endpoint to some warning
......................................................................

res_pjsip_pubsub: add endpoint to some warning

There are some warning messages which are not informative without endpoint:
"No registered subscribe handler for event presence.winfo"
"No registered publish handler for event presence"

This patch adds an endpoint name to these messages.

Change-Id: Ia2811ec226d8a12659b4f9d4d224b48289650827
---
M res/res_pjsip_pubsub.c
1 file changed, 12 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/52/12952/1

diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c
index 8f400b5..29791a7 100644
--- a/res/res_pjsip_pubsub.c
+++ b/res/res_pjsip_pubsub.c
@@ -766,14 +766,20 @@
 
 	event_header = pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &str_event_name, rdata->msg_info.msg->hdr.next);
 	if (!event_header) {
-		ast_log(LOG_WARNING, "Incoming SUBSCRIBE request with no Event header\n");
+		struct ast_sip_endpoint *endpoint = ast_pjsip_rdata_get_endpoint(rdata);
+		ast_log(LOG_WARNING, "Incoming SUBSCRIBE request from %s with no Event header\n",
+			endpoint ? ast_sorcery_object_get_id(endpoint) : "Unknown");
+		ao2_cleanup(endpoint);
 		return NULL;
 	}
 	ast_copy_pj_str(event, &event_header->event_type, sizeof(event));
 
 	handler = find_sub_handler_for_event_name(event);
 	if (!handler) {
-		ast_log(LOG_WARNING, "No registered subscribe handler for event %s\n", event);
+		struct ast_sip_endpoint *endpoint = ast_pjsip_rdata_get_endpoint(rdata);
+		ast_log(LOG_WARNING, "No registered subscribe handler for event %s from %s\n", event,
+			endpoint ? ast_sorcery_object_get_id(endpoint) : "Unknown");
+		ao2_cleanup(endpoint);
 	}
 
 	return handler;
@@ -3294,7 +3300,8 @@
 
 	event_header = pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &str_event_name, rdata->msg_info.msg->hdr.next);
 	if (!event_header) {
-		ast_log(LOG_WARNING, "Incoming PUBLISH request with no Event header\n");
+		ast_log(LOG_WARNING, "Incoming PUBLISH request from %s with no Event header\n",
+			ast_sorcery_object_get_id(endpoint));
 		pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 489, NULL, NULL, NULL);
 		return PJ_TRUE;
 	}
@@ -3302,7 +3309,8 @@
 
 	handler = find_pub_handler(event);
 	if (!handler) {
-		ast_log(LOG_WARNING, "No registered publish handler for event %s\n", event);
+		ast_log(LOG_WARNING, "No registered publish handler for event %s from %s\n", event,
+			ast_sorcery_object_get_id(endpoint));
 		pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 489, NULL, NULL, NULL);
 		return PJ_TRUE;
 	}

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

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: Ia2811ec226d8a12659b4f9d4d224b48289650827
Gerrit-Change-Number: 12952
Gerrit-PatchSet: 1
Gerrit-Owner: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190924/a98d8900/attachment.html>


More information about the asterisk-code-review mailing list