diff options
author | Matthew Jordan <mjordan@digium.com> | 2012-05-24 13:33:53 +0000 |
---|---|---|
committer | Matthew Jordan <mjordan@digium.com> | 2012-05-24 13:33:53 +0000 |
commit | 66754b3f3d8ad6fe59b8971f954803de65c69e26 (patch) | |
tree | 9f63a1c9e85f55f30a9d3327cf89e8afaa86b6d1 | |
parent | 8de31699d89c6ffaf36c4cccb880a02429726b29 (diff) |
Fix crash in ConfBridge when user announcement is played for more than 2 users
A patch introduced in r354938 made it so that ConfBridge would not attempt to
play sound files if those files did not exist. Unfortunately, ConfBridge uses
the same underlying function, play_sound_helper, to playback both sound files
and numbers to callers. When a number is being played back, the name of the
sound file is expected to be NULL. This NULL value was passed into a function
that tested for the existance of a sound file and is not tolerant to NULL
file names, causing a crash.
This patch fixes the behavior, such that if a sound file does not exist we
do not attempt to play it, but we only attempt that check if the a sound file
was specified in the first place. If a sound file was not specified, we use
the 'play number' logic in the helper function.
(closes issue ASTERISK-19899)
Reported by: Florian Gilcher
Tested by: Florian Gilcher
patches:
asterisk-19899.diff uploaded by mjordan (license 6283)
........
Merged revisions 367562 from http://svn.asterisk.org/svn/asterisk/branches/10
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@367563 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | apps/app_confbridge.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c index 2e7d8fcc7..88c85a165 100644 --- a/apps/app_confbridge.c +++ b/apps/app_confbridge.c @@ -1159,8 +1159,8 @@ static int play_sound_helper(struct conference_bridge *conference_bridge, const struct ast_channel *underlying_channel; /* Do not waste resources trying to play files that do not exist */ - if (!ast_fileexists(filename, NULL, NULL)) { - ast_log(LOG_WARNING, "File %s does not exist in any format\n", filename); + if (!ast_strlen_zero(filename) && !ast_fileexists(filename, NULL, NULL)) { + ast_log(LOG_WARNING, "File %s does not exist in any format\n", !ast_strlen_zero(filename) ? filename : "<unknown>"); return 0; } @@ -1180,7 +1180,7 @@ static int play_sound_helper(struct conference_bridge *conference_bridge, const /* The channel is all under our control, in goes the prompt */ if (!ast_strlen_zero(filename)) { ast_stream_and_wait(conference_bridge->playback_chan, filename, ""); - } else { + } else if (say_number >= 0) { ast_say_number(conference_bridge->playback_chan, say_number, "", ast_channel_language(conference_bridge->playback_chan), NULL); } @@ -1203,7 +1203,7 @@ static int play_sound_helper(struct conference_bridge *conference_bridge, const */ static int play_sound_file(struct conference_bridge *conference_bridge, const char *filename) { - return play_sound_helper(conference_bridge, filename, 0); + return play_sound_helper(conference_bridge, filename, -1); } /*! |