[svn-commits] rmudgett: branch rmudgett/cid r265217 - in /team/rmudgett/cid: apps/ channels...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri May 21 19:07:54 CDT 2010


Author: rmudgett
Date: Fri May 21 19:07:50 2010
New Revision: 265217

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=265217
Log:
Move ast_channel.cid.cid_name to ast_channel.caller.id.name.str.

* Fixed caller ID name and number memory leak in chan_usbradio.c.

* Fixed uninitialized char arrays cid_num[] and cid_name[] in
sig_analog.c.

* Protected access to a caller channel with lock in chan_sip.c.

* Clarified intent of code in app_meetme.c sla_ring_station() and
dial_trunk().  Also made save all caller ID data instead of just the name
and number strings.

* Simplified cdr.c set_one_cid().  It hand coded the ast_callerid_merge()
function.

Modified:
    team/rmudgett/cid/apps/app_dial.c
    team/rmudgett/cid/apps/app_followme.c
    team/rmudgett/cid/apps/app_meetme.c
    team/rmudgett/cid/apps/app_minivm.c
    team/rmudgett/cid/apps/app_parkandannounce.c
    team/rmudgett/cid/apps/app_queue.c
    team/rmudgett/cid/apps/app_rpt.c
    team/rmudgett/cid/apps/app_voicemail.c
    team/rmudgett/cid/channels/chan_console.c
    team/rmudgett/cid/channels/chan_dahdi.c
    team/rmudgett/cid/channels/chan_misdn.c
    team/rmudgett/cid/channels/chan_sip.c
    team/rmudgett/cid/channels/chan_unistim.c
    team/rmudgett/cid/channels/chan_usbradio.c
    team/rmudgett/cid/channels/chan_vpb.cc
    team/rmudgett/cid/channels/sig_analog.c
    team/rmudgett/cid/channels/sig_pri.c
    team/rmudgett/cid/funcs/func_blacklist.c
    team/rmudgett/cid/include/asterisk/channel.h
    team/rmudgett/cid/main/ccss.c
    team/rmudgett/cid/main/cdr.c
    team/rmudgett/cid/main/channel.c
    team/rmudgett/cid/main/cli.c
    team/rmudgett/cid/main/features.c
    team/rmudgett/cid/main/manager.c
    team/rmudgett/cid/res/res_agi.c

Modified: team/rmudgett/cid/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/apps/app_dial.c?view=diff&rev=265217&r1=265216&r2=265217
==============================================================================
--- team/rmudgett/cid/apps/app_dial.c (original)
+++ team/rmudgett/cid/apps/app_dial.c Fri May 21 19:07:50 2010
@@ -764,9 +764,11 @@
 		"UniqueID: %s\r\n"
 		"DestUniqueID: %s\r\n"
 		"Dialstring: %s\r\n",
-		src->name, dst->name, S_OR(src->cid.cid_num, "<unknown>"),
-		S_OR(src->cid.cid_name, "<unknown>"), src->uniqueid,
-		dst->uniqueid, dialstring ? dialstring : "");
+		src->name, dst->name,
+		S_COR(src->caller.id.XXX_number.valid, src->caller.id.XXX_number.str, "<unknown>"),
+		S_COR(src->caller.id.XXX_name.valid, src->caller.id.XXX_name.str, "<unknown>"),
+		src->uniqueid, dst->uniqueid,
+		dialstring ? dialstring : "");
 }
 
 static void senddialendevent(struct ast_channel *src, const char *dialstatus)

