[Asterisk-code-review] res pjsip notify.c: enable in-dialog NOTIFY (asterisk[15])

Joshua Colp asteriskteam at digium.com
Wed Mar 21 05:34:07 CDT 2018


Joshua Colp has posted comments on this change. ( https://gerrit.asterisk.org/8374 )

Change subject: res_pjsip_notify.c: enable in-dialog NOTIFY
......................................................................


Patch Set 8: Code-Review-1

(1 comment)

https://gerrit.asterisk.org/#/c/8374/8/res/res_pjsip_notify.c
File res/res_pjsip_notify.c:

https://gerrit.asterisk.org/#/c/8374/8/res/res_pjsip_notify.c@847
PS8, Line 847: 	ast_channel_lock(ch);
             : 	dlg = ast_sip_session_get_dialog_for_channel(ch);
             : 	ast_channel_unlock(ch);
             : 
             : 	if (!dlg) {
             : 		ast_channel_unref(ch);
             : 		ast_log(LOG_NOTICE, "No active dialog for channel %s\n", channel_name);
             : 		return INVALID_CHANNEL;
             : 	}
             : 
             : 	/* ast_sip_dialog_get_session needs a lock on the dlg */
             : 	pjsip_dlg_inc_lock(dlg);
             : 	session = ast_sip_dialog_get_session(dlg);
             : 	pjsip_dlg_dec_lock(dlg);
Looking at this deeper and looking at what we make publicly available you can use the same method as chan_pjsip uses to get the session from the channel, which removes the addition of ast_sip_dialog_get_session and the messing with the dialog.

Provided the channel is locked like you did:

struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(chan);

And then channel->session will contain the session.



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

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: comment
Gerrit-Change-Id: If7f3151a6d633e414d5dc319d5efc1443c43dd29
Gerrit-Change-Number: 8374
Gerrit-PatchSet: 8
Gerrit-Owner: Nathan Bruning <nathan at iperity.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: lvl <digium at lvlconsultancy.nl>
Gerrit-Comment-Date: Wed, 21 Mar 2018 10:34:07 +0000
Gerrit-HasComments: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180321/f767b352/attachment-0001.html>


More information about the asterisk-code-review mailing list