[asterisk-commits] rmudgett: trunk r256104 - in /trunk: apps/ channels/ funcs/ include/asterisk/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Apr 2 21:12:39 CDT 2010


Author: rmudgett
Date: Fri Apr  2 21:12:33 2010
New Revision: 256104

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=256104
Log:
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.

Modified:
    trunk/apps/app_amd.c
    trunk/apps/app_dial.c
    trunk/apps/app_dumpchan.c
    trunk/apps/app_queue.c
    trunk/channels/chan_dahdi.c
    trunk/channels/chan_h323.c
    trunk/channels/chan_iax2.c
    trunk/channels/chan_local.c
    trunk/channels/chan_misdn.c
    trunk/channels/chan_oss.c
    trunk/channels/chan_sip.c
    trunk/channels/sig_pri.c
    trunk/funcs/func_callerid.c
    trunk/funcs/func_redirecting.c
    trunk/include/asterisk/channel.h
    trunk/main/cel.c
    trunk/main/channel.c
    trunk/main/dial.c
    trunk/res/res_agi.c
    trunk/res/snmp/agent.c

Modified: trunk/apps/app_amd.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_amd.c?view=diff&rev=256104&r1=256103&r2=256104
==============================================================================
--- trunk/apps/app_amd.c (original)
+++ trunk/apps/app_amd.c Fri Apr  2 21:12:33 2010
@@ -188,7 +188,8 @@
 		AST_APP_ARG(argMaximumWordLength);
 	);
 
-	ast_verb(3, "AMD: %s %s %s (Fmt: %s)\n", chan->name, chan->cid.cid_ani, chan->cid.cid_rdnis, ast_getformatname(chan->readformat));
+	ast_verb(3, "AMD: %s %s %s (Fmt: %s)\n", chan->name, chan->cid.cid_ani,
+		chan->redirecting.from.number, ast_getformatname(chan->readformat));
 
 	/* Lets parse the arguments. */
 	if (!ast_strlen_zero(parse)) {

Modified: trunk/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_dial.c?view=diff&rev=256104&r1=256103&r2=256104
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Fri Apr  2 21:12:33 2010
@@ -691,12 +691,11 @@
 	}
 }
 
-/* free the buffer if allocated, and set the pointer to the second arg */
-#define S_REPLACE(s, new_val)		\
-	do {				\
-		if (s)			\
-			ast_free(s);	\
-		s = (new_val);		\
+/*! \brief free the buffer if allocated, and set the pointer to the second arg */
+#define S_REPLACE(s, new_val) \
+	do {                      \
+		ast_free(s);          \
+		s = (new_val);        \
 	} while (0)
 
 static int onedigit_goto(struct ast_channel *chan, const char *context, char exten, int pri)
@@ -773,8 +772,6 @@
 	struct ast_channel *original = o->chan;
 	struct ast_channel *c = o->chan; /* the winner */
 	struct ast_channel *in = num->chan; /* the input channel */
-	struct ast_party_redirecting *apr = &o->chan->redirecting;
-	struct ast_party_connected_line *apc = &o->chan->connected;
 	char *stuff;
 	char *tech;
 	int cause;
@@ -825,12 +822,19 @@
 			ast_rtp_instance_early_bridge_make_compatible(c, in);
 		}
 
-		ast_channel_set_redirecting(c, apr);
+		ast_channel_set_redirecting(c, &original->redirecting);
 		ast_channel_lock(c);
 		while (ast_channel_trylock(in)) {
 			CHANNEL_DEADLOCK_AVOIDANCE(c);
 		}
-		S_REPLACE(c->cid.cid_rdnis, ast_strdup(S_OR(original->cid.cid_rdnis, S_OR(in->macroexten, in->exten))));
+		if (ast_strlen_zero(c->redirecting.from.number)) {
+			/*
+			 * The call was not previously redirected so it is
+			 * now redirected from this number.
+			 */
+			S_REPLACE(c->redirecting.from.number,
+				ast_strdup(S_OR(in->macroexten, in->exten)));
+		}
 
 		c->cid.cid_tns = in->cid.cid_tns;
 
@@ -842,10 +846,9 @@
 			ast_party_caller_copy(&c->cid, &in->cid);
 			ast_string_field_set(c, accountcode, in->accountcode);
 		}
