diff options
author | Luigi Rizzo <rizzo@icir.org> | 2006-04-21 20:28:32 +0000 |
---|---|---|
committer | Luigi Rizzo <rizzo@icir.org> | 2006-04-21 20:28:32 +0000 |
commit | 7e0d402e8841a86ebe86442a2b972f497c10e975 (patch) | |
tree | afa0bc4a9718214b473e0ee1a40981e66fbeb85d /file.c | |
parent | 5fa0dc431620d4c8d36a72c87106366aeee6818c (diff) |
move wait_and_stream to ast_wait_and_stream() because equivalent
code is replicated in way too many places not to have a global
function for that.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@22075 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -1101,6 +1101,23 @@ int ast_waitstream_exten(struct ast_channel *c, const char *context) -1, -1, context); } +/* + * if the file name is non-empty, try to play it. + * Return 0 if success, -1 if error, digit if interrupted by a digit. + * If digits == "" then we can simply check for non-zero. + */ +int ast_stream_and_wait(struct ast_channel *chan, const char *file, + const char *language, const char *digits) +{ + int res = 0; + if (!ast_strlen_zero(file)) { + res = ast_streamfile(chan, file, language); + if (!res) + res = ast_waitstream(chan, digits); + } + return res; +} + static int show_file_formats(int fd, int argc, char *argv[]) { #define FORMAT "%-10s %-10s %-20s\n" |