From: Joshua Colp Date: Mon, 13 Feb 2012 16:41:56 +0000 (+0000) Subject: Don't try to play sound files that do not exist. X-Git-Tag: 10.3.0-rc1~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6dde382e1dc22fea6030b577535cf499b9c8a2e6;p=thirdparty%2Fasterisk.git Don't try to play sound files that do not exist. (closes issue ASTERISK-19188) Reported by: slesru git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@354938 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c index 15ed907893..6c3f4304d0 100644 --- a/apps/app_confbridge.c +++ b/apps/app_confbridge.c @@ -610,7 +610,7 @@ static int announce_user_count(struct conference_bridge *conference_bridge, stru "")) { return -1; } - } else { + } else if (ast_fileexists(there_are, NULL, NULL) && ast_fileexists(other_in_party, NULL, NULL)) { play_sound_file(conference_bridge, there_are); play_sound_number(conference_bridge, conference_bridge->users - 1); play_sound_file(conference_bridge, other_in_party); @@ -1143,6 +1143,12 @@ 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); + return 0; + } + ast_mutex_lock(&conference_bridge->playback_lock); if (!(conference_bridge->playback_chan)) { if (alloc_playback_chan(conference_bridge)) {