more localization and variable removal

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@21538 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Luigi Rizzo 20 years ago
parent c9f669e56d
commit 73f2d344fb

@ -703,7 +703,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
int res = -1; int res = -1;
struct localuser *u; struct localuser *u;
char *rest, *cur; char *rest, *cur;
struct dial_localuser *outgoing = NULL, *tmp; struct dial_localuser *outgoing = NULL;
struct ast_channel *peer; struct ast_channel *peer;
int to; int to;
int numbusy = 0; int numbusy = 0;
@ -721,17 +721,14 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
const char *end_sound = NULL; const char *end_sound = NULL;
const char *start_sound = NULL; const char *start_sound = NULL;
char *dtmfcalled = NULL, *dtmfcalling = NULL; char *dtmfcalled = NULL, *dtmfcalling = NULL;
const char *var;
char status[256]; char status[256];
int play_to_caller = 0, play_to_callee = 0; int play_to_caller = 0, play_to_callee = 0;
int sentringing = 0, moh = 0; int sentringing = 0, moh = 0;
const char *outbound_group = NULL; const char *outbound_group = NULL;
int digit = 0, result = 0; int result = 0;
time_t start_time; time_t start_time;
struct ast_app *app = NULL;
char privintro[1024]; char privintro[1024];
char privcid[256]; char privcid[256];
char *parse; char *parse;
AST_DECLARE_APP_ARGS(args, AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(peers); AST_APP_ARG(peers);
@ -774,18 +771,17 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
} }
if (ast_test_flag(&opts, OPT_SENDDTMF) && !ast_strlen_zero(opt_args[OPT_ARG_SENDDTMF])) { if (ast_test_flag(&opts, OPT_SENDDTMF) && !ast_strlen_zero(opt_args[OPT_ARG_SENDDTMF])) {
parse = opt_args[OPT_ARG_SENDDTMF]; dtmfcalling = opt_args[OPT_ARG_SENDDTMF];
dtmfcalled = strsep(&parse, ":"); dtmfcalled = strsep(&dtmfcalling, ":");
dtmfcalling = parse;
} }
if (ast_test_flag(&opts, OPT_DURATION_LIMIT) && !ast_strlen_zero(opt_args[OPT_ARG_DURATION_LIMIT])) { if (ast_test_flag(&opts, OPT_DURATION_LIMIT) && !ast_strlen_zero(opt_args[OPT_ARG_DURATION_LIMIT])) {
char *limit_str, *warning_str, *warnfreq_str; char *limit_str, *warning_str, *warnfreq_str;
const char *var;
parse = opt_args[OPT_ARG_DURATION_LIMIT]; warnfreq_str = opt_args[OPT_ARG_DURATION_LIMIT];
limit_str = strsep(&parse, ":"); limit_str = strsep(&warnfreq_str, ":");
warning_str = strsep(&parse, ":"); warning_str = strsep(&warnfreq_str, ":");
warnfreq_str = parse;
timelimit = atol(limit_str); timelimit = atol(limit_str);
if (warning_str) if (warning_str)
@ -955,6 +951,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
/* loop through the list of dial destinations */ /* loop through the list of dial destinations */
rest = args.peers; rest = args.peers;
while ((cur = strsep(&rest, "&")) ) { while ((cur = strsep(&rest, "&")) ) {
struct dial_localuser *tmp;
/* Get a technology/[device:]number pair */ /* Get a technology/[device:]number pair */
char *number = cur; char *number = cur;
char *tech = strsep(&number, "/"); char *tech = strsep(&number, "/");
@ -1134,6 +1131,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
} else { /* Nobody answered, next please? */ } else { /* Nobody answered, next please? */
res = 0; res = 0;
} }
/* almost done, although the 'else' block is 400 lines */
} else { } else {
const char *number; const char *number;
time_t end_time, answer_time = time(NULL); time_t end_time, answer_time = time(NULL);
@ -1347,6 +1345,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
if (!ast_test_flag(&opts, OPT_ANNOUNCE) || ast_strlen_zero(opt_args[OPT_ARG_ANNOUNCE])) { if (!ast_test_flag(&opts, OPT_ANNOUNCE) || ast_strlen_zero(opt_args[OPT_ARG_ANNOUNCE])) {
res = 0; res = 0;
} else { } else {
int digit = 0;
/* Start autoservice on the other chan */ /* Start autoservice on the other chan */
res = ast_autoservice_start(chan); res = ast_autoservice_start(chan);
/* Now Stream the File */ /* Now Stream the File */
@ -1376,17 +1375,19 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
} }
if (ast_test_flag(&opts, OPT_CALLEE_MACRO) && !ast_strlen_zero(opt_args[OPT_ARG_CALLEE_MACRO])) { if (ast_test_flag(&opts, OPT_CALLEE_MACRO) && !ast_strlen_zero(opt_args[OPT_ARG_CALLEE_MACRO])) {
struct ast_app *theapp;
res = ast_autoservice_start(chan); res = ast_autoservice_start(chan);
if (res) { if (res) {
ast_log(LOG_ERROR, "Unable to start autoservice on calling channel\n"); ast_log(LOG_ERROR, "Unable to start autoservice on calling channel\n");
res = -1; res = -1;
} }
app = pbx_findapp("Macro"); theapp = pbx_findapp("Macro");
if (app && !res) { if (theapp && !res) { /* XXX why check res here ? */
replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_MACRO]); replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_MACRO]);
res = pbx_exec(peer, app, opt_args[OPT_ARG_CALLEE_MACRO]); res = pbx_exec(peer, theapp, opt_args[OPT_ARG_CALLEE_MACRO]);
ast_log(LOG_DEBUG, "Macro exited with status %d\n", res); ast_log(LOG_DEBUG, "Macro exited with status %d\n", res);
res = 0; res = 0;
} else { } else {
@ -1445,10 +1446,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
if (!res) { if (!res) {
if (calldurationlimit > 0) { if (calldurationlimit > 0) {
time_t now; chan->whentohangup = time(NULL) + calldurationlimit;
time(&now);
chan->whentohangup = now + calldurationlimit;
} }
if (!ast_strlen_zero(dtmfcalled)) { if (!ast_strlen_zero(dtmfcalled)) {
if (option_verbose > 2) if (option_verbose > 2)
@ -1503,8 +1501,8 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
if (res < 0) { if (res < 0) {
ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", chan->name, peer->name); ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", chan->name, peer->name);
ast_hangup(peer); ast_hangup(peer);
LOCAL_USER_REMOVE(u); res = -1;
return -1; goto done;
} }
res = ast_bridge_call(chan,peer,&config); res = ast_bridge_call(chan,peer,&config);
time(&end_time); time(&end_time);

Loading…
Cancel
Save