Modified: team/rmudgett/cid/apps/app_followme.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/apps/app_followme.c?view=diff&rev=265217&r1=265216&r2=265217
==============================================================================
--- team/rmudgett/cid/apps/app_followme.c (original)
+++ team/rmudgett/cid/apps/app_followme.c Fri May 21 19:07:50 2010
@@ -838,7 +838,10 @@
 
 			outbound = ast_request("Local", ast_best_codec(caller->nativeformats), caller, dialarg, &dg);
 			if (outbound) {
-				ast_set_callerid(outbound, caller->cid.cid_num, caller->cid.cid_name, caller->cid.cid_num);
+				ast_set_callerid(outbound,
+					S_COR(caller->caller.id.XXX_number.valid, caller->caller.id.XXX_number.str, NULL),
+					S_COR(caller->caller.id.XXX_name.valid, caller->caller.id.XXX_name.str, NULL),
+					S_COR(caller->caller.id.XXX_number.valid, caller->caller.id.XXX_number.str, NULL));
 				ast_channel_inherit_variables(tpargs->chan, outbound);
 				ast_channel_datastore_inherit(tpargs->chan, outbound);
 				ast_string_field_set(outbound, language, tpargs->chan->language);

Modified: team/rmudgett/cid/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/apps/app_meetme.c?view=diff&rev=265217&r1=265216&r2=265217
==============================================================================
--- team/rmudgett/cid/apps/app_meetme.c (original)
+++ team/rmudgett/cid/apps/app_meetme.c Fri May 21 19:07:50 2010
@@ -1406,8 +1406,8 @@
 			if (!concise) {
 				ast_cli(a->fd, "User #: %-2.2d %12.12s %-20.20s Channel: %s %s %s %s %s %s %02d:%02d:%02d\n",
 					user->user_no,
-					S_OR(user->chan->cid.cid_num, "<unknown>"),
-					S_OR(user->chan->cid.cid_name, "<no name>"),
+					S_COR(user->chan->caller.id.XXX_number.valid, user->chan->caller.id.XXX_number.str, "<unknown>"),
+					S_COR(user->chan->caller.id.XXX_name.valid, user->chan->caller.id.XXX_name.str, "<no name>"),
 					user->chan->name,
 					ast_test_flag64(&user->userflags, CONFFLAG_ADMIN) ? "(Admin)" : "",
 					ast_test_flag64(&user->userflags, CONFFLAG_MONITOR) ? "(Listen only)" : "",
@@ -1417,8 +1417,8 @@
 			} else {
 				ast_cli(a->fd, "%d!%s!%s!%s!%s!%s!%s!%s!%d!%02d:%02d:%02d\n",
 					user->user_no,
-					S_OR(user->chan->cid.cid_num, ""),
-					S_OR(user->chan->cid.cid_name, ""),
+					S_COR(user->chan->caller.id.XXX_number.valid, user->chan->caller.id.XXX_number.str, ""),
+					S_COR(user->chan->caller.id.XXX_name.valid, user->chan->caller.id.XXX_name.str, ""),
 					user->chan->name,
 					ast_test_flag64(&user->userflags, CONFFLAG_ADMIN) ? "1" : "",
 					ast_test_flag64(&user->userflags, CONFFLAG_MONITOR) ? "1" : "",
@@ -2568,17 +2568,17 @@
 
 	if (!sent_event) {
 		ast_manager_event(chan, EVENT_FLAG_CALL, "MeetmeJoin",
-			        "Channel: %s\r\n"
-			        "Uniqueid: %s\r\n"
-				"Meetme: %s\r\n"
-				"Usernum: %d\r\n"
-				"CallerIDnum: %s\r\n"
-			      	"CallerIDname: %s\r\n",
-			      	chan->name, chan->uniqueid, conf->confno, 
-				user->user_no,
-				S_OR(user->chan->cid.cid_num, "<unknown>"),
-				S_OR(user->chan->cid.cid_name, "<unknown>")
-				);
+			"Channel: %s\r\n"
+			"Uniqueid: %s\r\n"
+			"Meetme: %s\r\n"
+			"Usernum: %d\r\n"
+			"CallerIDnum: %s\r\n"
+			"CallerIDname: %s\r\n",
+			chan->name, chan->uniqueid, conf->confno,
+			user->user_no,
+			S_COR(user->chan->caller.id.XXX_number.valid, user->chan->caller.id.XXX_number.str, "<unknown>"),
+			S_COR(user->chan->caller.id.XXX_name.valid, user->chan->caller.id.XXX_name.str, "<unknown>")
+			);
 		sent_event = 1;
 	}
 
@@ -3591,18 +3591,18 @@
 
 		if (sent_event) {
 			ast_manager_event(chan, EVENT_FLAG_CALL, "MeetmeLeave",
-				      "Channel: %s\r\n"
-				      "Uniqueid: %s\r\n"
-				      "Meetme: %s\r\n"
-				      "Usernum: %d\r\n"
-				      "CallerIDNum: %s\r\n"
-				      "CallerIDName: %s\r\n"
-				      "Duration: %ld\r\n",
-				      chan->name, chan->uniqueid, conf->confno, 
-				      user->user_no,
-				      S_OR(user->chan->cid.cid_num, "<unknown>"),
-				      S_OR(user->chan->cid.cid_name, "<unknown>"),
-				      (long)(now.tv_sec - user->jointime));
+				"Channel: %s\r\n"
+				"Uniqueid: %s\r\n"
+				"Meetme: %s\r\n"
+				"Usernum: %d\r\n"
+				"CallerIDNum: %s\r\n"
+				"CallerIDName: %s\r\n"
+				"Duration: %ld\r\n",
+				chan->name, chan->uniqueid, conf->confno,
+				user->user_no,
+				S_COR(user->chan->caller.id.XXX_number.valid, user->chan->caller.id.XXX_number.str, "<unknown>"),
+				S_COR(user->chan->caller.id.XXX_name.valid, user->chan->caller.id.XXX_name.str, "<unknown>"),
+				(long)(now.tv_sec - user->jointime));
 		}
 
 		if (setusercount) {
@@ -4596,30 +4596,30 @@
 		AST_LIST_TRAVERSE(&cnf->userlist, user, list) {
 			total++;
 			astman_append(s,
-			"Event: MeetmeList\r\n"
-			"%s"
-			"Conference: %s\r\n"
-			"UserNumber: %d\r\n"
-			"CallerIDNum: %s\r\n"
-			"CallerIDName: %s\r\n"
-			"Channel: %s\r\n"
-			"Admin: %s\r\n"
-			"Role: %s\r\n"
-			"MarkedUser: %s\r\n"
-			"Muted: %s\r\n"
-			"Talking: %s\r\n"
-			"\r\n",
-			idText,
-			cnf->confno,
-			user->user_no,
-			S_OR(user->chan->cid.cid_num, "<unknown>"),
-			S_OR(user->chan->cid.cid_name, "<no name>"),
-			user->chan->name,
-			ast_test_flag64(&user->userflags, CONFFLAG_ADMIN) ? "Yes" : "No",
-			ast_test_flag64(&user->userflags, CONFFLAG_MONITOR) ? "Listen only" : ast_test_flag64(&user->userflags, CONFFLAG_TALKER) ? "Talk only" : "Talk and listen",
-			ast_test_flag64(&user->userflags, CONFFLAG_MARKEDUSER) ? "Yes" : "No",
-			user->adminflags & ADMINFLAG_MUTED ? "By admin" : user->adminflags & ADMINFLAG_SELFMUTED ? "By self" : "No",
-			user->talking > 0 ? "Yes" : user->talking == 0 ? "No" : "Not monitored"); 
+				"Event: MeetmeList\r\n"
+				"%s"
+				"Conference: %s\r\n"
+				"UserNumber: %d\r\n"
+				"CallerIDNum: %s\r\n"
+				"CallerIDName: %s\r\n"
+				"Channel: %s\r\n"
+				"Admin: %s\r\n"
+				"Role: %s\r\n"
+				"MarkedUser: %s\r\n"
+				"Muted: %s\r\n"
+				"Talking: %s\r\n"
+				"\r\n",
+				idText,
+				cnf->confno,
+				user->user_no,
+				S_COR(user->chan->caller.id.XXX_number.valid, user->chan->caller.id.XXX_number.str, "<unknown>"),
+				S_COR(user->chan->caller.id.XXX_name.valid, user->chan->caller.id.XXX_name.str, "<no name>"),
+				user->chan->name,
+				ast_test_flag64(&user->userflags, CONFFLAG_ADMIN) ? "Yes" : "No",
+				ast_test_flag64(&user->userflags, CONFFLAG_MONITOR) ? "Listen only" : ast_test_flag64(&user->userflags, CONFFLAG_TALKER) ? "Talk only" : "Talk and listen",
+				ast_test_flag64(&user->userflags, CONFFLAG_MARKEDUSER) ? "Yes" : "No",
+				user->adminflags & ADMINFLAG_MUTED ? "By admin" : user->adminflags & ADMINFLAG_SELFMUTED ? "By self" : "No",
+				user->talking > 0 ? "Yes" : user->talking == 0 ? "No" : "Not monitored");
 		}
 	}
 	AST_LIST_UNLOCK(&confs);
@@ -5223,8 +5223,9 @@
 	char *tech, *tech_data;
 	struct ast_dial *dial;
 	struct sla_ringing_station *ringing_station;
-	const char *cid_name = NULL, *cid_num = NULL;
 	enum ast_dial_result res;
+	int caller_is_saved;
+	struct ast_party_caller caller;
 
 	if (!(dial = ast_dial_create()))
 		return -1;
@@ -5238,23 +5239,21 @@
 		return -1;
 	}
 
