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

George Joseph asteriskteam at digium.com
Mon Sep 26 06:55:36 CDT 2022


Attention is currently required from: N A.

George Joseph has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/19305 )

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


Patch Set 1: Code-Review-1

(7 comments)

File res/res_pjsip_geolocation.c:

https://gerrit.asterisk.org/c/asterisk/+/19305/comment/ef0627ac_fa62f6b6 
PS1, Line 148: 	RAII_VAR(struct ast_str *, buf, ast_str_create(1024), ast_free);
While you're in this module could you fix this as well?  I shouldn't be allocating the buffer here when 99% of the incoming invites won't need it.  

Change this to...
```
RAII_VAR(struct ast_str *, buf, NULL, ast_free);
```
and add the create below where indicated.  Thanks!


https://gerrit.asterisk.org/c/asterisk/+/19305/comment/bf22d8b1_9821f91c 
PS1, Line 194: 			SCOPE_EXIT_LOG_RTN_VALUE(0, LOG_DEBUG, "%s: Endpoint has no geoloc_incoming_call_profile. "
> Something odd here is if that if you use 1 instead 0, things behave as if an ast_channel_unref was forgotten somewhere.... actually what happens is the debug is executed but nothing ever happens on the channel afterwards and it gets "stuck" there.
> 
> 0 works fine, but then the debug ALWAYS gets outputted even if core debug level is 0, and I don't think that is appropriate either.
> 
> What I'm trying to do is the debug level with at least sub level 1.

If you return "1", res_pjsip_session:handle_incoming_request stops processing additional supplements which may explain that behavior. Also, all of the SCOPE_EXIT* macros automatically call ast_debug.

Instead, call SCOPE_EXIT_RTN_VALUE (no LOG).


https://gerrit.asterisk.org/c/asterisk/+/19305/comment/ad7c6737_c2fa097e 
PS1, Line 211: 
Insert here...

```
buf = ast_str_create(1024);
if (!buf) {
	SCOPE_EXIT_LOG_RTN_VALUE(0, LOG_WARNING, "%s: Unable to allocate buf\n");
}
```


https://gerrit.asterisk.org/c/asterisk/+/19305/comment/d76efef3_cfabe7d1 
PS1, Line 472: 	RAII_VAR(struct ast_str *, buf, ast_str_create(1024), ast_free);
Change here as well.


https://gerrit.asterisk.org/c/asterisk/+/19305/comment/a66f6e28_d9f10327 
PS1, Line 481: 	if (!buf) {
             : 		SCOPE_EXIT_LOG_RTN(LOG_WARNING, "%s: Unable to allocate buf\n",
             : 			session_name);
             : 	}
             : 
and move this below where indicated.


https://gerrit.asterisk.org/c/asterisk/+/19305/comment/e8159e95_a34f3cc6 
PS1, Line 497: SCOPE_EXIT_LOG_RTN
You can just all SCOPE_EXIT_RTN without the LOG.


https://gerrit.asterisk.org/c/asterisk/+/19305/comment/916109a6_99eefc6b 
PS1, Line 580: 
Add the ast_str_create and move the error check here.  Thanks!



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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I656b355d812f67cc0f0fdf09b00b0e1458598bb4
Gerrit-Change-Number: 19305
Gerrit-PatchSet: 1
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Attention: N A <mail at interlinked.x10host.com>
Gerrit-Comment-Date: Mon, 26 Sep 2022 11:55:36 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: N A <mail at interlinked.x10host.com>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220926/76b77638/attachment.html>


More information about the asterisk-code-review mailing list