<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14460">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_fax: Don't start a gateway if either channel is hung up<br><br>If a channel is hung up when the fax_gateway_framehook is called<br>and a gateway hasn't already been started, a segfault will occur<br>when the framehook tries to get the t38 state.<br><br>* Added a check of hangup cause for both the channel and peer<br> channel before starting a fax gateway.<br><br>* Added a check for NULL channel tech to chan_pjsip_queryoption<br> so we don't attempt to reference a channel tech that's already<br> gone.<br><br>ASTERISK-28923<br>Reported by: Yury Kirsanov<br><br>Change-Id: I4e10e63b667bbb68c1c8623f977488f5d807897c<br>---<br>M channels/chan_pjsip.c<br>M res/res_fax.c<br>2 files changed, 15 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/60/14460/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c</span><br><span>index 79e7c6e..74392c4 100644</span><br><span>--- a/channels/chan_pjsip.c</span><br><span>+++ b/channels/chan_pjsip.c</span><br><span>@@ -1116,14 +1116,17 @@</span><br><span> static int chan_pjsip_queryoption(struct ast_channel *ast, int option, void *data, int *datalen)</span><br><span> {</span><br><span> struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(ast);</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_sip_session *session = channel->session;</span><br><span> int res = -1;</span><br><span> enum ast_t38_state state = T38_STATE_UNAVAILABLE;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ if (!channel) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return -1;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> switch (option) {</span><br><span> case AST_OPTION_T38_STATE:</span><br><span style="color: hsl(0, 100%, 40%);">- if (session->endpoint->media.t38.enabled) {</span><br><span style="color: hsl(0, 100%, 40%);">- switch (session->t38state) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (channel->session->endpoint->media.t38.enabled) {</span><br><span style="color: hsl(120, 100%, 40%);">+ switch (channel->session->t38state) {</span><br><span> case T38_LOCAL_REINVITE:</span><br><span> case T38_PEER_REINVITE:</span><br><span> state = T38_STATE_NEGOTIATING;</span><br><span>diff --git a/res/res_fax.c b/res/res_fax.c</span><br><span>index 1b51dbf..45684c7 100644</span><br><span>--- a/res/res_fax.c</span><br><span>+++ b/res/res_fax.c</span><br><span>@@ -3442,6 +3442,15 @@</span><br><span> if (!gateway->bridged) {</span><br><span> enum ast_t38_state state_chan;</span><br><span> enum ast_t38_state state_peer;</span><br><span style="color: hsl(120, 100%, 40%);">+ int hangupcause_chan;</span><br><span style="color: hsl(120, 100%, 40%);">+ int hangupcause_peer;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ hangupcause_chan = ast_channel_hangupcause(chan);</span><br><span style="color: hsl(120, 100%, 40%);">+ hangupcause_peer = ast_channel_hangupcause(peer);</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Don't start a gateway if either channel is hung up */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (hangupcause_chan > 0 || hangupcause_peer > 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return f;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> </span><br><span> ast_channel_unlock(chan);</span><br><span> state_chan = ast_channel_get_t38_state(chan);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14460">change 14460</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/+/14460"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-Change-Id: I4e10e63b667bbb68c1c8623f977488f5d807897c </div>
<div style="display:none"> Gerrit-Change-Number: 14460 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>