remove more unnecessary casts for NULL.
[asterisk/asterisk.git] / apps / app_dictate.c
index c501b3f..58d6111 100644 (file)
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
 #include <sys/stat.h>
 
+#include "asterisk/paths.h"    /* use ast_config_AST_SPOOL_DIR */
 #include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/channel.h"
 #include "asterisk/pbx.h"
 #include "asterisk/module.h"
 #include "asterisk/say.h"
-#include "asterisk/lock.h"
 #include "asterisk/app.h"
 
 static char *app = "Dictate";
 static char *synopsis = "Virtual Dictation Machine";
-static char *desc = "  Dictate([<base_dir>[|<filename>]])\n"
+static char *desc = "  Dictate([<base_dir>[,<filename>]])\n"
 "Start dictation machine using optional base dir for files.\n";
 
 
@@ -89,7 +83,6 @@ static int dictate_exec(struct ast_channel *chan, void *data)
        struct ast_flags flags = {0};
        struct ast_filestream *fs;
        struct ast_frame *f = NULL;
-       struct ast_module_user *u;
        int ffactor = 320 * 80,
                res = 0,
                done = 0,
@@ -101,8 +94,6 @@ static int dictate_exec(struct ast_channel *chan, void *data)
                len = 0,
                maxlen = 0,
                mode = 0;
-               
-       u = ast_module_user_add(chan);
        
        snprintf(dftbase, sizeof(dftbase), "%s/dictate", ast_config_AST_SPOOL_DIR);
        if (!ast_strlen_zero(data)) {
@@ -122,7 +113,6 @@ static int dictate_exec(struct ast_channel *chan, void *data)
        oldr = chan->readformat;
        if ((res = ast_set_read_format(chan, AST_FORMAT_SLINEAR)) < 0) {
                ast_log(LOG_WARNING, "Unable to set to linear mode.\n");
-               ast_module_user_remove(u);
                return -1;
        }
 
@@ -139,7 +129,7 @@ static int dictate_exec(struct ast_channel *chan, void *data)
                        ast_copy_string(filein, filename, sizeof(filein));
                        filename = "";
                }
-               mkdir(base, 0755);
+               ast_mkdir(base, 0755);
                len = strlen(base) + strlen(filein) + 2;
                if (!path || len > maxlen) {
                        path = alloca(len);
@@ -180,7 +170,7 @@ static int dictate_exec(struct ast_channel *chan, void *data)
                                                if (speed > 4) {
                                                        speed = 1;
                                                }
-                                               res = ast_say_number(chan, speed, AST_DIGIT_ANY, chan->language, (char *) NULL);
+                                               res = ast_say_number(chan, speed, AST_DIGIT_ANY, chan->language, NULL);
                                                break;
                                        case '7':
                                                samples -= ffactor;
@@ -330,7 +320,6 @@ static int dictate_exec(struct ast_channel *chan, void *data)
        if (oldr) {
                ast_set_read_format(chan, oldr);
        }
-       ast_module_user_remove(u);
        return 0;
 }