diff options
author | citats <citats@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-09-07 14:51:20 +0000 |
---|---|---|
committer | citats <citats@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-09-07 14:51:20 +0000 |
commit | ba26d12600a512eed40c2579bb09648a536d2bd0 (patch) | |
tree | d83dd36a1ed0f426edde8da1a27da6ed22fb1c19 /pbx.c | |
parent | 80821335db31aaa124fa8b9426311ab48d44d4e4 (diff) |
Formatting cleanups
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3741 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx.c')
-rwxr-xr-x | pbx.c | 94 |
1 files changed, 47 insertions, 47 deletions
@@ -4508,55 +4508,55 @@ static int pbx_builtin_waitexten(struct ast_channel *chan, void *data) static int pbx_builtin_background(struct ast_channel *chan, void *data) { - int res = 0; - int option_skip = 0; - int option_noanswer = 0; - char filename[256] = ""; - char* stringp; - char* options; - char *lang = NULL; - - if (!data || ast_strlen_zero(data)) { - ast_log(LOG_WARNING, "Background requires an argument(filename)\n"); - return -1; - } + int res = 0; + int option_skip = 0; + int option_noanswer = 0; + char filename[256] = ""; + char* stringp; + char* options; + char *lang = NULL; - strncpy(filename, (char*)data, sizeof(filename) - 1); - stringp = filename; - strsep(&stringp, "|"); - options = strsep(&stringp, "|"); - if (options) - lang = strsep(&stringp, "|"); - if (!lang) - lang = chan->language; - - if (options && !strcasecmp(options, "skip")) - option_skip = 1; - if (options && !strcasecmp(options, "noanswer")) - option_noanswer = 1; - - /* Answer if need be */ - if (chan->_state != AST_STATE_UP) { - if (option_skip) { - return 0; - } else if (!option_noanswer) { - res = ast_answer(chan); - } - } + if (!data || ast_strlen_zero(data)) { + ast_log(LOG_WARNING, "Background requires an argument(filename)\n"); + return -1; + } - if (!res) { - /* Stop anything playing */ - ast_stopstream(chan); - /* Stream a file */ - res = ast_streamfile(chan, filename, lang); - if (!res) { - res = ast_waitstream(chan, AST_DIGIT_ANY); - ast_stopstream(chan); - } else { - ast_log(LOG_WARNING, "ast_streamfile failed on %s fro %s\n", chan->name, (char*)data); - res = 0; - } - } + strncpy(filename, (char*)data, sizeof(filename) - 1); + stringp = filename; + strsep(&stringp, "|"); + options = strsep(&stringp, "|"); + if (options) + lang = strsep(&stringp, "|"); + if (!lang) + lang = chan->language; + + if (options && !strcasecmp(options, "skip")) + option_skip = 1; + if (options && !strcasecmp(options, "noanswer")) + option_noanswer = 1; + + /* Answer if need be */ + if (chan->_state != AST_STATE_UP) { + if (option_skip) { + return 0; + } else if (!option_noanswer) { + res = ast_answer(chan); + } + } + + if (!res) { + /* Stop anything playing */ + ast_stopstream(chan); + /* Stream a file */ + res = ast_streamfile(chan, filename, lang); + if (!res) { + res = ast_waitstream(chan, AST_DIGIT_ANY); + ast_stopstream(chan); + } else { + ast_log(LOG_WARNING, "ast_streamfile failed on %s fro %s\n", chan->name, (char*)data); + res = 0; + } + } return res; } |