[Asterisk-code-review] app_mixmonitor: Close stream if playing beep failed (asterisk[19.5])
Julien Alie
asteriskteam at digium.com
Wed Aug 31 12:12:39 CDT 2022
Julien Alie has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/19040 )
Change subject: app_mixmonitor: Close stream if playing beep failed
......................................................................
app_mixmonitor: Close stream if playing beep failed
Currently, if beep was unable to play, an error code is returned but
file descriptor is not released/unloaded.
This fix makes sure to close the stream (and file) if an error occured
i.e: channel was already closed
ASTERISK-30198
Reported by: Julien Alie
Change-Id: Ib3e4994766f825d5de943c81331ff3c5c23fb189
---
M apps/app_mixmonitor.c
1 file changed, 24 insertions(+), 2 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/40/19040/1
diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c
index a0eb1db..1f9e720 100644
--- a/apps/app_mixmonitor.c
+++ b/apps/app_mixmonitor.c
@@ -815,7 +815,9 @@
if (ast_test_flag(mixmonitor, MUXFLAG_BEEP_STOP)) {
ast_autochan_channel_lock(mixmonitor->autochan);
- ast_stream_and_wait(mixmonitor->autochan->chan, "beep", "");
+ if (ast_stream_and_wait(mixmonitor->autochan->chan, "beep", "") == -1) {
+ ast_closestream(ast_channel_stream(mixmonitor->autochan->chan));
+ }
ast_autochan_channel_unlock(mixmonitor->autochan);
}
@@ -893,7 +895,9 @@
if (ast_test_flag(mixmonitor, MUXFLAG_BEEP_START)) {
ast_autochan_channel_lock(mixmonitor->autochan);
- ast_stream_and_wait(mixmonitor->autochan->chan, "beep", "");
+ if (ast_stream_and_wait(mixmonitor->autochan->chan, "beep", "") == -1) {
+ ast_closestream(ast_channel_stream(mixmonitor->autochan->chan));
+ }
ast_autochan_channel_unlock(mixmonitor->autochan);
}
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19040
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 19.5
Gerrit-Change-Id: Ib3e4994766f825d5de943c81331ff3c5c23fb189
Gerrit-Change-Number: 19040
Gerrit-PatchSet: 1
Gerrit-Owner: Julien Alie <jalie at wazo.io>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220831/ff832d84/attachment.html>
More information about the asterisk-code-review
mailing list