-	if (!sla.attempt_callerid && !ast_strlen_zero(ringing_trunk->trunk->chan->cid.cid_name)) {
-		cid_name = ast_strdupa(ringing_trunk->trunk->chan->cid.cid_name);
-		ast_free(ringing_trunk->trunk->chan->cid.cid_name);
-		ringing_trunk->trunk->chan->cid.cid_name = NULL;
-	}
-	if (!sla.attempt_callerid && !ast_strlen_zero(ringing_trunk->trunk->chan->cid.cid_num)) {
-		cid_num = ast_strdupa(ringing_trunk->trunk->chan->cid.cid_num);
-		ast_free(ringing_trunk->trunk->chan->cid.cid_num);
-		ringing_trunk->trunk->chan->cid.cid_num = NULL;
+	/* Do we need to save off the caller ID data? */
+	caller_is_saved = 0;
+	if (!sla.attempt_callerid) {
+		caller_is_saved = 1;
+		caller = ringing_trunk->trunk->chan->caller;
+		ast_party_caller_init(&ringing_trunk->trunk->chan->caller);
 	}
 
 	res = ast_dial_run(dial, ringing_trunk->trunk->chan, 1);
 	
-	if (cid_name)
-		ringing_trunk->trunk->chan->cid.cid_name = ast_strdup(cid_name);
-	if (cid_num)
-		ringing_trunk->trunk->chan->cid.cid_num = ast_strdup(cid_num);
+	/* Restore saved caller ID */
+	if (caller_is_saved) {
+		ast_party_caller_free(&ringing_trunk->trunk->chan->caller);
+		ringing_trunk->trunk->chan->caller = caller;
+	}
 	
 	if (res != AST_DIAL_RESULT_TRYING) {
 		struct sla_failed_station *failed_station;
@@ -5758,7 +5757,8 @@
 	struct ast_conference *conf;
 	struct ast_flags64 conf_flags = { 0 };
 	struct sla_trunk_ref *trunk_ref = args->trunk_ref;
-	const char *cid_name = NULL, *cid_num = NULL;
+	int caller_is_saved;
+	struct ast_party_caller caller;
 
 	if (!(dial = ast_dial_create())) {
 		ast_mutex_lock(args->cond_lock);
@@ -5777,23 +5777,21 @@
 		return NULL;
 	}
 
-	if (!sla.attempt_callerid && !ast_strlen_zero(trunk_ref->chan->cid.cid_name)) {
-		cid_name = ast_strdupa(trunk_ref->chan->cid.cid_name);
-		ast_free(trunk_ref->chan->cid.cid_name);
-		trunk_ref->chan->cid.cid_name = NULL;
-	}
-	if (!sla.attempt_callerid && !ast_strlen_zero(trunk_ref->chan->cid.cid_num)) {
-		cid_num = ast_strdupa(trunk_ref->chan->cid.cid_num);
-		ast_free(trunk_ref->chan->cid.cid_num);
-		trunk_ref->chan->cid.cid_num = NULL;
+	/* Do we need to save of the caller ID data? */
+	caller_is_saved = 0;
+	if (!sla.attempt_callerid) {
+		caller_is_saved = 1;
+		caller = trunk_ref->chan->caller;
+		ast_party_caller_init(&trunk_ref->chan->caller);
 	}
 
 	dial_res = ast_dial_run(dial, trunk_ref->chan, 1);
 
-	if (cid_name)
-		trunk_ref->chan->cid.cid_name = ast_strdup(cid_name);
-	if (cid_num)
-		trunk_ref->chan->cid.cid_num = ast_strdup(cid_num);
+	/* Restore saved caller ID */
+	if (caller_is_saved) {
+		ast_party_caller_free(&trunk_ref->chan->caller);
+		trunk_ref->chan->caller = caller;
+	}
 
 	if (dial_res != AST_DIAL_RESULT_TRYING) {
 		ast_mutex_lock(args->cond_lock);

Modified: team/rmudgett/cid/apps/app_minivm.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/apps/app_minivm.c?view=diff&rev=265217&r1=265216&r2=265217
==============================================================================
--- team/rmudgett/cid/apps/app_minivm.c (original)
+++ team/rmudgett/cid/apps/app_minivm.c Fri May 21 19:07:50 2010
@@ -1731,7 +1731,10 @@
 	snprintf(arguments, sizeof(arguments), "%s %s@%s %s %s&", 
 		ast_strlen_zero(vmu->externnotify) ? global_externnotify : vmu->externnotify, 
 		vmu->username, vmu->domain,
-		chan->cid.cid_name, chan->cid.cid_num);
+		(chan->caller.id.XXX_name.valid && chan->caller.id.XXX_name.str)
+			? chan->caller.id.XXX_name.str : "",
+		(chan->caller.id.XXX_number.valid && chan->caller.id.XXX_number.str)
+			? chan->caller.id.XXX_number.str : "");
 
 	ast_debug(1, "Executing: %s\n", arguments);
 	ast_safe_system(arguments);
@@ -1917,6 +1920,10 @@
 		ast_localtime(&now, &tm, NULL);
 		ast_strftime(timebuf, sizeof(timebuf), "%H:%M:%S", &tm);
 
+		ast_callerid_merge(callerid, sizeof(callerid),
+			S_COR(chan->caller.id.XXX_name.valid, chan->caller.id.XXX_name.str, NULL),
+			S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL),
+			"Unknown");
 		snprintf(logbuf, sizeof(logbuf),
 			/* "Mailbox:domain:macrocontext:exten:priority:callerchan:callerid:origdate:origtime:duration:durationstatus:accountcode" */
 			"%s:%s:%s:%s:%d:%s:%s:%s:%s:%d:%s:%s\n",
@@ -1926,7 +1933,7 @@
 			chan->exten,
 			chan->priority,
 			chan->name,
-			ast_callerid_merge(callerid, sizeof(callerid), chan->cid.cid_name, chan->cid.cid_num, "Unknown"),
+			callerid,
 			date, 
 			timebuf,
 			duration,
@@ -2118,7 +2125,10 @@
 			duration_string = ast_strdupa(duration_string);
 		}
 		ast_channel_unlock(chan);
-		res = notify_new_message(chan, template, vmu, filename, atoi(duration_string), format, chan->cid.cid_num, chan->cid.cid_name);
+		res = notify_new_message(chan, template, vmu, filename, atoi(duration_string),
+			format,
+			S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL),
+			S_COR(chan->caller.id.XXX_name.valid, chan->caller.id.XXX_name.str, NULL));
 	}
 
 	pbx_builtin_setvar_helper(chan, "MVM_NOTIFY_STATUS", res == 0 ? "SUCCESS" : "FAILED");

