[svn-commits] rizzo: trunk r47177 - /trunk/apps/app_dial.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Fri Nov 3 16:24:22 MST 2006


Author: rizzo
Date: Fri Nov  3 17:24:21 2006
New Revision: 47177

URL: http://svn.digium.com/view/asterisk?rev=47177&view=rev
Log:
another small set of simplifications


Modified:
    trunk/apps/app_dial.c

Modified: trunk/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_dial.c?rev=47177&r1=47176&r2=47177&view=diff
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Fri Nov  3 17:24:21 2006
@@ -540,26 +540,25 @@
 					ast_clear_flag(o, DIAL_STILLGOING);	
 					handle_cause(cause, &num);
 				} else {
+					char *new_cid_num, *new_cid_name;
+					struct ast_channel *src;
+
 					ast_rtp_make_compatible(c, in, single);
-					if (c->cid.cid_num)
-						free(c->cid.cid_num);
-					c->cid.cid_num = NULL;
-					if (c->cid.cid_name)
-						free(c->cid.cid_name);
-					c->cid.cid_name = NULL;
-
 					if (ast_test_flag(o, OPT_FORCECLID)) {
-						c->cid.cid_num = ast_strdup(S_OR(in->macroexten, in->exten));
-						ast_string_field_set(c, accountcode, winner->accountcode);
-						c->cdrflags = winner->cdrflags;
+						new_cid_num = ast_strdup(S_OR(in->macroexten, in->exten));
+						new_cid_name = NULL; /* XXX no name ? */
+						src = winner;
 					} else {
-						c->cid.cid_num = ast_strdup(in->cid.cid_num);
-						c->cid.cid_name = ast_strdup(in->cid.cid_name);
-						ast_string_field_set(c, accountcode, in->accountcode);
-						c->cdrflags = in->cdrflags;
+						new_cid_num = ast_strdup(in->cid.cid_num);
+						new_cid_name = ast_strdup(in->cid.cid_name);
+						src = in;
 					}
-
-					if (in->cid.cid_ani) {
+					ast_string_field_set(c, accountcode, src->accountcode);
+					c->cdrflags = src->cdrflags;
+					S_REPLACE(c->cid.cid_num, new_cid_num);
+					S_REPLACE(c->cid.cid_name, new_cid_name);
+
+					if (in->cid.cid_ani) { /* XXX or maybe unconditional ? */
 						S_REPLACE(c->cid.cid_ani, ast_strdup(in->cid.cid_ani));
 					}
 					S_REPLACE(c->cid.cid_rdnis, ast_strdup(S_OR(in->macroexten, in->exten)));



More information about the svn-commits mailing list