Formatting cleanups
authorJames Golovich <james@gnuinter.net>
Tue, 7 Sep 2004 14:51:20 +0000 (14:51 +0000)
committerJames Golovich <james@gnuinter.net>
Tue, 7 Sep 2004 14:51:20 +0000 (14:51 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3741 65c4cc65-6c06-0410-ace0-fbb531ad65f3

pbx.c

diff --git a/pbx.c b/pbx.c
index 5e05582..af85801 100755 (executable)
--- a/pbx.c
+++ b/pbx.c
@@ -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;
 }