Modified: team/rmudgett/cid/apps/app_parkandannounce.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/apps/app_parkandannounce.c?view=diff&rev=265217&r1=265216&r2=265217
==============================================================================
--- team/rmudgett/cid/apps/app_parkandannounce.c (original)
+++ team/rmudgett/cid/apps/app_parkandannounce.c Fri May 21 19:07:50 2010
@@ -145,8 +145,11 @@
 	snprintf(buf, sizeof(buf), "%d", lot);
 	oh.parent_channel = chan;
 	oh.vars = ast_variable_new("_PARKEDAT", buf, "");
-	dchan = __ast_request_and_dial(dialtech, AST_FORMAT_SLINEAR, chan, args.dial, 30000, &outstate, chan->cid.cid_num, chan->cid.cid_name, &oh);
-
+	dchan = __ast_request_and_dial(dialtech, AST_FORMAT_SLINEAR, chan, args.dial, 30000,
+		&outstate,
+		S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL),
+		S_COR(chan->caller.id.XXX_name.valid, chan->caller.id.XXX_name.str, NULL),
+		&oh);
 	if (dchan) {
 		if (dchan->_state == AST_STATE_UP) {
 			ast_verb(4, "Channel %s was answered.\n", dchan->name);

Modified: team/rmudgett/cid/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/apps/app_queue.c?view=diff&rev=265217&r1=265216&r2=265217
==============================================================================
--- team/rmudgett/cid/apps/app_queue.c (original)
+++ team/rmudgett/cid/apps/app_queue.c Fri May 21 19:07:50 2010
@@ -2327,8 +2327,8 @@
 		ast_manager_event(qe->chan, EVENT_FLAG_CALL, "Join",
 			"Channel: %s\r\nCallerIDNum: %s\r\nCallerIDName: %s\r\nQueue: %s\r\nPosition: %d\r\nCount: %d\r\nUniqueid: %s\r\n",
 			qe->chan->name,
-			S_OR(qe->chan->cid.cid_num, "unknown"), /* XXX somewhere else it is <unknown> */
-			S_OR(qe->chan->cid.cid_name, "unknown"),
+			S_COR(qe->chan->caller.id.XXX_number.valid, qe->chan->caller.id.XXX_number.str, "unknown"),/* XXX somewhere else it is <unknown> */
+			S_COR(qe->chan->caller.id.XXX_name.valid, qe->chan->caller.id.XXX_name.str, "unknown"),
 			q->name, qe->pos, q->count, qe->chan->uniqueid );
 		ast_debug(1, "Queue '%s' Join, Channel '%s', Position '%d'\n", q->name, qe->chan->name, qe->pos );
 	}
@@ -2953,23 +2953,23 @@
 		char vars[2048];
 
 		manager_event(EVENT_FLAG_AGENT, "AgentCalled",
-					"Queue: %s\r\n"
-					"AgentCalled: %s\r\n"
-					"AgentName: %s\r\n"
-					"ChannelCalling: %s\r\n"
-					"DestinationChannel: %s\r\n"
-					"CallerIDNum: %s\r\n"
-					"CallerIDName: %s\r\n"
-					"Context: %s\r\n"
-					"Extension: %s\r\n"
-					"Priority: %d\r\n"
-					"Uniqueid: %s\r\n"
-					"%s",
-					qe->parent->name, tmp->interface, tmp->member->membername, qe->chan->name, tmp->chan->name,
-					tmp->chan->cid.cid_num ? tmp->chan->cid.cid_num : "unknown",
-					tmp->chan->cid.cid_name ? tmp->chan->cid.cid_name : "unknown",
-					qe->chan->context, qe->chan->exten, qe->chan->priority, qe->chan->uniqueid,
-					qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
+			"Queue: %s\r\n"
+			"AgentCalled: %s\r\n"
+			"AgentName: %s\r\n"
+			"ChannelCalling: %s\r\n"
+			"DestinationChannel: %s\r\n"
+			"CallerIDNum: %s\r\n"
+			"CallerIDName: %s\r\n"
+			"Context: %s\r\n"
+			"Extension: %s\r\n"
+			"Priority: %d\r\n"
+			"Uniqueid: %s\r\n"
+			"%s",
+			qe->parent->name, tmp->interface, tmp->member->membername, qe->chan->name, tmp->chan->name,
+			S_COR(tmp->chan->caller.id.XXX_number.valid, tmp->chan->caller.id.XXX_number.str, "unknown"),
+			S_COR(tmp->chan->caller.id.XXX_name.valid, tmp->chan->caller.id.XXX_name.str, "unknown"),
+			qe->chan->context, qe->chan->exten, qe->chan->priority, qe->chan->uniqueid,
+			qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
 		ast_verb(3, "Called %s\n", tmp->interface);
 	}
 	ast_channel_unlock(tmp->chan);
@@ -6992,8 +6992,8 @@
 					"%s"
 					"\r\n",
 					q->name, pos++, qe->chan->name, qe->chan->uniqueid,
-					S_OR(qe->chan->cid.cid_num, "unknown"),
-					S_OR(qe->chan->cid.cid_name, "unknown"),
+					S_COR(qe->chan->caller.id.XXX_number.valid, qe->chan->caller.id.XXX_number.str, "unknown"),
+					S_COR(qe->chan->caller.id.XXX_name.valid, qe->chan->caller.id.XXX_name.str, "unknown"),
 					(long) (now - qe->start), idText);
 			}
 		}

