Doxygen documentation update from oej (issue #5505)
[asterisk/asterisk.git] / apps / app_muxmon.c
index c389353..419e951 100755 (executable)
@@ -1,7 +1,6 @@
 /*
  * Asterisk -- A telephony toolkit for Linux.
  *
- * muxmon Application For Asterisk
  *
  * Copyright (C) 2005, Anthony Minessale II
  *
  * the GNU General Public License
  */
 
+/*! \file
+ * \brief muxmon() - record a call natively
+ */
+
 #include <asterisk/file.h>
 #include <asterisk/logger.h>
 #include <asterisk/channel.h>
@@ -382,34 +385,36 @@ static int muxmon_exec(struct ast_channel *chan, void *data)
                *filename = NULL,
                *post_process = NULL;
        
-       if (!data) {
+       if (!data || ast_strlen_zero(data)) {
                ast_log(LOG_WARNING, "muxmon requires an argument\n");
                return -1;
        }
 
-       if (!(args = ast_strdupa(data))) {
+       LOCAL_USER_ADD(u);
+
+       args = ast_strdupa(data);       
+       if (!args) {
                ast_log(LOG_WARNING, "Memory Error!\n");
-        return -1;
+               LOCAL_USER_REMOVE(u);
+               return -1;
        }
-       
 
        if ((argc = ast_separate_app_args(args, '|', argv, sizeof(argv) / sizeof(argv[0])))) {
                filename = argv[0];
-               if ( argc > 1) {
+               if (argc > 1) {
                        options = argv[1];
                }
-               if ( argc > 2) {
+               if (argc > 2) {
                        post_process = argv[2];
                }
        }
        
        if (!filename || ast_strlen_zero(filename)) {
                ast_log(LOG_WARNING, "Muxmon requires an argument (filename)\n");
-        return -1;
+               LOCAL_USER_REMOVE(u);
+               return -1;
        }
 
-       LOCAL_USER_ADD(u);
-
        if (options) {
                char *opts[3] = {};
                ast_parseoptions(muxmon_opts, &flags, opts, options);
@@ -440,13 +445,13 @@ static int muxmon_exec(struct ast_channel *chan, void *data)
                        else {
                                readvol = writevol = minmax(x, 4);
                                x = get_volfactor(readvol);
-                readvol = minmax(x, 16);
+                               readvol = minmax(x, 16);
                                x = get_volfactor(writevol);
-                writevol = minmax(x, 16);
+                               writevol = minmax(x, 16);
                        }
                }
        }
-               pbx_builtin_setvar_helper(chan, "MUXMON_FILENAME", filename);
+       pbx_builtin_setvar_helper(chan, "MUXMON_FILENAME", filename);
        launch_monitor_thread(chan, filename, flags.flags, readvol, writevol, post_process);
 
        LOCAL_USER_REMOVE(u);