-		ast_party_connected_line_copy(&c->connected, apc);
-
-		S_REPLACE(in->cid.cid_rdnis, ast_strdup(c->cid.cid_rdnis));
-		ast_channel_update_redirecting(in, apr);
+		ast_party_connected_line_copy(&c->connected, &original->connected);
+
+		ast_channel_update_redirecting(in, &c->redirecting);
 
 		ast_clear_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE);
 		if (ast_test_flag64(peerflags, OPT_CANCEL_TIMEOUT)) {
@@ -1913,7 +1916,6 @@
 			ast_connected_line_copy_from_caller(&tc->connected, &chan->cid);
 		}
 
-		S_REPLACE(tc->cid.cid_rdnis, ast_strdup(chan->cid.cid_rdnis));
 		ast_party_redirecting_copy(&tc->redirecting, &chan->redirecting);
 
 		tc->cid.cid_tns = chan->cid.cid_tns;

Modified: trunk/apps/app_dumpchan.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_dumpchan.c?view=diff&rev=256104&r1=256103&r2=256104
==============================================================================
--- trunk/apps/app_dumpchan.c (original)
+++ trunk/apps/app_dumpchan.c Fri Apr  2 21:12:33 2010
@@ -119,7 +119,7 @@
 			S_OR(c->cid.cid_num, "(N/A)"),
 			S_OR(c->cid.cid_name, "(N/A)"),
 			S_OR(c->cid.cid_dnid, "(N/A)"),
-			S_OR(c->cid.cid_rdnis, "(N/A)"),
+			S_OR(c->redirecting.from.number, "(N/A)"),
 			c->parkinglot,
 			c->language,
 			ast_state2str(c->_state),

Modified: trunk/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_queue.c?view=diff&rev=256104&r1=256103&r2=256104
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Fri Apr  2 21:12:33 2010
@@ -2835,9 +2835,6 @@
 		tmp->update_connectedline = 0;
 	}
 
-	if (tmp->chan->cid.cid_rdnis)
-		ast_free(tmp->chan->cid.cid_rdnis);
-	tmp->chan->cid.cid_rdnis = ast_strdup(qe->chan->cid.cid_rdnis);
 	ast_party_redirecting_copy(&tmp->chan->redirecting, &qe->chan->redirecting);
 
 	tmp->chan->cid.cid_tns = qe->chan->cid.cid_tns;
@@ -3275,8 +3272,6 @@
 					winner = NULL;
 					continue;
 				} else if (!ast_strlen_zero(o->chan->call_forward)) {
-					struct ast_party_redirecting *apr = &o->chan->redirecting;
-					struct ast_party_connected_line *apc = &o->chan->connected;
 					struct ast_channel *original = o->chan;
 					char tmpchan[256];
 					char *stuff;
@@ -3312,22 +3307,23 @@
 
 						ast_string_field_set(o->chan, accountcode, in->accountcode);
 
-						ast_channel_set_redirecting(o->chan, apr);
-
-						if (o->chan->cid.cid_rdnis)
-							ast_free(o->chan->cid.cid_rdnis);
-						o->chan->cid.cid_rdnis = ast_strdup(S_OR(original->cid.cid_rdnis,S_OR(in->macroexten, in->exten)));
+						ast_channel_set_redirecting(o->chan, &original->redirecting);
+						if (ast_strlen_zero(o->chan->redirecting.from.number)) {
+							/*
+							 * The call was not previously redirected so it is
+							 * now redirected from this number.
+							 */
+							ast_free(o->chan->redirecting.from.number);
+							o->chan->redirecting.from.number =
+								ast_strdup(S_OR(in->macroexten, in->exten));
+						}
 
 						o->chan->cid.cid_tns = in->cid.cid_tns;
 
 						ast_party_caller_copy(&o->chan->cid, &in->cid);
-						ast_party_connected_line_copy(&o->chan->connected, apc);
-
-						ast_channel_update_redirecting(in, apr);
-						if (in->cid.cid_rdnis) {
-							ast_free(in->cid.cid_rdnis);
-						}
-						in->cid.cid_rdnis = ast_strdup(o->chan->cid.cid_rdnis);
+						ast_party_connected_line_copy(&o->chan->connected, &original->connected);
+
+						ast_channel_update_redirecting(in, &o->chan->redirecting);
 
 						update_connectedline = 1;
 

Modified: trunk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=256104&r1=256103&r2=256104
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Fri Apr  2 21:12:33 2010
@@ -8741,7 +8741,7 @@
 	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);
 

