Remove AST_PBX_KEEPALIVE usage from res_agi.
[asterisk/asterisk.git] / res / res_agi.c
index bda3e79..151ac1a 100644 (file)
@@ -687,7 +687,7 @@ static enum agi_result launch_asyncagi(struct ast_channel *chan, char *argv[], i
                        /* OK, we have a command, let's call the
                           command handler. */
                        res = agi_handle_command(chan, &async_agi, cmd->cmd_buffer, 0);
-                       if ((res < 0) || (res == AST_PBX_KEEPALIVE)) {
+                       if (res < 0) {
                                free_agi_cmd(cmd);
                                break;
                        }
@@ -2229,12 +2229,6 @@ static int handle_speechrecognize(struct ast_channel *chan, AGI *agi, int argc,
        return RESULT_SUCCESS;
 }
 
-static int handle_asyncagi_break(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
-{
-       ast_agi_send(agi->fd, chan, "200 result=0\n");
-       return AST_PBX_KEEPALIVE;
-}
-
 static char usage_verbose[] =
 " Usage: VERBOSE <message> <level>\n"
 "      Sends <message> to the console via verbose message system.\n"
@@ -2395,10 +2389,6 @@ static char usage_autohangup[] =
 " future.  Of course it can be hungup before then as well. Setting to 0 will\n"
 " cause the autohangup feature to be disabled on this channel.\n";
 
-static char usage_break_aagi[] =
-" Usage: ASYNCAGI BREAK\n"
-"      Break the Async AGI loop.\n";
-
 static char usage_speechcreate[] =
 " Usage: SPEECH CREATE <engine>\n"
 "       Create a speech object to be used by the other Speech AGI commands.\n";
@@ -2480,7 +2470,6 @@ static struct agi_command commands[] = {
        { { "speech", "activate", "grammar", NULL }, handle_speechactivategrammar, "Activates a grammar", usage_speechactivategrammar, 0 },
        { { "speech", "deactivate", "grammar", NULL }, handle_speechdeactivategrammar, "Deactivates a grammar", usage_speechdeactivategrammar, 0 },
        { { "speech", "recognize", NULL }, handle_speechrecognize, "Recognizes speech", usage_speechrecognize, 0 },
-       { { "asyncagi", "break", NULL }, handle_asyncagi_break, "Break AsyncAGI loop", usage_break_aagi, 0 },
 };
 
 static AST_RWLIST_HEAD_STATIC(agi_commands, agi_command);
@@ -2751,7 +2740,6 @@ static int agi_handle_command(struct ast_channel *chan, AGI *agi, char *buf, int
                        ast_module_unref(c->mod);
                switch (res) {
                case RESULT_SHOWUSAGE: ami_res = "Usage"; resultcode = 520; break;
-               case AST_PBX_KEEPALIVE: ami_res = "KeepAlive"; resultcode = 210; break;
                case RESULT_FAILURE: ami_res = "Failure"; resultcode = -1; break;
                case RESULT_SUCCESS: ami_res = "Success"; resultcode = 200; break;
                }
@@ -2768,10 +2756,6 @@ static int agi_handle_command(struct ast_channel *chan, AGI *agi, char *buf, int
                        ast_agi_send(agi->fd, chan, "%s", c->usage);
                        ast_agi_send(agi->fd, chan, "520 End of proper usage.\n");
                        break;
-               case AST_PBX_KEEPALIVE:
-                       /* We've been asked to keep alive, so do so */
-                       return AST_PBX_KEEPALIVE;
-                       break;
                case RESULT_FAILURE:
                        /* They've already given the failure.  We've been hung up on so handle this
                           appropriately */
@@ -2876,8 +2860,9 @@ static enum agi_result run_agi(struct ast_channel *chan, char *request, AGI *agi
 
                        if (!buf[0]) {
                                /* Program terminated */
-                               if (returnstatus && returnstatus != AST_PBX_KEEPALIVE)
+                               if (returnstatus) {
                                        returnstatus = -1;
+                               }
                                ast_verb(3, "<%s>AGI Script %s completed, returning %d\n", chan->name, request, returnstatus);
                                if (pid > 0)
                                        waitpid(pid, status, 0);
@@ -2899,7 +2884,7 @@ static enum agi_result run_agi(struct ast_channel *chan, char *request, AGI *agi
                                ast_verbose("<%s>AGI Rx << %s\n", chan->name, buf);
                        returnstatus |= agi_handle_command(chan, agi, buf, dead);
                        /* If the handle_command returns -1, we need to stop */
-                       if ((returnstatus < 0) || (returnstatus == AST_PBX_KEEPALIVE)) {
+                       if (returnstatus < 0) {
                                needhup = 1;
                                continue;
                        }