From: Mark Michelson Date: Fri, 21 May 2010 20:59:14 +0000 (+0000) Subject: Don't hang up on a queue caller if the file we attempt to play does not exist. X-Git-Tag: 1.4.33-rc1~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ed585b5bb3e4dfa2447f2be8026459a2ab0f598b;p=thirdparty%2Fasterisk.git Don't hang up on a queue caller if the file we attempt to play does not exist. This also fixes a documentation mistake in file.h that made my original attempt to correct this problem not work correctly. (closes issue #17061) Reported by: RoadKill git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@265089 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/apps/app_queue.c b/apps/app_queue.c index 4497e125fd..1fc6201f3f 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -1532,6 +1532,10 @@ static int play_file(struct ast_channel *chan, char *filename) return 0; } + if (!ast_fileexists(filename, NULL, chan->language)) { + return 0; + } + ast_stopstream(chan); res = ast_streamfile(chan, filename, chan->language); diff --git a/include/asterisk/file.h b/include/asterisk/file.h index 4b8c8fad95..1518d209d9 100644 --- a/include/asterisk/file.h +++ b/include/asterisk/file.h @@ -199,7 +199,7 @@ int ast_stopstream(struct ast_channel *c); * \param fmt the format you wish to check (the extension) * \param preflang (the preferred language you wisht to find the file in) * See if a given file exists in a given format. If fmt is NULL, any format is accepted. - * Returns -1 if file does not exist, non-zero positive otherwise. + * Returns 0 if file does not exist, non-zero positive otherwise. */ int ast_fileexists(const char *filename, const char *fmt, const char *preflang);