dect
/
asterisk
Archived
13
0
Fork 0

Revert inadvertant code commit to app_originate

git-svn-id: http://svn.digium.com/svn/asterisk/trunk@223875 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
twilson 2009-10-13 01:58:09 +00:00
parent 0e46ff9d32
commit cf73e6b22f
1 changed files with 8 additions and 53 deletions

View File

@ -41,7 +41,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/app.h"
#include "asterisk/dial.h"
static const char app_originate[] = "Originate";
@ -106,9 +105,6 @@ static int originate_exec(struct ast_channel *chan, const char *data)
int outgoing_status = 0;
static const unsigned int timeout = 30;
static const char default_exten[] = "s";
struct ast_dial *dial = NULL;
struct ast_str *buf = NULL;
struct ast_channel *c = NULL;
ast_autoservice_start(chan);
@ -134,30 +130,7 @@ static int originate_exec(struct ast_channel *chan, const char *data)
goto return_cleanup;
}
if (strstr(args.type, "async")) {
if (!(dial = ast_dial_create())) {
goto return_cleanup;
}
if (ast_dial_append(dial, chantech, chandata)) {
goto return_cleanup;
}
if (!(buf = ast_str_create(32))) {
goto return_cleanup;
}
if (!(c = ast_channel_alloc(1, AST_STATE_DOWN, 0, 0, 0, 0, 0, 0, 0, "Originate/%s-%08lx", args.arg1, ast_random()))) {
ast_free(buf);
goto return_cleanup;
}
c->nativeformats = AST_FORMAT_SLINEAR;
ast_dial_set_global_timeout(dial, 30 * 1000);
}
if (!strncasecmp(args.type, "exten", 5)) {
if (!strcasecmp(args.type, "exten")) {
int priority = 1; /* Initialized in case priority not specified */
const char *exten = args.arg2;
@ -175,28 +148,16 @@ static int originate_exec(struct ast_channel *chan, const char *data)
ast_debug(1, "Originating call to '%s/%s' and connecting them to extension %s,%s,%d\n",
chantech, chandata, args.arg1, exten, priority);
if (!strcasecmp(args.type, "exten-async")) {
ast_str_set(&buf, 0, "Dial,Local/%s@%s", exten, args.arg1);
ast_dial_option_global_enable(dial, AST_DIAL_OPTION_ANSWER_EXEC, ast_str_buffer(buf));
ast_dial_run(dial, NULL, 1);
} else {
outgoing_res = ast_pbx_outgoing_exten(chantech, AST_FORMAT_SLINEAR, chandata,
timeout * 1000, args.arg1, exten, priority, &outgoing_status, 0, NULL,
NULL, NULL, NULL, NULL);
}
} else if (!strncasecmp(args.type, "app", 3)) {
outgoing_res = ast_pbx_outgoing_exten(chantech, AST_FORMAT_SLINEAR, chandata,
timeout * 1000, args.arg1, exten, priority, &outgoing_status, 0, NULL,
NULL, NULL, NULL, NULL);
} else if (!strcasecmp(args.type, "app")) {
ast_debug(1, "Originating call to '%s/%s' and connecting them to %s(%s)\n",
chantech, chandata, args.arg1, S_OR(args.arg2, ""));
if (!strcasecmp(args.type, "app-async")) {
ast_str_set(&buf, 0, "%s,%s", args.arg1, args.arg2);
ast_dial_option_global_enable(dial, AST_DIAL_OPTION_ANSWER_EXEC, ast_str_buffer(buf));
ast_dial_run(dial, c, 1);
} else {
outgoing_res = ast_pbx_outgoing_app(chantech, AST_FORMAT_SLINEAR, chandata,
timeout * 1000, args.arg1, args.arg2, &outgoing_status, 0, NULL,
NULL, NULL, NULL, NULL);
}
outgoing_res = ast_pbx_outgoing_app(chantech, AST_FORMAT_SLINEAR, chandata,
timeout * 1000, args.arg1, args.arg2, &outgoing_status, 0, NULL,
NULL, NULL, NULL, NULL);
} else {
ast_log(LOG_ERROR, "Incorrect type, it should be 'exten' or 'app': %s\n",
args.type);
@ -233,12 +194,6 @@ return_cleanup:
break;
}
}
if (buf) {
ast_free(buf);
}
if (c) {
ast_channel_release(c);
}
ast_autoservice_stop(chan);