fix indentation of a block, and do minor simplifications at the end of

another one.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47182 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Luigi Rizzo
2006-11-04 01:16:20 +00:00
parent 0f58d97707
commit a55ca0d6ec

View File

@@ -963,9 +963,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
} }
if (ast_test_flag(&opts, OPT_OPERMODE)) { if (ast_test_flag(&opts, OPT_OPERMODE)) {
if (ast_strlen_zero(opt_args[OPT_ARG_OPERMODE])) opermode = ast_strlen_zero(opt_args[OPT_ARG_OPERMODE]) ? 1 : atoi(opt_args[OPT_ARG_OPERMODE]);
opermode = 1;
else opermode = atoi(opt_args[OPT_ARG_OPERMODE]);
if (option_verbose > 2) if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Setting operator services mode to %d.\n", opermode); ast_verbose(VERBOSE_PREFIX_3 "Setting operator services mode to %d.\n", opermode);
} }
@@ -1304,6 +1302,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
} else { } else {
const char *number; const char *number;
time_t end_time, answer_time = time(NULL); time_t end_time, answer_time = time(NULL);
char toast[80]; /* buffer to set variables */
strcpy(status, "ANSWER"); strcpy(status, "ANSWER");
/* Ah ha! Someone answered within the desired timeframe. Of course after this /* Ah ha! Someone answered within the desired timeframe. Of course after this
@@ -1573,7 +1572,6 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
replace_macro_delimiter(macro_transfer_dest); replace_macro_delimiter(macro_transfer_dest);
if (!ast_parseable_goto(chan, macro_transfer_dest)) if (!ast_parseable_goto(chan, macro_transfer_dest))
ast_set_flag(peerflags, OPT_GO_ON); ast_set_flag(peerflags, OPT_GO_ON);
} }
} }
} }
@@ -1595,7 +1593,10 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
} }
} }
if (!res) { if (res) { /* some error */
res = -1;
end_time = time(NULL);
} else {
if (ast_test_flag(peerflags, OPT_CALLEE_TRANSFER)) if (ast_test_flag(peerflags, OPT_CALLEE_TRANSFER))
ast_set_flag(&(config.features_callee), AST_FEATURE_REDIRECT); ast_set_flag(&(config.features_callee), AST_FEATURE_REDIRECT);
if (ast_test_flag(peerflags, OPT_CALLER_TRANSFER)) if (ast_test_flag(peerflags, OPT_CALLER_TRANSFER))
@@ -1630,9 +1631,8 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
res = -1; res = -1;
goto done; goto done;
} }
if (opermode && (!strncmp(chan->name,"Zap",3)) && if (opermode && !strncmp(chan->name,"Zap",3) && !strncmp(peer->name,"Zap",3)) {
(!strncmp(peer->name,"Zap",3))) /* XXX what's this special handling for Zap <-> Zap ? */
{
struct oprmode oprmode; struct oprmode oprmode;
oprmode.peer = peer; oprmode.peer = peer;
@@ -1642,21 +1642,13 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
AST_OPTION_OPRMODE,&oprmode,sizeof(struct oprmode),0); AST_OPTION_OPRMODE,&oprmode,sizeof(struct oprmode),0);
} }
res = ast_bridge_call(chan,peer,&config); res = ast_bridge_call(chan,peer,&config);
time(&end_time); end_time = time(NULL);
{
char toast[80];
snprintf(toast, sizeof(toast), "%ld", (long)(end_time - answer_time)); snprintf(toast, sizeof(toast), "%ld", (long)(end_time - answer_time));
pbx_builtin_setvar_helper(chan, "ANSWEREDTIME", toast); pbx_builtin_setvar_helper(chan, "ANSWEREDTIME", toast);
} }
} else {
time(&end_time);
res = -1;
}
{
char toast[80];
snprintf(toast, sizeof(toast), "%ld", (long)(end_time - start_time)); snprintf(toast, sizeof(toast), "%ld", (long)(end_time - start_time));
pbx_builtin_setvar_helper(chan, "DIALEDTIME", toast); pbx_builtin_setvar_helper(chan, "DIALEDTIME", toast);
}
if (res != AST_PBX_NO_HANGUP_PEER) { if (res != AST_PBX_NO_HANGUP_PEER) {
if (!chan->_softhangup) if (!chan->_softhangup)