aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_dial.c
diff options
context:
space:
mode:
authorrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-19 16:19:52 +0000
committerrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-19 16:19:52 +0000
commita4532658d76de9c7c93a13c5c85b97179e62f199 (patch)
treee8d444f22b4fa92b04cc3691e5232b99b6f606e1 /apps/app_dial.c
parent7ee16ede87eae8afee2d5a93be8aba0af269735d (diff)
localize one more variable;
use ast_strdup as it can handle the NULL argument well. mark a dubious piece of code with XXX git-svn-id: http://svn.digium.com/svn/asterisk/trunk@21536 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_dial.c')
-rw-r--r--apps/app_dial.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c
index a23398c97..160eeda29 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -714,7 +714,6 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
int cause;
char numsubst[AST_MAX_EXTENSION];
char cidname[AST_MAX_EXTENSION];
- char toast[80];
char *l;
int privdb_val = 0;
unsigned int calldurationlimit = 0;
@@ -1034,22 +1033,18 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
tmp->chan->appl = "AppDial";
tmp->chan->data = "(Outgoing Line)";
tmp->chan->whentohangup = 0;
+
if (tmp->chan->cid.cid_num)
free(tmp->chan->cid.cid_num);
- tmp->chan->cid.cid_num = NULL;
+ tmp->chan->cid.cid_num = ast_strdup(chan->cid.cid_num);
+
if (tmp->chan->cid.cid_name)
free(tmp->chan->cid.cid_name);
- tmp->chan->cid.cid_name = NULL;
+ tmp->chan->cid.cid_name = ast_strdup(chan->cid.cid_name);
+
if (tmp->chan->cid.cid_ani)
free(tmp->chan->cid.cid_ani);
- tmp->chan->cid.cid_ani = NULL;
-
- if (chan->cid.cid_num)
- tmp->chan->cid.cid_num = strdup(chan->cid.cid_num);
- if (chan->cid.cid_name)
- tmp->chan->cid.cid_name = strdup(chan->cid.cid_name);
- if (chan->cid.cid_ani)
- tmp->chan->cid.cid_ani = strdup(chan->cid.cid_ani);
+ tmp->chan->cid.cid_ani = ast_strdup(chan->cid.cid_ani);
/* Copy language from incoming to outgoing */
ast_string_field_set(tmp->chan, language, chan->language);
@@ -1057,8 +1052,8 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
tmp->chan->cdrflags = chan->cdrflags;
if (ast_strlen_zero(tmp->chan->musicclass))
ast_string_field_set(tmp->chan, musicclass, chan->musicclass);
- if (chan->cid.cid_rdnis)
- tmp->chan->cid.cid_rdnis = strdup(chan->cid.cid_rdnis);
+ /* XXX don't we free previous values ? */
+ tmp->chan->cid.cid_rdnis = ast_strdup(chan->cid.cid_rdnis);
/* Pass callingpres setting */
tmp->chan->cid.cid_pres = chan->cid.cid_pres;
/* Pass type of number */
@@ -1511,15 +1506,20 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
}
res = ast_bridge_call(chan,peer,&config);
time(&end_time);
- snprintf(toast, sizeof(toast), "%ld", (long)(end_time - answer_time));
- pbx_builtin_setvar_helper(chan, "ANSWEREDTIME", toast);
-
+ {
+ char toast[80];
+ snprintf(toast, sizeof(toast), "%ld", (long)(end_time - answer_time));
+ pbx_builtin_setvar_helper(chan, "ANSWEREDTIME", toast);
+ }
} else {
time(&end_time);
res = -1;
}
- snprintf(toast, sizeof(toast), "%ld", (long)(end_time - start_time));
- pbx_builtin_setvar_helper(chan, "DIALEDTIME", toast);
+ {
+ char toast[80];
+ snprintf(toast, sizeof(toast), "%ld", (long)(end_time - start_time));
+ pbx_builtin_setvar_helper(chan, "DIALEDTIME", toast);
+ }
if (res != AST_PBX_NO_HANGUP_PEER) {
if (!chan->_softhangup)