Modified: team/rmudgett/cid/apps/app_rpt.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/apps/app_rpt.c?view=diff&rev=265217&r1=265216&r2=265217
==============================================================================
--- team/rmudgett/cid/apps/app_rpt.c (original)
+++ team/rmudgett/cid/apps/app_rpt.c Fri May 21 19:07:50 2010
@@ -5454,14 +5454,14 @@
 		if(instr){
 			ast_callerid_parse(instr, &name, &loc);
 			if(loc){
-				if(mychannel->cid.cid_num)
-					ast_free(mychannel->cid.cid_num);
-				mychannel->cid.cid_num = ast_strdup(loc);
+				mychannel->caller.id.XXX_number.valid = 1;
+				ast_free(mychannel->caller.id.XXX_number.str);
+				mychannel->caller.id.XXX_number.str = ast_strdup(loc);
 			}
 			if(name){
-				if(mychannel->cid.cid_name)
-					ast_free(mychannel->cid.cid_name);
-				mychannel->cid.cid_name = ast_strdup(name);
+				mychannel->caller.id.XXX_name.valid = 1;
+				ast_free(mychannel->caller.id.XXX_name.str);
+				mychannel->caller.id.XXX_name.str = ast_strdup(name);
 			}
 			ast_free(instr);
 		}

Modified: team/rmudgett/cid/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/apps/app_voicemail.c?view=diff&rev=265217&r1=265216&r2=265217
==============================================================================
--- team/rmudgett/cid/apps/app_voicemail.c (original)
+++ team/rmudgett/cid/apps/app_voicemail.c Fri May 21 19:07:50 2010
@@ -2193,7 +2193,10 @@
 		imap_delete_old_greeting(fn, vms);
 	}
 
-	make_email_file(p, myserveremail, vmu, msgnum, vmu->context, vmu->mailbox, "INBOX", S_OR(chan->cid.cid_num, NULL), S_OR(chan->cid.cid_name, NULL), fn, introfn, fmt, duration, 1, chan, NULL, 1, flag);
+	make_email_file(p, myserveremail, vmu, msgnum, vmu->context, vmu->mailbox, "INBOX",
+		S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL),
+		S_COR(chan->caller.id.XXX_name.valid, chan->caller.id.XXX_name.str, NULL),
+		fn, introfn, fmt, duration, 1, chan, NULL, 1, flag);
 	/* read mail file to memory */
 	len = ftell(p);
 	rewind(p);
@@ -5171,7 +5174,10 @@
 		res = -1;
 	}
 	ast_unlock_path(todir);
-	notify_new_message(chan, recip, NULL, recipmsgnum, duration, fmt, S_OR(chan->cid.cid_num, NULL), S_OR(chan->cid.cid_name, NULL), flag);
+	notify_new_message(chan, recip, NULL, recipmsgnum, duration, fmt,
+		S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL),
+		S_COR(chan->caller.id.XXX_name.valid, chan->caller.id.XXX_name.str, NULL),
+		flag);
 	
 	return res;
 }
@@ -5707,13 +5713,33 @@
 			snprintf(priority, sizeof(priority), "%d", chan->priority);
 			snprintf(origtime, sizeof(origtime), "%ld", (long) time(NULL));
 			get_date(date, sizeof(date));
-			ast_store_realtime("voicemail_data", "origmailbox", ext, "context", chan->context, "macrocontext", chan->macrocontext, "exten", chan->exten, "priority", priority, "callerchan", chan->name, "callerid", ast_callerid_merge(callerid, sizeof(callerid), chan->cid.cid_name, chan->cid.cid_num, "Unknown"), "origdate", date, "origtime", origtime, "category", S_OR(category, ""), "filename", tmptxtfile, SENTINEL);
+			ast_callerid_merge(callerid, sizeof(callerid),
+				S_COR(chan->caller.id.XXX_name.valid, chan->caller.id.XXX_name.str, NULL),
+				S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL),
+				"Unknown");
+			ast_store_realtime("voicemail_data",
+				"origmailbox", ext,
+				"context", chan->context,
+				"macrocontext", chan->macrocontext,
+				"exten", chan->exten,
+				"priority", priority,
+				"callerchan", chan->name,
+				"callerid", callerid,
+				"origdate", date,
+				"origtime", origtime,
+				"category", S_OR(category, ""),
+				"filename", tmptxtfile,
+				SENTINEL);
 		}
 
 		/* Store information */
 		txt = fdopen(txtdes, "w+");
 		if (txt) {
 			get_date(date, sizeof(date));
+			ast_callerid_merge(callerid, sizeof(callerid),
+				S_COR(chan->caller.id.XXX_name.valid, chan->caller.id.XXX_name.str, NULL),
+				S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL),
+				"Unknown");
 			fprintf(txt, 
 				";\n"
 				"; Message Information file\n"
@@ -5735,7 +5761,7 @@
 				chan->exten,
 				chan->priority,
 				chan->name,
-				ast_callerid_merge(callerid, sizeof(callerid), S_OR(chan->cid.cid_name, NULL), S_OR(chan->cid.cid_num, NULL), "Unknown"),
+				callerid,
 				date, (long) time(NULL),
 				category ? category : "");
 		} else {
@@ -5849,9 +5875,15 @@
 					/* Notification needs to happen after the copy, though. */
 					if (ast_fileexists(fn, NULL, NULL)) {
 #ifdef IMAP_STORAGE
-						notify_new_message(chan, vmu, vms, msgnum, duration, fmt, S_OR(chan->cid.cid_num, NULL), S_OR(chan->cid.cid_name, NULL), flag);
+						notify_new_message(chan, vmu, vms, msgnum, duration, fmt,
+							S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL),
+							S_COR(chan->caller.id.XXX_name.valid, chan->caller.id.XXX_name.str, NULL),
+							flag);
 #else
-						notify_new_message(chan, vmu, NULL, msgnum, duration, fmt, S_OR(chan->cid.cid_num, NULL), S_OR(chan->cid.cid_name, NULL), flag);
+						notify_new_message(chan, vmu, NULL, msgnum, duration, fmt,
+							S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL),
+							S_COR(chan->caller.id.XXX_name.valid, chan->caller.id.XXX_name.str, NULL),
+							flag);
 #endif
 					}
 
@@ -7034,7 +7066,12 @@
 					myserveremail = vmtmp->serveremail;
 				attach_user_voicemail = ast_test_flag(vmtmp, VM_ATTACH);
 				/* NULL category for IMAP storage */
