summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2010-04-03 02:12:33 +0000
committerRichard Mudgett <rmudgett@digium.com>2010-04-03 02:12:33 +0000
commita5a0a5f867a45eef2e7ccb6c64f3a4f2e8c3a7ba (patch)
treed5314391644adec2c19d0dc0b36644a20a12c759 /channels
parent5333a48b17e3f0f9cb12a7cb23da9bc509539dd7 (diff)
Consolidate ast_channel.cid.cid_rdnis into ast_channel.redirecting.from.number.
SWP-1229 ABE-2161 * Ensure chan_local.c:local_call() will not leak cid.cid_dnid when copying. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256104 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_dahdi.c2
-rw-r--r--channels/chan_h323.c6
-rw-r--r--channels/chan_iax2.c6
-rw-r--r--channels/chan_local.c20
-rw-r--r--channels/chan_misdn.c2
-rw-r--r--channels/chan_oss.c3
-rw-r--r--channels/chan_sip.c4
-rw-r--r--channels/sig_pri.c13
8 files changed, 23 insertions, 33 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 7f1840e63..72e341ebd 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -8741,7 +8741,7 @@ static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpb
if (!ast_strlen_zero(i->exten))
ast_copy_string(tmp->exten, i->exten, sizeof(tmp->exten));
if (!ast_strlen_zero(i->rdnis))
- tmp->cid.cid_rdnis = ast_strdup(i->rdnis);
+ tmp->redirecting.from.number = ast_strdup(i->rdnis);
if (!ast_strlen_zero(i->dnid))
tmp->cid.cid_dnid = ast_strdup(i->dnid);
diff --git a/channels/chan_h323.c b/channels/chan_h323.c
index 2746199f5..51d3cb1d2 100644
--- a/channels/chan_h323.c
+++ b/channels/chan_h323.c
@@ -615,8 +615,8 @@ static int oh323_call(struct ast_channel *c, char *dest, int timeout)
if (c->connected.id.name)
ast_copy_string(pvt->options.cid_name, c->connected.id.name, sizeof(pvt->options.cid_name));
- if (c->cid.cid_rdnis) {
- ast_copy_string(pvt->options.cid_rdnis, c->cid.cid_rdnis, sizeof(pvt->options.cid_rdnis));
+ if (c->redirecting.from.number) {
+ ast_copy_string(pvt->options.cid_rdnis, c->redirecting.from.number, sizeof(pvt->options.cid_rdnis));
}
pvt->options.presentation = c->connected.id.number_presentation;
@@ -1078,7 +1078,7 @@ static struct ast_channel *__oh323_new(struct oh323_pvt *pvt, int state, const c
ch->cid.cid_ani = ast_strdup(cid_num);
if (pvt->cd.redirect_reason >= 0) {
- ch->cid.cid_rdnis = ast_strdup(pvt->cd.redirect_number);
+ ch->redirecting.from.number = ast_strdup(pvt->cd.redirect_number);
pbx_builtin_setvar_helper(ch, "PRIREDIRECTREASON", redirectingreason2str(pvt->cd.redirect_reason));
}
ch->cid.cid_pres = pvt->cd.presentation;
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 1d89eab3c..6cf3f652c 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -4952,8 +4952,8 @@ static int iax2_call(struct ast_channel *c, char *dest, int timeout)
iax_ie_append_str(&ied, IAX_IE_LANGUAGE, c->language);
if (!ast_strlen_zero(c->cid.cid_dnid))
iax_ie_append_str(&ied, IAX_IE_DNID, c->cid.cid_dnid);
- if (!ast_strlen_zero(c->cid.cid_rdnis))
- iax_ie_append_str(&ied, IAX_IE_RDNIS, c->cid.cid_rdnis);
+ if (!ast_strlen_zero(c->redirecting.from.number))
+ iax_ie_append_str(&ied, IAX_IE_RDNIS, c->redirecting.from.number);
if (pds.context)
iax_ie_append_str(&ied, IAX_IE_CALLED_CONTEXT, pds.context);
@@ -5549,7 +5549,7 @@ static struct ast_channel *ast_iax2_new(int callno, int state, format_t capabili
else
tmp->cid.cid_ani = ast_strdup(i->cid_num);
tmp->cid.cid_dnid = ast_strdup(i->dnid);
- tmp->cid.cid_rdnis = ast_strdup(i->rdnis);
+ tmp->redirecting.from.number = ast_strdup(i->rdnis);
tmp->cid.cid_pres = i->calling_pres;
tmp->cid.cid_ton = i->calling_ton;
tmp->cid.cid_tns = i->calling_tns;
diff --git a/channels/chan_local.c b/channels/chan_local.c
index b2c7b9ed4..5e522e797 100644
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -574,21 +574,15 @@ start_over:
* All these failure points just return -1. The individual strings will
* be cleared when we destroy the channel.
*/
- if (p->owner->cid.cid_rdnis) {
- if (!(p->chan->cid.cid_rdnis = ast_strdup(p->owner->cid.cid_rdnis))) {
- ast_mutex_unlock(&p->lock);
- ast_channel_unlock(p->chan);
- return -1;
- }
- }
ast_party_redirecting_copy(&p->chan->redirecting, &p->owner->redirecting);
- if (p->owner->cid.cid_dnid) {
- if (!(p->chan->cid.cid_dnid = ast_strdup(p->owner->cid.cid_dnid))) {
- ast_mutex_unlock(&p->lock);
- ast_channel_unlock(p->chan);
- return -1;
- }
+ ast_free(p->chan->cid.cid_dnid);
+ p->chan->cid.cid_dnid = ast_strdup(p->owner->cid.cid_dnid);
+ if (!p->chan->cid.cid_dnid && p->owner->cid.cid_dnid) {
+ /* Allocation failure */
+ ast_mutex_unlock(&p->lock);
+ ast_channel_unlock(p->chan);
+ return -1;
}
p->chan->cid.cid_tns = p->owner->cid.cid_tns;
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index 7d00a8bf7..d37d66a31 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -6090,7 +6090,7 @@ static void misdn_update_connected_line(struct ast_channel *ast, struct misdn_bc
static void misdn_copy_redirecting_from_ast(struct misdn_bchannel *bc, struct ast_channel *ast)
{
ast_copy_string(bc->redirecting.from.name, S_OR(ast->redirecting.from.name, ""), sizeof(bc->redirecting.from.name));
- ast_copy_string(bc->redirecting.from.number, S_OR(ast->cid.cid_rdnis, ""), sizeof(bc->redirecting.from.number));
+ ast_copy_string(bc->redirecting.from.number, S_OR(ast->redirecting.from.number, ""), sizeof(bc->redirecting.from.number));
bc->redirecting.from.presentation = ast_to_misdn_pres(ast->redirecting.from.number_presentation);
bc->redirecting.from.screening = ast_to_misdn_screen(ast->redirecting.from.number_presentation);
bc->redirecting.from.number_type = ast_to_misdn_ton(ast->redirecting.from.number_type);
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index 09ca4b830..414268576 100644
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -601,7 +601,8 @@ static int oss_call(struct ast_channel *c, char *dest, int timeout)
AST_NONSTANDARD_APP_ARGS(args, parse, '/');
- ast_verbose(" << Call to device '%s' dnid '%s' rdnis '%s' on console from '%s' <%s> >>\n", dest, c->cid.cid_dnid, c->cid.cid_rdnis, c->cid.cid_name, c->cid.cid_num);
+ ast_verbose(" << Call to device '%s' dnid '%s' rdnis '%s' on console from '%s' <%s> >>\n",
+ dest, c->cid.cid_dnid, c->redirecting.from.number, c->cid.cid_name, c->cid.cid_num);
if (!ast_strlen_zero(args.flags) && strcasecmp(args.flags, "answer") == 0) {
f.subclass.integer = AST_CONTROL_ANSWER;
ast_queue_frame(c, &f);
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 59ba5dce2..934a925f0 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -5568,7 +5568,7 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
* generate an unnecessary NewCallerID event */
tmp->cid.cid_ani = ast_strdup(i->cid_num);
if (!ast_strlen_zero(i->rdnis))
- tmp->cid.cid_rdnis = ast_strdup(i->rdnis);
+ tmp->redirecting.from.number = ast_strdup(i->rdnis);
if (!ast_strlen_zero(i->exten) && strcmp(i->exten, "s"))
tmp->cid.cid_dnid = ast_strdup(i->exten);
@@ -9654,7 +9654,7 @@ static void add_diversion_header(struct sip_request *req, struct sip_pvt *pvt)
return;
}
- diverting_number = pvt->owner->cid.cid_rdnis;
+ diverting_number = pvt->owner->redirecting.from.number;
diverting_name = pvt->owner->redirecting.from.name;
reason = sip_reason_code_to_str(pvt->owner->redirecting.reason);
diff --git a/channels/sig_pri.c b/channels/sig_pri.c
index c1dff5f5e..fd3b4111e 100644
--- a/channels/sig_pri.c
+++ b/channels/sig_pri.c
@@ -665,19 +665,14 @@ static void sig_pri_party_id_from_ast(struct pri_party_id *pri_id, const struct
static void sig_pri_redirecting_update(struct sig_pri_chan *pvt, struct ast_channel *ast)
{
struct pri_party_redirecting pri_redirecting;
- struct ast_party_redirecting ast_redirecting;
-
- /* Gather asterisk redirecting data */
- ast_redirecting = ast->redirecting;
- ast_redirecting.from.number = ast->cid.cid_rdnis;
/*! \todo XXX Original called data can be put in a channel data store that is inherited. */
memset(&pri_redirecting, 0, sizeof(pri_redirecting));
- sig_pri_party_id_from_ast(&pri_redirecting.from, &ast_redirecting.from);
- sig_pri_party_id_from_ast(&pri_redirecting.to, &ast_redirecting.to);
- pri_redirecting.count = ast_redirecting.count;
- pri_redirecting.reason = ast_to_pri_reason(ast_redirecting.reason);
+ sig_pri_party_id_from_ast(&pri_redirecting.from, &ast->redirecting.from);
+ sig_pri_party_id_from_ast(&pri_redirecting.to, &ast->redirecting.to);
+ pri_redirecting.count = ast->redirecting.count;
+ pri_redirecting.reason = ast_to_pri_reason(ast->redirecting.reason);
pri_redirecting_update(pvt->pri->pri, pvt->call, &pri_redirecting);
}