diff options
author | rizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-04-21 20:28:32 +0000 |
---|---|---|
committer | rizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-04-21 20:28:32 +0000 |
commit | fd45704e44c7607442a4c4f7f3ad15a703e2841e (patch) | |
tree | afa0bc4a9718214b473e0ee1a40981e66fbeb85d /file.c | |
parent | 6c864f19d698a93c0b6242c63bb6ac61111a68b3 (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: http://svn.digium.com/svn/asterisk/trunk@22075 f38db490-d61c-443f-a65b-d21fe96a405b
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" |