-				sendmail(myserveremail, vmtmp, todircount, vmtmp->context, vmtmp->mailbox, dstvms->curbox, S_OR(chan->cid.cid_num, NULL), S_OR(chan->cid.cid_name, NULL), vmstmp.fn, vmstmp.introfn, fmt, duration, attach_user_voicemail, chan, NULL, urgent_str);
+				sendmail(myserveremail, vmtmp, todircount, vmtmp->context, vmtmp->mailbox,
+					dstvms->curbox,
+					S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL),
+					S_COR(chan->caller.id.XXX_name.valid, chan->caller.id.XXX_name.str, NULL),
+					vmstmp.fn, vmstmp.introfn, fmt, duration, attach_user_voicemail, chan,
+					NULL, urgent_str);
 #else
 				copy_msg_result = copy_message(chan, sender, 0, curmsg, duration, vmtmp, fmt, dir, urgent_str);
 #endif

Modified: team/rmudgett/cid/channels/chan_console.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/channels/chan_console.c?view=diff&rev=265217&r1=265216&r2=265217
==============================================================================
--- team/rmudgett/cid/channels/chan_console.c (original)
+++ team/rmudgett/cid/channels/chan_console.c Fri May 21 19:07:50 2010
@@ -566,7 +566,9 @@
 	enum ast_control_frame_type ctrl;
 
 	ast_verb(1, V_BEGIN "Call to device '%s' on console from '%s' <%s>" V_END,
-		dest, c->cid.cid_name, c->cid.cid_num);
+		dest,
+		S_COR(c->caller.id.XXX_name.valid, c->caller.id.XXX_name.str, ""),
+		S_COR(c->caller.id.XXX_number.valid, c->caller.id.XXX_number.str, ""));
 
 	console_pvt_lock(pvt);
 

Modified: team/rmudgett/cid/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/channels/chan_dahdi.c?view=diff&rev=265217&r1=265216&r2=265217
==============================================================================
--- team/rmudgett/cid/channels/chan_dahdi.c (original)
+++ team/rmudgett/cid/channels/chan_dahdi.c Fri May 21 19:07:50 2010
@@ -7844,10 +7844,16 @@
 					cid_num[0] = 0;
 					cid_name[0] = 0;
 					if (p->dahditrcallerid && p->owner) {
-						if (p->owner->cid.cid_num)
-							ast_copy_string(cid_num, p->owner->cid.cid_num, sizeof(cid_num));
-						if (p->owner->cid.cid_name)
-							ast_copy_string(cid_name, p->owner->cid.cid_name, sizeof(cid_name));
+						if (p->owner->caller.id.XXX_number.valid
+							&& p->owner->caller.id.XXX_number.str) {
+							ast_copy_string(cid_num, p->owner->caller.id.XXX_number.str,
+								sizeof(cid_num));
+						}
+						if (p->owner->caller.id.XXX_name.valid
+							&& p->owner->caller.id.XXX_name.str) {
+							ast_copy_string(cid_name, p->owner->caller.id.XXX_name.str,
+								sizeof(cid_name));
+						}
 					}
 					/* XXX This section needs much more error checking!!! XXX */
 					/* Start a 3-way call if feasible */
@@ -9595,12 +9601,10 @@
 				ast_verb(3, "Disabling Caller*ID on %s\n", chan->name);
 				/* Disable Caller*ID if enabled */
 				p->hidecallerid = 1;
-				if (chan->cid.cid_num)
-					ast_free(chan->cid.cid_num);
-				chan->cid.cid_num = NULL;
-				if (chan->cid.cid_name)
-					ast_free(chan->cid.cid_name);
-				chan->cid.cid_name = NULL;
+				ast_party_number_free(&chan->caller.id.XXX_number);
+				ast_party_number_init(&chan->caller.id.XXX_number);
+				ast_party_name_free(&chan->caller.id.XXX_name);
+				ast_party_name_init(&chan->caller.id.XXX_name);
 				res = tone_zone_play_tone(p->subs[idx].dfd, DAHDI_TONE_DIALRECALL);
 				if (res) {
 					ast_log(LOG_WARNING, "Unable to do dial recall on channel %s: %s\n",
@@ -9650,12 +9654,6 @@
 				ast_verb(3, "Enabling Caller*ID on %s\n", chan->name);
 				/* Enable Caller*ID if enabled */
 				p->hidecallerid = 0;
-				if (chan->cid.cid_num)
-					ast_free(chan->cid.cid_num);
-				chan->cid.cid_num = NULL;
-				if (chan->cid.cid_name)
-					ast_free(chan->cid.cid_name);
-				chan->cid.cid_name = NULL;
 				ast_set_callerid(chan, p->cid_num, p->cid_name, NULL);
 				res = tone_zone_play_tone(p->subs[idx].dfd, DAHDI_TONE_DIALRECALL);
 				if (res) {

Modified: team/rmudgett/cid/channels/chan_misdn.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/channels/chan_misdn.c?view=diff&rev=265217&r1=265216&r2=265217
==============================================================================
--- team/rmudgett/cid/channels/chan_misdn.c (original)
+++ team/rmudgett/cid/channels/chan_misdn.c Fri May 21 19:07:50 2010
@@ -4121,8 +4121,10 @@
 		bc->nt ? "NT" : "TE",
 		help->originator == ORG_AST ? "*" : "I",
 		ast ? ast->exten : "",
-		(ast && ast->cid.cid_name) ? ast->cid.cid_name : "",
-		(ast && ast->cid.cid_num) ? ast->cid.cid_num : "",
+		(ast && ast->caller.id.XXX_name.valid && ast->caller.id.XXX_name.str)
+			? ast->caller.id.XXX_name.str : "",
+		(ast && ast->caller.id.XXX_number.valid && ast->caller.id.XXX_number.str)
+			? ast->caller.id.XXX_number.str : "",
 		bc->redirecting.from.name,
 		bc->redirecting.from.number,
 		bc->redirecting.to.name,
@@ -4216,8 +4218,10 @@
 					" --> hold_channel: %d\n",
 					help->l3id,
 					ast->exten,
-					ast->cid.cid_name ? ast->cid.cid_name : "",
-					ast->cid.cid_num ? ast->cid.cid_num : "",
+					(ast->caller.id.XXX_name.valid && ast->caller.id.XXX_name.str)
+						? ast->caller.id.XXX_name.str : "",
+					(ast->caller.id.XXX_number.valid && ast->caller.id.XXX_number.str)
+						? ast->caller.id.XXX_number.str : "",
 					help->hold.port,
 					help->hold.channel
 					);
@@ -6975,8 +6979,10 @@
 		bc->pid,
 		ast->context,
 		ast->exten,
-		ast->cid.cid_name ? ast->cid.cid_name : "",
-		ast->cid.cid_num ? ast->cid.cid_num : "",
+		(ast->caller.id.XXX_name.valid && ast->caller.id.XXX_name.str)
+			? ast->caller.id.XXX_name.str : "",
+		(ast->caller.id.XXX_number.valid && ast->caller.id.XXX_number.str)
+			? ast->caller.id.XXX_number.str : "",
 		misdn_get_ch_state(p));
 	chan_misdn_log(3, bc->port, " --> l3id:%x\n", p->l3id);
 	chan_misdn_log(3, bc->port, " --> cause:%d\n", bc->cause);
@@ -8216,8 +8222,10 @@
 			bc->pid,
 			ast->context,
 			ast->exten,
-			ast->cid.cid_name ? ast->cid.cid_name : "",
-			ast->cid.cid_num ? ast->cid.cid_num : "");
+			(ast->caller.id.XXX_name.valid && ast->caller.id.XXX_name.str)
+				? ast->caller.id.XXX_name.str : "",
+			(ast->caller.id.XXX_number.valid && ast->caller.id.XXX_number.str)
+				? ast->caller.id.XXX_number.str : "");
 
 		if (ast->_state != AST_STATE_RESERVED) {
 			chan_misdn_log(3, bc->port, " --> Setting AST State to down\n");
@@ -8367,8 +8375,10 @@
 		"* Starting Ast context:%s dialed:%s caller:\"%s\" <%s> with 's' extension\n",
 		ast->context,
 		ast->exten,
-		ast->cid.cid_name ? ast->cid.cid_name : "",
-		ast->cid.cid_num ? ast->cid.cid_num : "");
+		(ast->caller.id.XXX_name.valid && ast->caller.id.XXX_name.str)
+			? ast->caller.id.XXX_name.str : "",
+		(ast->caller.id.XXX_number.valid && ast->caller.id.XXX_number.str)
+			? ast->caller.id.XXX_number.str : "");
 
 	strcpy(ast->exten, "s");
 