Modified: trunk/channels/chan_h323.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_h323.c?view=diff&rev=256104&r1=256103&r2=256104
==============================================================================
--- trunk/channels/chan_h323.c (original)
+++ trunk/channels/chan_h323.c Fri Apr  2 21:12:33 2010
@@ -615,8 +615,8 @@
 	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 @@
 		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;

Modified: trunk/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=256104&r1=256103&r2=256104
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Fri Apr  2 21:12:33 2010
@@ -4952,8 +4952,8 @@
 		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 @@
 	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;

Modified: trunk/channels/chan_local.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_local.c?view=diff&rev=256104&r1=256103&r2=256104
==============================================================================
--- trunk/channels/chan_local.c (original)
+++ trunk/channels/chan_local.c Fri Apr  2 21:12:33 2010
@@ -574,21 +574,15 @@
 	 * 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;
 

Modified: trunk/channels/chan_misdn.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_misdn.c?view=diff&rev=256104&r1=256103&r2=256104
==============================================================================
--- trunk/channels/chan_misdn.c (original)
+++ trunk/channels/chan_misdn.c Fri Apr  2 21:12:33 2010
@@ -6090,7 +6090,7 @@
 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);

Modified: trunk/channels/chan_oss.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_oss.c?view=diff&rev=256104&r1=256103&r2=256104
==============================================================================
--- trunk/channels/chan_oss.c (original)
+++ trunk/channels/chan_oss.c Fri Apr  2 21:12:33 2010
@@ -601,7 +601,8 @@
 
 	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);

Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=256104&r1=256103&r2=256104
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Fri Apr  2 21:12:33 2010
@@ -5568,7 +5568,7 @@
 	 * 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 @@
 		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);
 

Modified: trunk/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_pri.c?view=diff&rev=256104&r1=256103&r2=256104
==============================================================================
--- trunk/channels/sig_pri.c (original)
+++ trunk/channels/sig_pri.c Fri Apr  2 21:12:33 2010
@@ -665,19 +665,14 @@
 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);
 }

