<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/9335">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
George Joseph: Looks good to me, approved
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_t38.c: Be smarter about how we respond when T.38 is disabled.<br><br>We were blindly responding with AST_T38_REFUSED when ANY T.38 control<br>frame came accross the bridge. This causes T.38 Gateway to get confused<br>and the T.38 session to get in a strange state.<br><br>* Made the T.38 framehook only respond to request frames and ignore<br>response frames.<br><br>ASTERISK-27657<br>ASTERISK-27080<br><br>Change-Id: I5fb5967c7d1efb30a7ff375f82887ca82a55b05b<br>---<br>M res/res_pjsip_t38.c<br>1 file changed, 31 insertions(+), 10 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_pjsip_t38.c b/res/res_pjsip_t38.c</span><br><span>index 3f4110f..6efe0d7 100644</span><br><span>--- a/res/res_pjsip_t38.c</span><br><span>+++ b/res/res_pjsip_t38.c</span><br><span>@@ -507,21 +507,42 @@</span><br><span> return f;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (f->frametype == AST_FRAME_CONTROL && f->subclass.integer == AST_CONTROL_T38_PARAMETERS) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (f->frametype == AST_FRAME_CONTROL</span><br><span style="color: hsl(120, 100%, 40%);">+ && f->subclass.integer == AST_CONTROL_T38_PARAMETERS) {</span><br><span> if (channel->session->endpoint->media.t38.enabled) {</span><br><span style="color: hsl(0, 100%, 40%);">- struct t38_parameters_task_data *data = t38_parameters_task_data_alloc(channel->session, f);</span><br><span style="color: hsl(120, 100%, 40%);">+ struct t38_parameters_task_data *data;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!data) {</span><br><span style="color: hsl(0, 100%, 40%);">- return f;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_sip_push_task(channel->session->serializer, t38_interpret_parameters, data)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ data = t38_parameters_task_data_alloc(channel->session, f);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (data</span><br><span style="color: hsl(120, 100%, 40%);">+ && ast_sip_push_task(channel->session->serializer,</span><br><span style="color: hsl(120, 100%, 40%);">+ t38_interpret_parameters, data)) {</span><br><span> ao2_ref(data, -1);</span><br><span> }</span><br><span> } else {</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_control_t38_parameters parameters = { .request_response = AST_T38_REFUSED, };</span><br><span style="color: hsl(0, 100%, 40%);">- ast_debug(2, "T.38 support not enabled, rejecting T.38 control packet\n");</span><br><span style="color: hsl(0, 100%, 40%);">- ast_queue_control_data(chan, AST_CONTROL_T38_PARAMETERS, ¶meters, sizeof(parameters));</span><br><span style="color: hsl(120, 100%, 40%);">+ static const struct ast_control_t38_parameters rsp_refused = {</span><br><span style="color: hsl(120, 100%, 40%);">+ .request_response = AST_T38_REFUSED,</span><br><span style="color: hsl(120, 100%, 40%);">+ };</span><br><span style="color: hsl(120, 100%, 40%);">+ static const struct ast_control_t38_parameters rsp_terminated = {</span><br><span style="color: hsl(120, 100%, 40%);">+ .request_response = AST_T38_TERMINATED,</span><br><span style="color: hsl(120, 100%, 40%);">+ };</span><br><span style="color: hsl(120, 100%, 40%);">+ const struct ast_control_t38_parameters *parameters = f->data.ptr;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ switch (parameters->request_response) {</span><br><span style="color: hsl(120, 100%, 40%);">+ case AST_T38_REQUEST_NEGOTIATE:</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_debug(2, "T.38 support not enabled on %s, refusing T.38 negotiation\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_channel_name(chan));</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_queue_control_data(chan, AST_CONTROL_T38_PARAMETERS,</span><br><span style="color: hsl(120, 100%, 40%);">+ &rsp_refused, sizeof(rsp_refused));</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ case AST_T38_REQUEST_TERMINATE:</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_debug(2, "T.38 support not enabled on %s, 'terminating' T.38 session\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_channel_name(chan));</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_queue_control_data(chan, AST_CONTROL_T38_PARAMETERS,</span><br><span style="color: hsl(120, 100%, 40%);">+ &rsp_terminated, sizeof(rsp_terminated));</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ default:</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> }</span><br><span> }</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9335">change 9335</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/9335"/><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-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I5fb5967c7d1efb30a7ff375f82887ca82a55b05b </div>
<div style="display:none"> Gerrit-Change-Number: 9335 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>