Modified: team/rmudgett/cid/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/channels/chan_sip.c?view=diff&rev=265217&r1=265216&r2=265217
==============================================================================
--- team/rmudgett/cid/channels/chan_sip.c (original)
+++ team/rmudgett/cid/channels/chan_sip.c Fri May 21 19:07:50 2010
@@ -11036,11 +11036,17 @@
 				struct ast_channel *caller;
 
 				if ((caller = ast_channel_callback(find_calling_channel, NULL, p, 0))) {
-					int need = strlen(caller->cid.cid_num) + strlen(p->fromdomain) + sizeof("sip:@");
+					char *cid_num;
+					int need;
+
+					ast_channel_lock(caller);
+					cid_num = S_COR(caller->caller.id.XXX_number.valid,
+						caller->caller.id.XXX_number.str, "");
+					need = strlen(cid_num) + strlen(p->fromdomain) + sizeof("sip:@");
 					local_target = alloca(need);
-					ast_channel_lock(caller);
-					snprintf(local_target, need, "sip:%s@%s", caller->cid.cid_num, p->fromdomain);
-					local_display = ast_strdupa(caller->cid.cid_name);
+					snprintf(local_target, need, "sip:%s@%s", cid_num, p->fromdomain);
+					local_display = ast_strdupa(S_COR(caller->caller.id.XXX_name.valid,
+						caller->caller.id.XXX_name.str, ""));
 					ast_channel_unlock(caller);
 					caller = ast_channel_unref(caller);
 				}

Modified: team/rmudgett/cid/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/channels/chan_unistim.c?view=diff&rev=265217&r1=265216&r2=265217
==============================================================================
--- team/rmudgett/cid/channels/chan_unistim.c (original)
+++ team/rmudgett/cid/channels/chan_unistim.c Fri May 21 19:07:50 2010
@@ -4496,8 +4496,12 @@
 		instr = ast_strdup(l->cid_num);
 		if (instr) {
 			ast_callerid_parse(instr, &name, &loc);
-			tmp->cid.cid_num = ast_strdup(loc);
-			tmp->cid.cid_name = ast_strdup(name);
+			tmp->caller.id.XXX_number.valid = 1;
+			ast_free(tmp->caller.id.XXX_number.str);
+			tmp->caller.id.XXX_number.str = ast_strdup(loc);
+			tmp->caller.id.XXX_name.valid = 1;
+			ast_free(tmp->caller.id.XXX_name.str);
+			tmp->caller.id.XXX_name.str = ast_strdup(name);
 			ast_free(instr);
 		}
 	}

Modified: team/rmudgett/cid/channels/chan_usbradio.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/channels/chan_usbradio.c?view=diff&rev=265217&r1=265216&r2=265217
==============================================================================
--- team/rmudgett/cid/channels/chan_usbradio.c (original)
+++ team/rmudgett/cid/channels/chan_usbradio.c Fri May 21 19:07:50 2010
@@ -2202,9 +2202,7 @@
 		ast_string_field_set(c, language, o->language);
 	/* Don't use ast_set_callerid() here because it will
 	 * generate a needless NewCallerID event */
-	c->cid.cid_num = ast_strdup(o->cid_num);
 	c->caller.ani = ast_strdup(o->cid_num);
-	c->cid.cid_name = ast_strdup(o->cid_name);
 	if (!ast_strlen_zero(ext)) {
 		c->dialed.number.str = ast_strdup(ext);
 	}

Modified: team/rmudgett/cid/channels/chan_vpb.cc
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/channels/chan_vpb.cc?view=diff&rev=265217&r1=265216&r2=265217
==============================================================================
--- team/rmudgett/cid/channels/chan_vpb.cc (original)
+++ team/rmudgett/cid/channels/chan_vpb.cc Fri May 21 19:07:50 2010
@@ -693,7 +693,9 @@
 					strcpy(p->cid_num, cli_struct->cldn);
 					strcpy(p->cid_name, cli_struct->cn);
 				}
