[Asterisk-code-review] res_pjsip_geolocation: Change some notices to debugs. (asterisk[18.15])

George Joseph asteriskteam at digium.com
Wed Sep 28 07:21:53 CDT 2022


George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/19384 )


Change subject: res_pjsip_geolocation: Change some notices to debugs.
......................................................................

res_pjsip_geolocation: Change some notices to debugs.

If geolocation is not in use for an endpoint, the NOTICE
log level is currently spammed with messages about this,
even though nothing is wrong and these messages provide
no real value. These log messages are therefore changed
to debugs.

ASTERISK-30241 #close

Change-Id: I656b355d812f67cc0f0fdf09b00b0e1458598bb4
(cherry picked from commit fb603e58b552c3d937a25bd81247298f1a548319)
---
M res/res_pjsip_geolocation.c
1 file changed, 33 insertions(+), 10 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/84/19384/1

diff --git a/res/res_pjsip_geolocation.c b/res/res_pjsip_geolocation.c
index d0e8d46..422c56d 100644
--- a/res/res_pjsip_geolocation.c
+++ b/res/res_pjsip_geolocation.c
@@ -145,7 +145,7 @@
 	char *geoloc_routing_hdr_value = NULL;
 	char *geoloc_uri = NULL;
 	int rc = 0;
-	RAII_VAR(struct ast_str *, buf, ast_str_create(1024), ast_free);
+	RAII_VAR(struct ast_str *, buf, NULL, ast_free);
 	pjsip_generic_string_hdr *geoloc_hdr = NULL;
 	pjsip_generic_string_hdr *geoloc_routing_hdr = NULL;
 	SCOPE_ENTER(3, "%s\n", session_name);
@@ -191,7 +191,7 @@
 				"Done.\n", session_name,
 				PJSTR_PRINTF_VAR(geoloc_hdr->hvalue));
 		} else {
-			SCOPE_EXIT_LOG_RTN_VALUE(0, LOG_NOTICE, "%s: Endpoint has no geoloc_incoming_call_profile. "
+			SCOPE_EXIT_RTN_VALUE(0, "%s: Endpoint has no geoloc_incoming_call_profile. "
 				"Done.\n", session_name);
 		}
 	}
@@ -209,6 +209,11 @@
 		}
 	}
 
+	buf = ast_str_create(1024);
+	if (!buf) {
+		SCOPE_EXIT_LOG_RTN_VALUE(0, LOG_WARNING, "%s: Unable to allocate buf\n", session_name);
+	}
+
 	if (config_profile->precedence != AST_GEOLOC_PRECED_DISCARD_CONFIG) {
 		config_eprofile = ast_geoloc_eprofile_create_from_profile(config_profile);
 		if (!config_eprofile) {
@@ -469,7 +474,7 @@
 	RAII_VAR(struct ast_geoloc_eprofile *, config_eprofile, NULL, ao2_cleanup);
 	RAII_VAR(struct ast_geoloc_eprofile *, incoming_eprofile, NULL, ao2_cleanup);
 	struct ast_geoloc_eprofile *final_eprofile = NULL;
-	RAII_VAR(struct ast_str *, buf, ast_str_create(1024), ast_free);
+	RAII_VAR(struct ast_str *, buf, NULL, ast_free);
 	struct ast_datastore *ds = NULL;  /* The channel cleans up ds */
 	pjsip_msg_body *orig_body = NULL;
 	pjsip_generic_string_hdr *geoloc_hdr = NULL;
@@ -478,11 +483,6 @@
 	const char *uri;
 	SCOPE_ENTER(3, "%s\n", session_name);
 
-	if (!buf) {
-		SCOPE_EXIT_LOG_RTN(LOG_WARNING, "%s: Unable to allocate buf\n",
-			session_name);
-	}
-
 	if (!endpoint) {
 		SCOPE_EXIT_LOG_RTN(LOG_WARNING, "%s: Session has no endpoint.  Skipping.\n",
 			session_name);
@@ -494,8 +494,8 @@
 	}
 
 	if (ast_strlen_zero(endpoint->geoloc_outgoing_call_profile)) {
-			SCOPE_EXIT_LOG_RTN(LOG_NOTICE, "%s: Endpoint has no geoloc_outgoing_call_profile. "
-				"Skipping.\n", session_name);
+		SCOPE_EXIT_RTN("%s: Endpoint has no geoloc_outgoing_call_profile. Skipping.\n",
+			session_name);
 	}
 
 	config_profile = ast_geoloc_get_profile(endpoint->geoloc_outgoing_call_profile);
@@ -578,6 +578,11 @@
 		ast_geoloc_eprofile_refresh_location(final_eprofile);
 	}
 
+	buf = ast_str_create(1024);
+	if (!buf) {
+		SCOPE_EXIT_LOG_RTN(LOG_WARNING, "%s: Unable to allocate buf\n", session_name);
+	}
+
 	if (final_eprofile->format == AST_GEOLOC_FORMAT_URI) {
 		uri = ast_geoloc_eprofile_to_uri(final_eprofile, channel, &buf, session_name);
 		if (!uri) {

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

Gerrit-Project: asterisk
Gerrit-Branch: 18.15
Gerrit-Change-Id: I656b355d812f67cc0f0fdf09b00b0e1458598bb4
Gerrit-Change-Number: 19384
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-CC: N A <mail at interlinked.x10host.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220928/b4b4a430/attachment-0001.html>


More information about the asterisk-code-review mailing list