aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_dial.c
diff options
context:
space:
mode:
authorrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-19 16:10:11 +0000
committerrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-19 16:10:11 +0000
commit7ee16ede87eae8afee2d5a93be8aba0af269735d (patch)
tree9db8cbcaee693f3ed4d5d4730a79db1ac534f00e /apps/app_dial.c
parent14d3d9cceec120f31816cf98f483bc00b4691129 (diff)
localize some variables
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@21535 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_dial.c')
-rw-r--r--apps/app_dial.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c
index c6e2c6411..a23398c97 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -358,21 +358,14 @@ static void senddialevent(struct ast_channel *src, struct ast_channel *dst)
static struct ast_channel *wait_for_answer(struct ast_channel *in, struct dial_localuser *outgoing, int *to, struct ast_flags *peerflags, int *sentringing, char *status, size_t statussize, int busystart, int nochanstart, int congestionstart, int priority_jump, int *result)
{
- struct dial_localuser *o;
int numbusy = busystart;
int numcongestion = congestionstart;
int numnochan = nochanstart;
int prestart = busystart + congestionstart + nochanstart;
- int cause;
int orig = *to;
struct ast_channel *peer = NULL;
- struct ast_channel *watchers[AST_MAX_WATCHERS];
- int single;
- struct ast_channel *winner;
- const char *context = NULL;
- char cidname[AST_MAX_EXTENSION];
-
- single = (outgoing && !outgoing->next && !ast_test_flag(outgoing, OPT_MUSICBACK | OPT_RINGBACK));
+ /* single is set if only one destination is enabled */
+ int single = outgoing && !outgoing->next && !ast_test_flag(outgoing, OPT_MUSICBACK | OPT_RINGBACK);
if (single) {
/* Turn off hold music, etc */
@@ -383,8 +376,12 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct dial_l
while (*to && !peer) {
+ struct dial_localuser *o;
int pos = 0; /* how many channels do we handle */
int numlines = prestart;
+ struct ast_channel *winner;
+ struct ast_channel *watchers[AST_MAX_WATCHERS];
+
watchers[pos++] = in;
for (o = outgoing; o; o = o->next) {
/* Keep track of important channels */
@@ -437,14 +434,14 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct dial_l
char tmpchan[256];
char *stuff;
char *tech;
- const char *forward_context;
+ int cause;
ast_copy_string(tmpchan, c->call_forward, sizeof(tmpchan));
if ((stuff = strchr(tmpchan, '/'))) {
*stuff++ = '\0';
tech = tmpchan;
} else {
- forward_context = pbx_builtin_getvar_helper(c, "FORWARD_CONTEXT");
+ const char *forward_context = pbx_builtin_getvar_helper(c, "FORWARD_CONTEXT");
snprintf(tmpchan, sizeof(tmpchan), "%s@%s", c->call_forward, forward_context ? forward_context : c->context);
stuff = tmpchan;
tech = "Local";
@@ -504,8 +501,10 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct dial_l
} else {
senddialevent(in, c);
/* After calling, set callerid to extension */
- if (!ast_test_flag(peerflags, OPT_ORIGINAL_CLID))
+ if (!ast_test_flag(peerflags, OPT_ORIGINAL_CLID)) {
+ char cidname[AST_MAX_EXTENSION];
ast_set_callerid(c, S_OR(in->macroexten, in->exten), get_cid_name(cidname, sizeof(cidname), in), NULL);
+ }
}
}
/* Hangup the original channel now, in case we needed it */
@@ -645,7 +644,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct dial_l
if (f && (f->frametype == AST_FRAME_DTMF)) {
if (ast_test_flag(peerflags, OPT_DTMF_EXIT)) {
- context = pbx_builtin_getvar_helper(in, "EXITCONTEXT");
+ const char *context = pbx_builtin_getvar_helper(in, "EXITCONTEXT");
if (onedigit_goto(in, context, (char) f->subclass, 1)) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "User hit %c to disconnect call.\n", f->subclass);