<p>Julien Alie has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19040">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_mixmonitor: Close stream if playing beep failed<br><br>Currently, if beep was unable to play, an error code is returned but<br>file descriptor is not released/unloaded.<br><br>This fix makes sure to close the stream (and file) if an error occured<br>i.e: channel was already closed<br><br>ASTERISK-30198<br>Reported by: Julien Alie<br><br>Change-Id: Ib3e4994766f825d5de943c81331ff3c5c23fb189<br>---<br>M apps/app_mixmonitor.c<br>1 file changed, 24 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/40/19040/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c</span><br><span>index a0eb1db..1f9e720 100644</span><br><span>--- a/apps/app_mixmonitor.c</span><br><span>+++ b/apps/app_mixmonitor.c</span><br><span>@@ -815,7 +815,9 @@</span><br><span> </span><br><span> if (ast_test_flag(mixmonitor, MUXFLAG_BEEP_STOP)) {</span><br><span> ast_autochan_channel_lock(mixmonitor->autochan);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_stream_and_wait(mixmonitor->autochan->chan, "beep", "");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (ast_stream_and_wait(mixmonitor->autochan->chan, "beep", "") == -1) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_closestream(ast_channel_stream(mixmonitor->autochan->chan));</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> ast_autochan_channel_unlock(mixmonitor->autochan);</span><br><span> }</span><br><span> </span><br><span>@@ -893,7 +895,9 @@</span><br><span> </span><br><span> if (ast_test_flag(mixmonitor, MUXFLAG_BEEP_START)) {</span><br><span> ast_autochan_channel_lock(mixmonitor->autochan);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_stream_and_wait(mixmonitor->autochan->chan, "beep", "");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (ast_stream_and_wait(mixmonitor->autochan->chan, "beep", "") == -1) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_closestream(ast_channel_stream(mixmonitor->autochan->chan));</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> ast_autochan_channel_unlock(mixmonitor->autochan);</span><br><span> }</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19040">change 19040</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/+/19040"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 19.5 </div>
<div style="display:none"> Gerrit-Change-Id: Ib3e4994766f825d5de943c81331ff3c5c23fb189 </div>
<div style="display:none"> Gerrit-Change-Number: 19040 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Julien Alie <jalie@wazo.io> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>