-				ast_verb(4, "CID record - got [%s] [%s]\n", owner->cid.cid_num, owner->cid.cid_name);
+				ast_verb(4, "CID record - got [%s] [%s]\n",
+					S_COR(owner->caller.id.XXX_number.valid, owner->caller.id.XXX_number.str, ""),
+					S_COR(owner->caller.id.XXX_name.valid, owner->caller.id.XXX_name.str, ""));
 				snprintf(p->callerid, sizeof(p->callerid), "%s %s", cli_struct->cldn, cli_struct->cn);
 			} else {
 				ast_log(LOG_ERROR, "CID record - No caller id avalable on %s \n", p->dev);
@@ -778,14 +780,10 @@
 	} else {
 		ast_log(LOG_ERROR, "%s: Failed to create Caller ID struct\n", p->dev);
 	}
-	if (owner->cid.cid_num) {
-		ast_free(owner->cid.cid_num);
-		owner->cid.cid_num = NULL;
-	}
-	if (owner->cid.cid_name) {
-		ast_free(owner->cid.cid_name);
-		owner->cid.cid_name = NULL;
-	}
+	ast_party_number_free(&owner->caller.id.XXX_number);
+	ast_party_number_init(&owner->caller.id.XXX_number);
+	ast_party_name_free(&owner->caller.id.XXX_name);
+	ast_party_name_init(&owner->caller.id.XXX_name);
 	if (number)
 		ast_shrink_phone_number(number);
 	ast_set_callerid(owner,

Modified: team/rmudgett/cid/channels/sig_analog.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/channels/sig_analog.c?view=diff&rev=265217&r1=265216&r2=265217
==============================================================================
--- team/rmudgett/cid/channels/sig_analog.c (original)
+++ team/rmudgett/cid/channels/sig_analog.c Fri May 21 19:07:50 2010
@@ -1823,7 +1823,8 @@
 
 		analog_dsp_set_digitmode(p, ANALOG_DIGITMODE_DTMF);
 
-		if (ast_exists_extension(chan, chan->context, exten, 1, chan->cid.cid_num)) {
+		if (ast_exists_extension(chan, chan->context, exten, 1,
+			chan->caller.id.XXX_number.valid ? chan->caller.id.XXX_number.str : NULL)) {
 			ast_copy_string(chan->exten, exten, sizeof(chan->exten));
 			analog_dsp_reset_and_flush_digits(p);
 			res = ast_pbx_run(chan);
@@ -1979,14 +1980,10 @@
 				ast_verb(3, "Disabling Caller*ID on %s\n", chan->name);
 				/* Disable Caller*ID if enabled */
 				p->hidecallerid = 1;
-				if (chan->cid.cid_num) {
-					free(chan->cid.cid_num);
-				}
-				chan->cid.cid_num = NULL;
-				if (chan->cid.cid_name) {
-					free(chan->cid.cid_name);
-				}
-				chan->cid.cid_name = NULL;
+				ast_party_number_free(&chan->caller.id.XXX_number);
+				ast_party_number_init(&chan->caller.id.XXX_number);
+				ast_party_name_free(&chan->caller.id.XXX_name);
+				ast_party_name_init(&chan->caller.id.XXX_name);
 				res = analog_play_tone(p, index, ANALOG_TONE_DIALRECALL);
 				if (res) {
 					ast_log(LOG_WARNING, "Unable to do dial recall on channel %s: %s\n",
@@ -2058,14 +2055,6 @@
 				ast_verb(3, "Enabling Caller*ID on %s\n", chan->name);
 				/* Enable Caller*ID if enabled */
 				p->hidecallerid = 0;
-				if (chan->cid.cid_num) {
-					free(chan->cid.cid_num);
-				}
-				chan->cid.cid_num = NULL;
-				if (chan->cid.cid_name) {
-					free(chan->cid.cid_name);
-				}
-				chan->cid.cid_name = NULL;
 				ast_set_callerid(chan, p->cid_num, p->cid_name, NULL);
 				res = analog_play_tone(p, index, ANALOG_TONE_DIALRECALL);
 				if (res) {
@@ -2111,9 +2100,13 @@
 					ast_hangup(chan);
 					goto quit;
 				}
-			} else if (!ast_canmatch_extension(chan, chan->context, exten, 1, chan->cid.cid_num) &&
-							((exten[0] != '*') || (strlen(exten) > 2))) {
-				ast_debug(1, "Can't match %s from '%s' in context %s\n", exten, chan->cid.cid_num ? chan->cid.cid_num : "<Unknown Caller>", chan->context);
+			} else if (!ast_canmatch_extension(chan, chan->context, exten, 1,
+				chan->caller.id.XXX_number.valid ? chan->caller.id.XXX_number.str : NULL)
+				&& ((exten[0] != '*') || (strlen(exten) > 2))) {
+				ast_debug(1, "Can't match %s from '%s' in context %s\n", exten,
+					chan->caller.id.XXX_number.valid && chan->caller.id.XXX_number.str
+						? chan->caller.id.XXX_number.str : "<Unknown Caller>",
+					chan->context);
 				break;
 			}
 			if (!timeout) {
@@ -2872,20 +2865,26 @@
 				}
 				ast_queue_control(p->subs[ANALOG_SUB_REAL].owner, AST_CONTROL_UNHOLD);
 			} else if (!p->subs[ANALOG_SUB_THREEWAY].owner) {
-				char cid_num[256];
-				char cid_name[256];
-
 				if (!p->threewaycalling) {
 					/* Just send a flash if no 3-way calling */
 					ast_queue_control(p->subs[ANALOG_SUB_REAL].owner, AST_CONTROL_FLASH);
 					goto winkflashdone;
 				} else if (!analog_check_for_conference(p)) {
+					char cid_num[256];
+					char cid_name[256];
+
+					cid_num[0] = '\0';
+					cid_name[0] = '\0';
 					if (p->dahditrcallerid && p->owner) {
-						if (p->owner->cid.cid_num) {
-							ast_copy_string(cid_num, p->owner->cid.cid_num, sizeof(cid_num));
+						if (p->owner->caller.id.XXX_number.valid
+							&& p->owner->caller.id.XXX_number.str) {
+							ast_copy_string(cid_num, p->owner->caller.id.XXX_number.str,
+								sizeof(cid_num));
 						}
-						if (p->owner->cid.cid_name) {
-							ast_copy_string(cid_name, p->owner->cid.cid_name, sizeof(cid_name));

[... 364 lines stripped ...]



More information about the svn-commits mailing list