Applications no longer need to call ast_module_user_add and ast_module_user_remove...
[asterisk/asterisk.git] / apps / app_ices.c
index 5829231..fe900ef 100644 (file)
@@ -103,8 +103,7 @@ static int icesencode(char *filename, int fd)
 
 static int ices_exec(struct ast_channel *chan, void *data)
 {
-       int res=0;
-       struct ast_module_user *u;
+       int res = 0;
        int fds[2];
        int ms = -1;
        int pid = -1;
@@ -119,14 +118,11 @@ static int ices_exec(struct ast_channel *chan, void *data)
                ast_log(LOG_WARNING, "ICES requires an argument (configfile.xml)\n");
                return -1;
        }
-
-       u = ast_module_user_add(chan);
        
        last = ast_tv(0, 0);
        
        if (pipe(fds)) {
                ast_log(LOG_WARNING, "Unable to create pipe\n");
-               ast_module_user_remove(u);
                return -1;
        }
        flags = fcntl(fds[1], F_GETFL);
@@ -141,7 +137,6 @@ static int ices_exec(struct ast_channel *chan, void *data)
                close(fds[0]);
                close(fds[1]);
                ast_log(LOG_WARNING, "Answer failed!\n");
-               ast_module_user_remove(u);
                return -1;
        }
 
@@ -151,7 +146,6 @@ static int ices_exec(struct ast_channel *chan, void *data)
                close(fds[0]);
                close(fds[1]);
                ast_log(LOG_WARNING, "Unable to set write format to signed linear\n");
-               ast_module_user_remove(u);
                return -1;
        }
        if (((char *)data)[0] == '/')
@@ -170,15 +164,13 @@ static int ices_exec(struct ast_channel *chan, void *data)
                        /* Wait for audio, and stream */
                        ms = ast_waitfor(chan, -1);
                        if (ms < 0) {
-                               if (option_debug)
-                                       ast_log(LOG_DEBUG, "Hangup detected\n");
+                               ast_debug(1, "Hangup detected\n");
                                res = -1;
                                break;
                        }
                        f = ast_read(chan);
                        if (!f) {
-                               if (option_debug)
-                                       ast_log(LOG_DEBUG, "Null frame == hangup() detected\n");
+                               ast_debug(1, "Null frame == hangup() detected\n");
                                res = -1;
                                break;
                        }
@@ -203,20 +195,12 @@ static int ices_exec(struct ast_channel *chan, void *data)
        if (!res && oreadformat)
                ast_set_read_format(chan, oreadformat);
 
-       ast_module_user_remove(u);
-
        return res;
 }
 
 static int unload_module(void)
 {
-       int res;
-
-       res = ast_unregister_application(app);
-
-       ast_module_user_hangup_all();
-
-       return res;
+       return ast_unregister_application(app);
 }
 
 static int load_module(void)