Modified: trunk/funcs/func_callerid.c
URL: http://svnview.digium.com/svn/asterisk/trunk/funcs/func_callerid.c?view=diff&rev=256104&r1=256103&r2=256104
==============================================================================
--- trunk/funcs/func_callerid.c (original)
+++ trunk/funcs/func_callerid.c Fri Apr  2 21:12:33 2010
@@ -209,8 +209,8 @@
 				}
 			}
 		} else if (!strncasecmp("rdnis", data, 5)) {
-			if (chan->cid.cid_rdnis) {
-				ast_copy_string(buf, chan->cid.cid_rdnis, len);
+			if (chan->redirecting.from.number) {
+				ast_copy_string(buf, chan->redirecting.from.number, len);
 			}
 		} else if (!strncasecmp("pres", data, 4)) {
 			ast_copy_string(buf, ast_named_caller_presentation(chan->cid.cid_pres), len);
@@ -311,10 +311,8 @@
 		ast_channel_unlock(chan);
 	} else if (!strncasecmp("rdnis", data, 5)) {
 		ast_channel_lock(chan);
-		if (chan->cid.cid_rdnis) {
-			ast_free(chan->cid.cid_rdnis);
-		}
-		chan->cid.cid_rdnis = ast_strdup(value);
+		ast_free(chan->redirecting.from.number);
+		chan->redirecting.from.number = ast_strdup(value);
 		if (chan->cdr) {
 			ast_cdr_setcid(chan->cdr, chan);
 		}

Modified: trunk/funcs/func_redirecting.c
URL: http://svnview.digium.com/svn/asterisk/trunk/funcs/func_redirecting.c?view=diff&rev=256104&r1=256103&r2=256104
==============================================================================
--- trunk/funcs/func_redirecting.c (original)
+++ trunk/funcs/func_redirecting.c Fri Apr  2 21:12:33 2010
@@ -183,11 +183,7 @@
 	ast_channel_lock(chan);
 
 	if (!strncasecmp("from-", data, 5)) {
-		struct ast_party_id from_id;
-
-		from_id = chan->redirecting.from;
-		from_id.number = chan->cid.cid_rdnis;
-		switch (redirecting_id_read(buf, len, data + 5, &from_id)) {
+		switch (redirecting_id_read(buf, len, data + 5, &chan->redirecting.from)) {
 		case ID_FIELD_VALID:
 		case ID_FIELD_INVALID:
 			break;

Modified: trunk/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/channel.h?view=diff&rev=256104&r1=256103&r2=256104
==============================================================================
--- trunk/include/asterisk/channel.h (original)
+++ trunk/include/asterisk/channel.h Fri Apr  2 21:12:33 2010
@@ -255,12 +255,6 @@
 	 * (Field will eventually move to struct ast_channel.caller.ani)
 	 */
 	char *cid_ani;
-
-	/*!
-	 * \brief Malloc'd Redirecting Directory Number Information Service (RDNIS)
-	 * (Field will eventually move to struct ast_channel.redirecting.from.number)
-	 */
-	char *cid_rdnis;
 
 	/*!
 	 * \brief Callerid Q.931 encoded number presentation/screening fields
@@ -700,12 +694,7 @@
 	 */
 	struct ast_party_connected_line connected;
 
-	/*!
-	 * \brief Redirecting/Diversion information
-	 * \note Until struct ast_channel.cid.cid_rdnis is replaced
-	 * with ast_channel.redirecting.from.number, the
-	 * ast_channel.redirecting.from.number field is not used.
-	 */
+	/*! \brief Redirecting/Diversion information */
 	struct ast_party_redirecting redirecting;
 
 	struct ast_frame dtmff;				/*!< DTMF frame */

Modified: trunk/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/cel.c?view=diff&rev=256104&r1=256103&r2=256104
==============================================================================
--- trunk/main/cel.c (original)
+++ trunk/main/cel.c Fri Apr  2 21:12:33 2010
@@ -440,7 +440,7 @@
 	tchan->cid.cid_name = ast_strdup(record.caller_id_name);
 	tchan->cid.cid_num = ast_strdup(record.caller_id_num);
 	tchan->cid.cid_ani = ast_strdup(record.caller_id_ani);
-	tchan->cid.cid_rdnis = ast_strdup(record.caller_id_rdnis);
+	tchan->redirecting.from.number = ast_strdup(record.caller_id_rdnis);
 	tchan->cid.cid_dnid = ast_strdup(record.caller_id_dnid);
 
 	ast_copy_string(tchan->exten, record.extension, sizeof(tchan->exten));
@@ -533,7 +533,7 @@
 			AST_EVENT_IE_CEL_CIDNAME, AST_EVENT_IE_PLTYPE_STR, S_OR(chan->cid.cid_name, ""),
 			AST_EVENT_IE_CEL_CIDNUM, AST_EVENT_IE_PLTYPE_STR, S_OR(chan->cid.cid_num, ""),
 			AST_EVENT_IE_CEL_CIDANI, AST_EVENT_IE_PLTYPE_STR, S_OR(chan->cid.cid_ani, ""),
-			AST_EVENT_IE_CEL_CIDRDNIS, AST_EVENT_IE_PLTYPE_STR, S_OR(chan->cid.cid_rdnis, ""),
+			AST_EVENT_IE_CEL_CIDRDNIS, AST_EVENT_IE_PLTYPE_STR, S_OR(chan->redirecting.from.number, ""),
 			AST_EVENT_IE_CEL_CIDDNID, AST_EVENT_IE_PLTYPE_STR, S_OR(chan->cid.cid_dnid, ""),
 			AST_EVENT_IE_CEL_EXTEN, AST_EVENT_IE_PLTYPE_STR, chan->exten,
 			AST_EVENT_IE_CEL_CONTEXT, AST_EVENT_IE_PLTYPE_STR, chan->context,

Modified: trunk/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/channel.c?view=diff&rev=256104&r1=256103&r2=256104
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Fri Apr  2 21:12:33 2010
@@ -1464,9 +1464,7 @@
 		ast_free(cid->cid_name);	
 	if (cid->cid_ani)
 		ast_free(cid->cid_ani);
-	if (cid->cid_rdnis)
-		ast_free(cid->cid_rdnis);
-	cid->cid_dnid = cid->cid_num = cid->cid_name = cid->cid_ani = cid->cid_rdnis = NULL;
+	cid->cid_dnid = cid->cid_num = cid->cid_name = cid->cid_ani = NULL;
 	ast_party_subaddress_free(&cid->subaddress);
 	ast_party_subaddress_free(&cid->dialed_subaddress);
 }
@@ -6973,18 +6971,6 @@
 	ast_channel_lock(chan);
 
 	ast_party_id_set(&chan->redirecting.from, &redirecting->from);
-	if (redirecting->from.number
-		&& redirecting->from.number != chan->redirecting.from.number) {
-		/*
-		 * Must move string to ast_channel.cid.cid_rdnis until it goes away.
-		 */
-		if (chan->cid.cid_rdnis) {
-			ast_free(chan->cid.cid_rdnis);
-		}
-		chan->cid.cid_rdnis = chan->redirecting.from.number;
-		chan->redirecting.from.number = NULL;
-	}
-
 	ast_party_id_set(&chan->redirecting.to, &redirecting->to);
 	chan->redirecting.reason = redirecting->reason;
 	chan->redirecting.count = redirecting->count;

Modified: trunk/main/dial.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/dial.c?view=diff&rev=256104&r1=256103&r2=256104
==============================================================================
--- trunk/main/dial.c (original)
+++ trunk/main/dial.c Fri Apr  2 21:12:33 2010
@@ -174,15 +174,6 @@
 	{ AST_DIAL_OPTION_MAX, NULL, NULL },                                      /*!< Terminator of list */
 };
 
-/*! \brief free the buffer if allocated, and set the pointer to the second arg */
-#define S_REPLACE(s, new_val) \
-	do {                      \
-		if (s) {              \
-			free(s);          \
-		}                     \
-		s = (new_val);        \
-	} while (0)
-
 /*! \brief Maximum number of channels we can watch at a time */
 #define AST_MAX_WATCHERS 256
 
@@ -275,7 +266,6 @@
 		ast_channel_datastore_inherit(chan, channel->owner);
 
 		/* Copy over callerid information */
-		S_REPLACE(channel->owner->cid.cid_rdnis, ast_strdup(chan->cid.cid_rdnis));
 		ast_party_redirecting_copy(&channel->owner->redirecting, &chan->redirecting);
 
 		channel->owner->cid.cid_tns = chan->cid.cid_tns;

Modified: trunk/res/res_agi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_agi.c?view=diff&rev=256104&r1=256103&r2=256104
==============================================================================
--- trunk/res/res_agi.c (original)
+++ trunk/res/res_agi.c Fri Apr  2 21:12:33 2010
@@ -1633,7 +1633,7 @@
 	ast_agi_send(fd, chan, "agi_callington: %d\n", chan->cid.cid_ton);
 	ast_agi_send(fd, chan, "agi_callingtns: %d\n", chan->cid.cid_tns);
 	ast_agi_send(fd, chan, "agi_dnid: %s\n", S_OR(chan->cid.cid_dnid, "unknown"));
-	ast_agi_send(fd, chan, "agi_rdnis: %s\n", S_OR(chan->cid.cid_rdnis, "unknown"));
+	ast_agi_send(fd, chan, "agi_rdnis: %s\n", S_OR(chan->redirecting.from.number, "unknown"));
 
 	/* Context information */
 	ast_agi_send(fd, chan, "agi_context: %s\n", chan->context);

Modified: trunk/res/snmp/agent.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/snmp/agent.c?view=diff&rev=256104&r1=256103&r2=256104
==============================================================================
--- trunk/res/snmp/agent.c (original)
+++ trunk/res/snmp/agent.c Fri Apr  2 21:12:33 2010
@@ -451,8 +451,8 @@
 		}
 		break;
 	case ASTCHANCIDRDNIS:
-		if (chan->cid.cid_rdnis) {
-			strncpy(string_ret, chan->cid.cid_rdnis, sizeof(string_ret));
+		if (chan->redirecting.from.number) {
+			strncpy(string_ret, chan->redirecting.from.number, sizeof(string_ret));
 			string_ret[sizeof(string_ret) - 1] = '\0';
 			*var_len = strlen(string_ret);
 			ret = (u_char *)string_ret;




More information about the asterisk-commits mailing list