[Asterisk-code-review] chan sip: 3PCC patch for AMI "SIPnotify" (asterisk[master])

Corey Farrell asteriskteam at digium.com
Wed Dec 6 22:13:44 CST 2017


Corey Farrell has posted comments on this change. ( https://gerrit.asterisk.org/7461 )

Change subject: chan_sip: 3PCC patch for AMI "SIPnotify"
......................................................................


Patch Set 2:

(7 comments)

Not technically required on master but I'd prefer to see a test added for this new feature.  The testsuite already has a couple existing SIPnotify tests [1].

[1] https://github.com/asterisk/testsuite/tree/master/tests/channels/SIP/ami/sip_notify

https://gerrit.asterisk.org/#/c/7461/2/channels/chan_sip.c
File channels/chan_sip.c:

https://gerrit.asterisk.org/#/c/7461/2/channels/chan_sip.c@15593
PS2, Line 15593: 	struct ast_variable *vars = astman_get_variables_order(m, ORDER_NATURAL);
"vars" is poorly handled in this function (even prior to your patch).
* At the beginning of the function we should check for vars == NULL, error out if found.
* ast_variables_destroy(vars); should be called before every return, none of the error conditions have it.


https://gerrit.asterisk.org/#/c/7461/2/channels/chan_sip.c@15607
PS2, Line 15607: 	// check if Call-ID variable is set
/* Please use this style comments. */


https://gerrit.asterisk.org/#/c/7461/2/channels/chan_sip.c@15608
PS2, Line 15608: 	for (var = vars; var; var = var->next) {
Instead of the loop you should use astman_get_header to retrieve a specific variable.


https://gerrit.asterisk.org/#/c/7461/2/channels/chan_sip.c@15614
PS2, Line 15614: 			p = ao2_find(dialogs, &tmp_dialog, OBJ_POINTER);
This would leak if someone sent multiple "Call-ID" headers.


https://gerrit.asterisk.org/#/c/7461/2/channels/chan_sip.c@15650
PS2, Line 15650: 	  p->notify->headers = header = ast_variable_new("Subscription-State", "terminated", "");
Tab indent.


https://gerrit.asterisk.org/#/c/7461/2/channels/chan_sip.c@15661
PS2, Line 15661: 			// do nothing here
/**/


https://gerrit.asterisk.org/#/c/7461/2/channels/chan_sip.c@15679
PS2, Line 15679: 		transmit_invite(p, SIP_NOTIFY, 0, 1, NULL);
This branch leaks p.  Definitely need a dialog_unref, probably sip_scheddestroy.



-- 
To view, visit https://gerrit.asterisk.org/7461
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I5797ded4752acd966db6b13971284db684cc5ab4
Gerrit-Change-Number: 7461
Gerrit-PatchSet: 2
Gerrit-Owner: Yasuhiko Kamata <yasuhiko.kamata at nxtg.co.jp>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Comment-Date: Thu, 07 Dec 2017 04:13:44 +0000
Gerrit-HasComments: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171206/e6933e32/attachment.html>


More information about the asterisk-code-review mailing list