<p><a href="https://gerrit.asterisk.org/c/asterisk/+/11216">View Change</a></p><p>8 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/#/c/11216/1/channels/chan_pjsip.c">File channels/chan_pjsip.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/11216/1/channels/chan_pjsip.c@1909">Patch Set #1, Line 1909:</a> <code style="font-family:monospace,monospace"> if (!(session->channel) || !(chan = ast_channel_ref(session->channel))) {</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">To prevent the channel from being deleted by somebody else. […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Generally everything in regards to a session is expected to be queued up and executed on that session's taskprocessor in a serialized fashion. This limits the locking and also provides the serialized guarantee so things can be simpler.</p><p style="white-space: pre-wrap; word-wrap: break-word;">This function would need to do so to fit within that threading model, and guarantee that session is not manipulated at the same time.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/11216/1/channels/chan_pjsip.c@1906">Patch Set #1, Line 1906:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;">      if (!(session = (struct ast_sip_session *)pjsip_evsub_get_mod_data(sub, refer_callback_module.id))) {<br>         return;<br>       }<br>     if (!(session->channel) || !(chan = ast_channel_ref(session->channel))) {<br>               return;<br>       }<br></pre></blockquote></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">Would the following be more appropriate? […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Yes, except if (!session->channel) is fine</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/11216/1/channels/chan_pjsip.c@1919">Patch Set #1, Line 1919:</a> <code style="font-family:monospace,monospace">          ast_debug(3, "Transfer accepted\n");</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">Would it be better to remove the debug entirely or change it to ... […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Keeping debug is fine, but does need the channel like you've done</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/11216/1/channels/chan_pjsip.c@1933">Patch Set #1, Line 1933:</a> <code style="font-family:monospace,monospace">                              pjsip_evsub_terminate(sub, PJ_TRUE);</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">This code was based on the xfer_client_on_evsub_state() function in third-party/pjproject/source/pjs […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">I'd update the comment to make this clear.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/11216/1/channels/chan_pjsip.c@1976">Patch Set #1, Line 1976:</a> <code style="font-family:monospace,monospace">                      /* If the subscription is not terminated, terminate it now. */</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">Would something like the following be sufficient? […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Yes</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/11216/1/channels/chan_pjsip.c@1980">Patch Set #1, Line 1980:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;">                             status = pjsip_evsub_initiate(sub, pjsip_get_subscribe_method(), 0, &tdata);<br>                              if (status == PJ_SUCCESS) {<br>                                   pjsip_evsub_send_request(sub, tdata);<br>                         }<br></pre></blockquote></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">For clarification, do you want a comment before the status = pjsip_evsub_initiate line?</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">I believe I was referring to the comment before the xfer_client_on_evsub_state function itself.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/11216/1/channels/chan_pjsip.c@2011">Patch Set #1, Line 2011:</a> <code style="font-family:monospace,monospace">       xfer_cb.on_evsub_state = &xfer_client_on_evsub_state;</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Thinking about this some more - I think this now adds a hard dependency on res_pjsip_pubsub. What happens if that module is not loaded and things here are executed?</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/11216/1/channels/chan_pjsip.c@2020">Patch Set #1, Line 2020:</a> <code style="font-family:monospace,monospace">     pjsip_evsub_set_mod_data(sub, refer_callback_module.id, session);</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">The callback occurs as a result of a received SIP message. […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">What stops the session from going away in that case?</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/11216">change 11216</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/11216"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: If6c27c757c66f71e8b75e3fe49da53ebe62395dc </div>
<div style="display:none"> Gerrit-Change-Number: 11216 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Dan Cropp <dan@amtelco.com> </div>
<div style="display:none"> Gerrit-Reviewer: Dan Cropp <dan@amtelco.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: mattf <creslin@digium.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Mon, 13 May 2019 16:37:22 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Comment-In-Reply-To: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Comment-In-Reply-To: Dan Cropp <dan@amtelco.com> </div>
<div style="display:none"> Gerrit-MessageType: comment </div>