From: Naveen Albert Date: Mon, 19 Sep 2022 17:35:40 +0000 (+0000) Subject: res_pjsip_geolocation: Change some notices to debugs. X-Git-Tag: 18.15.0-rc2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7d7165ded183925cc847ca8f5c5034b8e6f981aa;p=thirdparty%2Fasterisk.git 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) --- diff --git a/res/res_pjsip_geolocation.c b/res/res_pjsip_geolocation.c index d0e8d465d3..422c56d5f9 100644 --- a/res/res_pjsip_geolocation.c +++ b/res/res_pjsip_geolocation.c @@ -145,7 +145,7 @@ static int handle_incoming_request(struct ast_sip_session *session, struct pjsip 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 @@ static int handle_incoming_request(struct ast_sip_session *session, struct pjsip "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 @@ static int handle_incoming_request(struct ast_sip_session *session, struct pjsip } } + 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 @@ static void handle_outgoing_request(struct ast_sip_session *session, struct pjsi 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 @@ static void handle_outgoing_request(struct ast_sip_session *session, struct pjsi 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 @@ static void handle_outgoing_request(struct ast_sip_session *session, struct pjsi } 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 @@ static void handle_outgoing_request(struct ast_sip_session *session, struct pjsi 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) {