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

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon May 24 15:37:32 CDT 2010


Author: rmudgett
Date: Mon May 24 15:37:28 2010
New Revision: 265448

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=265448
Log:
Move ast_channel.cid.cid_num to ast_channel.caller.id.number.str.

* Fixed app_alarmreceiver.c write_metadata().  The workstring[] could
contain garbage.  It also can only contain the caller id number so using
ast_callerid_parse() on it is silly.  There was also a typo in the
CALLERNAME if test.

* Fixed app_rpt.c using ast_callerid_parse() on the channel's caller id
number string.  ast_callerid_parse() alters the given buffer which in this
case is the channel's caller id number string.  Then using
ast_shrink_phone_number() could alter it even more.

Modified:
    team/rmudgett/cid/apps/app_alarmreceiver.c
    team/rmudgett/cid/apps/app_dial.c
    team/rmudgett/cid/apps/app_disa.c
    team/rmudgett/cid/apps/app_fax.c
    team/rmudgett/cid/apps/app_macro.c
    team/rmudgett/cid/apps/app_minivm.c
    team/rmudgett/cid/apps/app_osplookup.c
    team/rmudgett/cid/apps/app_parkandannounce.c
    team/rmudgett/cid/apps/app_queue.c
    team/rmudgett/cid/apps/app_readexten.c
    team/rmudgett/cid/apps/app_rpt.c
    team/rmudgett/cid/apps/app_sms.c
    team/rmudgett/cid/apps/app_stack.c
    team/rmudgett/cid/apps/app_talkdetect.c
    team/rmudgett/cid/apps/app_voicemail.c
    team/rmudgett/cid/apps/app_while.c
    team/rmudgett/cid/apps/app_zapateller.c
    team/rmudgett/cid/channels/chan_agent.c
    team/rmudgett/cid/channels/chan_dahdi.c
    team/rmudgett/cid/channels/chan_local.c
    team/rmudgett/cid/channels/chan_mgcp.c
    team/rmudgett/cid/channels/chan_misdn.c
    team/rmudgett/cid/channels/chan_oss.c
    team/rmudgett/cid/channels/chan_sip.c
    team/rmudgett/cid/channels/chan_skinny.c
    team/rmudgett/cid/channels/chan_vpb.cc
    team/rmudgett/cid/funcs/func_dialplan.c
    team/rmudgett/cid/include/asterisk/channel.h
    team/rmudgett/cid/main/app.c
    team/rmudgett/cid/main/channel.c
    team/rmudgett/cid/main/cli.c
    team/rmudgett/cid/main/features.c
    team/rmudgett/cid/main/file.c
    team/rmudgett/cid/main/manager.c
    team/rmudgett/cid/main/pbx.c
    team/rmudgett/cid/res/res_agi.c

Modified: team/rmudgett/cid/apps/app_alarmreceiver.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/apps/app_alarmreceiver.c?view=diff&rev=265448&r1=265447&r2=265448
==============================================================================
--- team/rmudgett/cid/apps/app_alarmreceiver.c (original)
+++ team/rmudgett/cid/apps/app_alarmreceiver.c Mon May 24 15:37:28 2010
@@ -298,18 +298,22 @@
 	int res = 0;
 	struct timeval t;
 	struct ast_tm now;
-	char *cl,*cn;
+	char *cl;
+	char *cn;
 	char workstring[80];
 	char timestamp[80];
 	
 	/* Extract the caller ID location */
-	if (chan->cid.cid_num)
-		ast_copy_string(workstring, chan->cid.cid_num, sizeof(workstring));
-	workstring[sizeof(workstring) - 1] = '\0';
-
-	ast_callerid_parse(workstring, &cn, &cl);
-	if (cl)
-		ast_shrink_phone_number(cl);
+	ast_copy_string(workstring,
+		S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, ""),
+		sizeof(workstring));
+	ast_shrink_phone_number(workstring);
+	if (ast_strlen_zero(workstring)) {
+		cl = "<unknown>";
+	} else {
+		cl = workstring;
+	}
+	cn = S_COR(chan->caller.id.XXX_name.valid, chan->caller.id.XXX_name.str, "<unknown>");
 
 	/* Get the current time */
 	t = ast_tvnow();
@@ -319,27 +323,27 @@
 	ast_strftime(timestamp, sizeof(timestamp), time_stamp_format, &now);
 
 	res = fprintf(logfile, "\n\n[metadata]\n\n");
-
-	if (res >= 0)
+	if (res >= 0) {
 		res = fprintf(logfile, "PROTOCOL=%s\n", signalling_type);
-
-	if (res >= 0)
-		res = fprintf(logfile, "CALLINGFROM=%s\n", (!cl) ? "<unknown>" : cl);
-
-	if (res >- 0)
-		res = fprintf(logfile, "CALLERNAME=%s\n", (!cn) ? "<unknown>" : cn);
-
-	if (res >= 0)
+	}
+	if (res >= 0) {
+		res = fprintf(logfile, "CALLINGFROM=%s\n", cl);
+	}
+	if (res >= 0) {
+		res = fprintf(logfile, "CALLERNAME=%s\n", cn);
+	}
+	if (res >= 0) {
 		res = fprintf(logfile, "TIMESTAMP=%s\n\n", timestamp);
-
-	if (res >= 0)
+	}
+	if (res >= 0) {
 		res = fprintf(logfile, "[events]\n\n");
-
+	}
 	if (res < 0) {
 		ast_verb(3, "AlarmReceiver: can't write metadata\n");
 		ast_debug(1,"AlarmReceiver: can't write metadata\n");
-	} else
+	} else {
 		res = 0;
+	}
 
 	return res;
 }

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=265448&r1=265447&r2=265448
==============================================================================
--- team/rmudgett/cid/apps/app_dial.c (original)
+++ team/rmudgett/cid/apps/app_dial.c Mon May 24 15:37:28 2010
@@ -1587,8 +1587,9 @@
 	char *l;
 	int silencethreshold;
 
-	if (!ast_strlen_zero(chan->cid.cid_num)) {
-		l = ast_strdupa(chan->cid.cid_num);
+	if (chan->caller.id.XXX_number.valid
+		&& !ast_strlen_zero(chan->caller.id.XXX_number.str)) {
+		l = ast_strdupa(chan->caller.id.XXX_number.str);
 		ast_shrink_phone_number(l);
 		if (ast_test_flag64(opts, OPT_PRIVACY) ) {
 			ast_verb(3, "Privacy DB is '%s', clid is '%s'\n", opt_args[OPT_ARG_PRIVACY], l);
@@ -2594,7 +2595,9 @@
 
 		strcpy(peer->context, chan->context);
 
-		if (ast_test_flag64(&opts, OPT_PEER_H) && ast_exists_extension(peer, peer->context, "h", 1, peer->cid.cid_num)) {
+		if (ast_test_flag64(&opts, OPT_PEER_H)
+			&& ast_exists_extension(peer, peer->context, "h", 1,
+				S_COR(peer->caller.id.XXX_number.valid, peer->caller.id.XXX_number.str, NULL))) {
 			int autoloopflag;
 			int found;
 			int res9;
@@ -2604,8 +2607,12 @@
 			autoloopflag = ast_test_flag(peer, AST_FLAG_IN_AUTOLOOP); /* save value to restore at the end */
 			ast_set_flag(peer, AST_FLAG_IN_AUTOLOOP);
 
-			while ((res9 = ast_spawn_extension(peer, peer->context, peer->exten, peer->priority, peer->cid.cid_num, &found, 1)) == 0)
+			while ((res9 = ast_spawn_extension(peer, peer->context, peer->exten,
+				peer->priority,
+				S_COR(peer->caller.id.XXX_number.valid, peer->caller.id.XXX_number.str, NULL),
+				&found, 1)) == 0) {
 				peer->priority++;
+			}
 
 			if (found && res9) {
 				/* Something bad happened, or a hangup has been requested. */

Modified: team/rmudgett/cid/apps/app_disa.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/apps/app_disa.c?view=diff&rev=265448&r1=265447&r2=265448
==============================================================================
--- team/rmudgett/cid/apps/app_disa.c (original)
+++ team/rmudgett/cid/apps/app_disa.c Mon May 24 15:37:28 2010
@@ -308,9 +308,11 @@
 				}
 			} else {
 				if (j == '#') { /* end of extension .. maybe */
-					if (i == 0 && 
-							(ast_matchmore_extension(chan, args.context, "#", 1, chan->cid.cid_num) ||
-							 ast_exists_extension(chan, args.context, "#", 1, chan->cid.cid_num)) ) {
+					if (i == 0
+						&& (ast_matchmore_extension(chan, args.context, "#", 1,
+							S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))
+							|| ast_exists_extension(chan, args.context, "#", 1,
+								S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) ) {
 						/* Let the # be the part of, or the entire extension */
 					} else {
 						break;
@@ -340,7 +342,8 @@
 				}
 
 			/* if can do some more, do it */
-			if (!ast_matchmore_extension(chan,args.context,exten,1, chan->cid.cid_num)) {
+			if (!ast_matchmore_extension(chan,args.context,exten,1,
+				S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 				break;
 			}
 		}
@@ -352,13 +355,16 @@
 		int recheck = 0;
 		struct ast_flags cdr_flags = { AST_CDR_FLAG_POSTED };
 
-		if (!ast_exists_extension(chan, args.context, exten, 1, chan->cid.cid_num)) {
+		if (!ast_exists_extension(chan, args.context, exten, 1,
+			S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 			pbx_builtin_setvar_helper(chan, "INVALID_EXTEN", exten);
 			exten[0] = 'i';
 			exten[1] = '\0';
 			recheck = 1;
 		}
-		if (!recheck || ast_exists_extension(chan, args.context, exten, 1, chan->cid.cid_num)) {
+		if (!recheck
+			|| ast_exists_extension(chan, args.context, exten, 1,
+				S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 			ast_playtones_stop(chan);
 			/* We're authenticated and have a target extension */
 			if (!ast_strlen_zero(args.cid)) {

Modified: team/rmudgett/cid/apps/app_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/apps/app_fax.c?view=diff&rev=265448&r1=265447&r2=265448
==============================================================================
--- team/rmudgett/cid/apps/app_fax.c (original)
+++ team/rmudgett/cid/apps/app_fax.c Mon May 24 15:37:28 2010
@@ -251,25 +251,25 @@
 	ast_debug(1, "  Transfer Rate:     %d\n", stat.bit_rate);
 	
 	ast_manager_event(s->chan, EVENT_FLAG_CALL,
-		      s->direction ? "FaxSent" : "FaxReceived", 
-		      "Channel: %s\r\n"
-		      "Exten: %s\r\n"
-		      "CallerID: %s\r\n"
-		      "RemoteStationID: %s\r\n"
-		      "LocalStationID: %s\r\n"
-		      "PagesTransferred: %d\r\n"
-		      "Resolution: %d\r\n"
-		      "TransferRate: %d\r\n"
-		      "FileName: %s\r\n",
-		      s->chan->name,
-		      s->chan->exten,
-		      S_OR(s->chan->cid.cid_num, ""),
-		      far_ident,
-		      local_ident,
-		      pages_transferred,
-		      stat.y_resolution,
-		      stat.bit_rate,
-		      s->file_name);
+		s->direction ? "FaxSent" : "FaxReceived",
+		"Channel: %s\r\n"
+		"Exten: %s\r\n"
+		"CallerID: %s\r\n"
+		"RemoteStationID: %s\r\n"
+		"LocalStationID: %s\r\n"
+		"PagesTransferred: %d\r\n"
+		"Resolution: %d\r\n"
+		"TransferRate: %d\r\n"
+		"FileName: %s\r\n",
+		s->chan->name,
+		s->chan->exten,
+		S_COR(s->chan->caller.id.XXX_number.valid, s->chan->caller.id.XXX_number.str, ""),
+		far_ident,
+		local_ident,
+		pages_transferred,
+		stat.y_resolution,
+		stat.bit_rate,
+		s->file_name);
 }
 
 /* === Helper functions to configure fax === */

Modified: team/rmudgett/cid/apps/app_macro.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/apps/app_macro.c?view=diff&rev=265448&r1=265447&r2=265448
==============================================================================
--- team/rmudgett/cid/apps/app_macro.c (original)
+++ team/rmudgett/cid/apps/app_macro.c Mon May 24 15:37:28 2010
@@ -298,7 +298,8 @@
 	}
 
 	snprintf(fullmacro, sizeof(fullmacro), "macro-%s", macro);
-	if (!ast_exists_extension(chan, fullmacro, "s", 1, chan->cid.cid_num)) {
+	if (!ast_exists_extension(chan, fullmacro, "s", 1,
+		S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 		if (!ast_context_find(fullmacro)) 
 			ast_log(LOG_WARNING, "No such context '%s' for macro '%s'\n", fullmacro, macro);
 		else
@@ -370,7 +371,8 @@
 	ast_channel_unlock(chan);
 	autoloopflag = ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP);
 	ast_set_flag(chan, AST_FLAG_IN_AUTOLOOP);
-	while(ast_exists_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num)) {
+	while (ast_exists_extension(chan, chan->context, chan->exten, chan->priority,
+		S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 		struct ast_context *c;
 		struct ast_exten *e;
 		int foundx;
@@ -386,7 +388,8 @@
 					if (ast_rdlock_context(c)) {
 						ast_log(LOG_WARNING, "Unable to lock context?\n");
 					} else {
-						e = find_matching_priority(c, chan->exten, chan->priority, chan->cid.cid_num);
+						e = find_matching_priority(c, chan->exten, chan->priority,
+							S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL));
 						if (e) { /* This will only be undefined for pbx_realtime, which is majorly broken. */
 							ast_copy_string(runningapp, ast_get_extension_app(e), sizeof(runningapp));
 							ast_copy_string(runningdata, ast_get_extension_app_data(e), sizeof(runningdata));
@@ -402,7 +405,10 @@
 		/* Reset the macro depth, if it was changed in the last iteration */
 		pbx_builtin_setvar_helper(chan, "MACRO_DEPTH", depthc);
 
-		if ((res = ast_spawn_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num, &foundx,1))) {
+		res = ast_spawn_extension(chan, chan->context, chan->exten, chan->priority,
+			S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL),
+			&foundx, 1);
+		if (res) {
 			/* Something bad happened, or a hangup has been requested. */
 			if (((res >= '0') && (res <= '9')) || ((res >= 'A') && (res <= 'F')) ||
 		    	(res == '*') || (res == '#')) {
@@ -544,7 +550,9 @@
 				/* Handle macro offset if it's set by checking the availability of step n + offset + 1, otherwise continue
 			   	normally if there is any problem */
 				if (sscanf(offsets, "%30d", &offset) == 1) {
-					if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + offset + 1, chan->cid.cid_num)) {
+					if (ast_exists_extension(chan, chan->context, chan->exten,
+						chan->priority + offset + 1,
+						S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 						chan->priority += offset;
 					}
 				}

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=265448&r1=265447&r2=265448
==============================================================================
--- team/rmudgett/cid/apps/app_minivm.c (original)
+++ team/rmudgett/cid/apps/app_minivm.c Mon May 24 15:37:28 2010
@@ -2289,26 +2289,35 @@
 	/* Check current or macro-calling context for special extensions */
 	if (ast_test_flag(vmu, MVM_OPERATOR)) {
 		if (!ast_strlen_zero(vmu->exit)) {
-			if (ast_exists_extension(chan, vmu->exit, "o", 1, chan->cid.cid_num)) {
+			if (ast_exists_extension(chan, vmu->exit, "o", 1,
+				S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 				strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1);
 				ouseexten = 1;
 			}
-		} else if (ast_exists_extension(chan, chan->context, "o", 1, chan->cid.cid_num)) {
+		} else if (ast_exists_extension(chan, chan->context, "o", 1,
+			S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 			strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1);
 			ouseexten = 1;
 		}
-		else if (!ast_strlen_zero(chan->macrocontext) && ast_exists_extension(chan, chan->macrocontext, "o", 1, chan->cid.cid_num)) {
+		else if (!ast_strlen_zero(chan->macrocontext)
+			&& ast_exists_extension(chan, chan->macrocontext, "o", 1,
+				S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 			strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1);
 			ousemacro = 1;
 		}
 	}
 
 	if (!ast_strlen_zero(vmu->exit)) {
-		if (ast_exists_extension(chan, vmu->exit, "a", 1, chan->cid.cid_num))
+		if (ast_exists_extension(chan, vmu->exit, "a", 1,
+			S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 			strncat(ecodes, "*", sizeof(ecodes) -  strlen(ecodes) - 1);
-	} else if (ast_exists_extension(chan, chan->context, "a", 1, chan->cid.cid_num))
+		}
+	} else if (ast_exists_extension(chan, chan->context, "a", 1,
+		S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 		strncat(ecodes, "*", sizeof(ecodes) -  strlen(ecodes) - 1);
-	else if (!ast_strlen_zero(chan->macrocontext) && ast_exists_extension(chan, chan->macrocontext, "a", 1, chan->cid.cid_num)) {
+	} else if (!ast_strlen_zero(chan->macrocontext)
+		&& ast_exists_extension(chan, chan->macrocontext, "a", 1,
+			S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 		strncat(ecodes, "*", sizeof(ecodes) -  strlen(ecodes) - 1);
 		ausemacro = 1;
 	}

Modified: team/rmudgett/cid/apps/app_osplookup.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/apps/app_osplookup.c?view=diff&rev=265448&r1=265447&r2=265448
==============================================================================
--- team/rmudgett/cid/apps/app_osplookup.c (original)
+++ team/rmudgett/cid/apps/app_osplookup.c Mon May 24 15:37:28 2010
@@ -2225,7 +2225,10 @@
 	ast_debug(1, "OSPAuth: source '%s'\n", source);
 	ast_debug(1, "OSPAuth: token size '%zd'\n", strlen(token));
 
-	if ((res = osp_auth(provider, &handle, source, chan->cid.cid_num, chan->exten, token, &timelimit)) > 0) {
+	res = osp_auth(provider, &handle, source,
+		S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL),
+		chan->exten, token, &timelimit);
+	if (res > 0) {
 		status = AST_OSP_SUCCESS;
 	} else {
 		timelimit = OSP_DEF_TIMELIMIT;
@@ -2417,7 +2420,10 @@
 		return OSP_AST_ERROR;
 	}
 
-	if ((res = osp_lookup(provider, callidtypes, srcdev, chan->cid.cid_num, args.exten, snetid, &np, &div, cinfo, &results)) > 0) {
+	res = osp_lookup(provider, callidtypes, srcdev,
+		S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL),
+		args.exten, snetid, &np, &div, cinfo, &results);
+	if (res > 0) {
 		status = AST_OSP_SUCCESS;
 	} else {
 		results.tech[0] = '\0';

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=265448&r1=265447&r2=265448
==============================================================================
--- team/rmudgett/cid/apps/app_parkandannounce.c (original)
+++ team/rmudgett/cid/apps/app_parkandannounce.c Mon May 24 15:37:28 2010
@@ -126,10 +126,13 @@
 		ast_parseable_goto(chan, args.return_context);
 	}
 
-	ast_verb(3, "Return Context: (%s,%s,%d) ID: %s\n", chan->context, chan->exten, chan->priority, chan->cid.cid_num);
-		if (!ast_exists_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num)) {
+	ast_verb(3, "Return Context: (%s,%s,%d) ID: %s\n", chan->context, chan->exten,
+		chan->priority,
+		S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, ""));
+	if (!ast_exists_extension(chan, chan->context, chan->exten, chan->priority,
+		S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 		ast_verb(3, "Warning: Return Context Invalid, call will return to default|s\n");
-		}
+	}
 
 	/* we are using masq_park here to protect * from touching the channel once we park it.  If the channel comes out of timeout
 	before we are done announcing and the channel is messed with, Kablooeee.  So we use Masq to prevent this.  */

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=265448&r1=265447&r2=265448
==============================================================================
--- team/rmudgett/cid/apps/app_queue.c (original)
+++ team/rmudgett/cid/apps/app_queue.c Mon May 24 15:37:28 2010
@@ -2384,7 +2384,8 @@
 		return 0;
 
 	/* If the extension is bad, then reset the digits to blank */
-	if (!ast_canmatch_extension(qe->chan, qe->context, qe->digits, 1, qe->chan->cid.cid_num)) {
+	if (!ast_canmatch_extension(qe->chan, qe->context, qe->digits, 1,
+		S_COR(qe->chan->caller.id.XXX_number.valid, qe->chan->caller.id.XXX_number.str, NULL))) {
 		qe->digits[0] = '\0';
 		return 0;
 	}
@@ -5675,8 +5676,10 @@
 		set_queue_result(chan, reason);
 		return 0;
 	}
-	ast_queue_log(args.queuename, chan->uniqueid, "NONE", "ENTERQUEUE", "%s|%s|%d", S_OR(args.url, ""),
-		S_OR(chan->cid.cid_num, ""), qe.opos);
+	ast_queue_log(args.queuename, chan->uniqueid, "NONE", "ENTERQUEUE", "%s|%s|%d",
+		S_OR(args.url, ""),
+		S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, ""),
+		qe.opos);
 	copy_rules(&qe, args.rule);
 	qe.pr = AST_LIST_FIRST(&qe.qe_rules);
 check_turns:

Modified: team/rmudgett/cid/apps/app_readexten.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/apps/app_readexten.c?view=diff&rev=265448&r1=265447&r2=265448
==============================================================================
--- team/rmudgett/cid/apps/app_readexten.c (original)
+++ team/rmudgett/cid/apps/app_readexten.c Mon May 24 15:37:28 2010
@@ -240,8 +240,11 @@
 			}
 
 			exten[x] = res;
-			if (!ast_matchmore_extension(chan, arglist.context, exten, 1 /* priority */, chan->cid.cid_num)) {
-				if (!ast_exists_extension(chan, arglist.context, exten, 1, chan->cid.cid_num) && res == '#') {
+			if (!ast_matchmore_extension(chan, arglist.context, exten, 1 /* priority */,
+				S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
+				if (!ast_exists_extension(chan, arglist.context, exten, 1,
+					S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))
+					&& res == '#') {
 					exten[x] = '\0';
 				}
 				break;
@@ -251,7 +254,8 @@
 		if (!ast_strlen_zero(status))
 			break;
 
-		if (ast_exists_extension(chan, arglist.context, exten, 1, chan->cid.cid_num)) {
+		if (ast_exists_extension(chan, arglist.context, exten, 1,
+			S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 			ast_debug(3, "User entered valid extension '%s'\n", exten);
 			pbx_builtin_setvar_helper(chan, arglist.variable, exten);
 			status = "OK";
@@ -296,10 +300,12 @@
 	else
 		priority_int = atoi(args.priority);
 
-	if (ast_exists_extension(chan, args.context, args.extension, priority_int, chan->cid.cid_num))
+	if (ast_exists_extension(chan, args.context, args.extension, priority_int,
+		S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 	    ast_copy_string(buffer, "1", buflen);
-	else
+	} else {
 	    ast_copy_string(buffer, "0", buflen);
+	}
 
 	return 0;
 }

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=265448&r1=265447&r2=265448
==============================================================================
--- team/rmudgett/cid/apps/app_rpt.c (original)
+++ team/rmudgett/cid/apps/app_rpt.c Mon May 24 15:37:28 2010
@@ -5808,9 +5808,9 @@
 		if (debug > 3)
 			ast_log(LOG_NOTICE, "rpt (remote) initiating call to %s/%s on %s\n",
 		deststr, tele, l->chan->name);
-		if(l->chan->cid.cid_num)
-			ast_free(l->chan->cid.cid_num);
-		l->chan->cid.cid_num = ast_strdup(myrpt->name);
+		l->chan->caller.id.XXX_number.valid = 1;
+		ast_free(l->chan->caller.id.XXX_number.str);
+		l->chan->caller.id.XXX_number.str = ast_strdup(myrpt->name);
 		ast_call(l->chan,tele,999);
 	}
 	else {
@@ -10388,9 +10388,9 @@
 		if (option_verbose > 2)
 			ast_verbose(VERBOSE_PREFIX_3 "rpt (attempt_reconnect) initiating call to %s/%s on %s\n",
 				deststr, tele, l->chan->name);
-		if(l->chan->cid.cid_num)
-			ast_free(l->chan->cid.cid_num);
-		l->chan->cid.cid_num = ast_strdup(myrpt->name);
+		l->chan->caller.id.XXX_number.valid = 1;
+		ast_free(l->chan->caller.id.XXX_number.str);
+		l->chan->caller.id.XXX_number.str = ast_strdup(myrpt->name);
                 ast_call(l->chan,tele,999); 
 
 	}
@@ -13412,8 +13412,11 @@
 		}
 
 		if(option_verbose > 2) {
-			ast_verbose( VERBOSE_PREFIX_3 "Return Context: (%s,%s,%d) ID: %s\n", chan->context,chan->exten, chan->priority, chan->cid.cid_num);
-			if(!ast_exists_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num)) {
+			ast_verbose(VERBOSE_PREFIX_3 "Return Context: (%s,%s,%d) ID: %s\n",
+				chan->context, chan->exten, chan->priority,
+				S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, ""));
+			if(!ast_exists_extension(chan, chan->context, chan->exten, chan->priority,
+				S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 				ast_verbose( VERBOSE_PREFIX_3 "Warning: Return Context Invalid, call will return to default|s\n");
 			}
 		}
@@ -13443,7 +13446,8 @@
         char hisip[100],nodeip[100],*val, *s, *s1, *s2, *s3, *b,*b1;
 
 		/* look at callerid to see what node this comes from */
-		if (!chan->cid.cid_num) /* if doesn't have caller id */
+		b = S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL);
+		if (!b) /* if doesn't have caller id */
 		{
 			ast_log(LOG_WARNING, "Does not have callerid on %s\n",tmp);
 			return -1;
@@ -13467,7 +13471,7 @@
 			return -1;
 		}
 		
-		ast_callerid_parse(chan->cid.cid_num,&b,&b1);
+		b1 = ast_strdupa(b);
 		ast_shrink_phone_number(b1);
 		if (!strcmp(myrpt->name,b1))
 		{
@@ -13564,13 +13568,14 @@
 			return -1;
 		}
 		/* look at callerid to see what node this comes from */
-		if (!chan->cid.cid_num) /* if doesn't have caller id */
+		b = S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL);
+		if (!b) /* if doesn't have caller id */
 		{
 			ast_log(LOG_WARNING, "Doesnt have callerid on %s\n",tmp);
 			return -1;
 		}
 
-		ast_callerid_parse(chan->cid.cid_num,&b,&b1);
+		b1 = ast_strdupa(b);
 		ast_shrink_phone_number(b1);
 		if (!strcmp(myrpt->name,b1))
 		{
@@ -14036,11 +14041,12 @@
 				ast_cli_command(nullfd,mycmd);
 		} else ast_cli_command(nullfd,mycmd);
 		/* look at callerid to see what node this comes from */
-		if (!chan->cid.cid_num) /* if doesn't have caller id */
+		b = S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL);
+		if (!b) /* if doesn't have caller id */
 		{
 			b1 = "0";
 		} else {
-			ast_callerid_parse(chan->cid.cid_num,&b,&b1);
+			b1 = ast_strdupa(b);
 			ast_shrink_phone_number(b1);
 		}
 		sprintf(mycmd,"CONNECT,%s",b1);
@@ -14546,11 +14552,12 @@
 		char mycmd[100],*b,*b1;
 
 		/* look at callerid to see what node this comes from */
-		if (!chan->cid.cid_num) /* if doesn't have caller id */
+		b = S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL);
+		if (!b) /* if doesn't have caller id */
 		{
 			b1 = "0";
 		} else {
-			ast_callerid_parse(chan->cid.cid_num,&b,&b1);
+			b1 = ast_strdupa(b);
 			ast_shrink_phone_number(b1);
 		}
 		sprintf(mycmd,"DISCONNECT,%s",b1);

Modified: team/rmudgett/cid/apps/app_sms.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/apps/app_sms.c?view=diff&rev=265448&r1=265447&r2=265448
==============================================================================
--- team/rmudgett/cid/apps/app_sms.c (original)
+++ team/rmudgett/cid/apps/app_sms.c Mon May 24 15:37:28 2010
@@ -1890,8 +1890,9 @@
 	h.ipc0 = h.ipc1 = 20;                   /* phase for cosine */
 	h.dcs = 0xF1;                           /* default */
 
-	if (chan->cid.cid_num)
-		ast_copy_string(h.cli, chan->cid.cid_num, sizeof(h.cli));
+	ast_copy_string(h.cli,
+		S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, ""),
+		sizeof(h.cli));
 
 	if (ast_strlen_zero(sms_args.queue)) {
 		ast_log(LOG_ERROR, "Requires queue name\n");

Modified: team/rmudgett/cid/apps/app_stack.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/apps/app_stack.c?view=diff&rev=265448&r1=265447&r2=265448
==============================================================================
--- team/rmudgett/cid/apps/app_stack.c (original)
+++ team/rmudgett/cid/apps/app_stack.c Mon May 24 15:37:28 2010
@@ -413,7 +413,9 @@
 		return -1;
 	}
 
-	if (!ast_exists_extension(chan, chan->context, chan->exten, ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP) ? chan->priority + 1 : chan->priority, chan->cid.cid_num)) {
+	if (!ast_exists_extension(chan, chan->context, chan->exten,
+		ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP) ? chan->priority + 1 : chan->priority,
+		S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 		ast_log(LOG_ERROR, "Attempt to reach a non-existent destination for gosub: (Context:%s, Extension:%s, Priority:%d)\n",
 				chan->context, chan->exten, ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP) ? chan->priority + 1 : chan->priority);
 		ast_copy_string(chan->context, newframe->context, sizeof(chan->context));
@@ -588,12 +590,15 @@
 
 	if (sscanf(argv[3], "%30d", &priority) != 1 || priority < 1) {
 		/* Lookup the priority label */
-		if ((priority = ast_findlabel_extension(chan, argv[1], argv[2], argv[3], chan->cid.cid_num)) < 0) {
+		priority = ast_findlabel_extension(chan, argv[1], argv[2], argv[3],
+			S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL));
+		if (priority < 0) {
 			ast_log(LOG_ERROR, "Priority '%s' not found in '%s@%s'\n", argv[3], argv[2], argv[1]);
 			ast_agi_send(agi->fd, chan, "200 result=-1 Gosub label not found\n");
 			return RESULT_FAILURE;
 		}
-	} else if (!ast_exists_extension(chan, argv[1], argv[2], priority, chan->cid.cid_num)) {
+	} else if (!ast_exists_extension(chan, argv[1], argv[2], priority,
+		S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 		ast_agi_send(agi->fd, chan, "200 result=-1 Gosub label not found\n");
 		return RESULT_FAILURE;
 	}

Modified: team/rmudgett/cid/apps/app_talkdetect.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/apps/app_talkdetect.c?view=diff&rev=265448&r1=265447&r2=265448
==============================================================================
--- team/rmudgett/cid/apps/app_talkdetect.c (original)
+++ team/rmudgett/cid/apps/app_talkdetect.c Mon May 24 15:37:28 2010
@@ -175,7 +175,8 @@
 					char t[2];
 					t[0] = fr->subclass.integer;
 					t[1] = '\0';
-					if (ast_canmatch_extension(chan, chan->context, t, 1, chan->cid.cid_num)) {
+					if (ast_canmatch_extension(chan, chan->context, t, 1,
+						S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 						/* They entered a valid  extension, or might be anyhow */
 						res = fr->subclass.integer;
 						ast_frfree(fr);

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=265448&r1=265447&r2=265448
==============================================================================
--- team/rmudgett/cid/apps/app_voicemail.c (original)
+++ team/rmudgett/cid/apps/app_voicemail.c Mon May 24 15:37:28 2010
@@ -5505,25 +5505,34 @@
 	/* Check current or macro-calling context for special extensions */
 	if (ast_test_flag(vmu, VM_OPERATOR)) {
 		if (!ast_strlen_zero(vmu->exit)) {
-			if (ast_exists_extension(chan, vmu->exit, "o", 1, chan->cid.cid_num)) {
+			if (ast_exists_extension(chan, vmu->exit, "o", 1,
+				S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 				strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1);
 				ouseexten = 1;
 			}
-		} else if (ast_exists_extension(chan, chan->context, "o", 1, chan->cid.cid_num)) {
+		} else if (ast_exists_extension(chan, chan->context, "o", 1,
+			S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 			strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1);
 			ouseexten = 1;
-		} else if (!ast_strlen_zero(chan->macrocontext) && ast_exists_extension(chan, chan->macrocontext, "o", 1, chan->cid.cid_num)) {
+		} else if (!ast_strlen_zero(chan->macrocontext)
+			&& ast_exists_extension(chan, chan->macrocontext, "o", 1,
+				S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 			strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1);
 			ousemacro = 1;
 		}
 	}
 
 	if (!ast_strlen_zero(vmu->exit)) {
-		if (ast_exists_extension(chan, vmu->exit, "a", 1, chan->cid.cid_num))
+		if (ast_exists_extension(chan, vmu->exit, "a", 1,
+			S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 			strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1);
-	} else if (ast_exists_extension(chan, chan->context, "a", 1, chan->cid.cid_num))
+		}
+	} else if (ast_exists_extension(chan, chan->context, "a", 1,
+		S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 		strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1);
-	else if (!ast_strlen_zero(chan->macrocontext) && ast_exists_extension(chan, chan->macrocontext, "a", 1, chan->cid.cid_num)) {
+	} else if (!ast_strlen_zero(chan->macrocontext)
+		&& ast_exists_extension(chan, chan->macrocontext, "a", 1,
+			S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 		strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1);
 		ausemacro = 1;
 	}
@@ -5532,8 +5541,11 @@
 		for (code = alldtmf; *code; code++) {
 			char e[2] = "";
 			e[0] = *code;
-			if (strchr(ecodes, e[0]) == NULL && ast_canmatch_extension(chan, chan->context, e, 1, chan->cid.cid_num))
+			if (strchr(ecodes, e[0]) == NULL
+				&& ast_canmatch_extension(chan, chan->context, e, 1,
+					S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 				strncat(ecodes, e, sizeof(ecodes) - strlen(ecodes) - 1);
+			}
 		}
 	}
 
@@ -9394,15 +9406,16 @@
 			return -1;
 		}
 		if (ast_strlen_zero(mailbox)) {
-			if (chan->cid.cid_num) {
-				ast_copy_string(mailbox, chan->cid.cid_num, mailbox_size);
+			if (chan->caller.id.XXX_number.valid && chan->caller.id.XXX_number.str) {
+				ast_copy_string(mailbox, chan->caller.id.XXX_number.str, mailbox_size);
 			} else {
 				ast_verb(3, "Username not entered\n");	
 				return -1;
 			}
 		} else if (mailbox[0] == '*') {
 			/* user entered '*' */
-			if (ast_exists_extension(chan, chan->context, "a", 1, chan->cid.cid_num)) {
+			if (ast_exists_extension(chan, chan->context, "a", 1,
+				S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 				return -1;
 			}
 			mailbox[0] = '\0';
@@ -9433,7 +9446,8 @@
 				return -1;
 			} else if (password[0] == '*') {
 				/* user entered '*' */
-				if (ast_exists_extension(chan, chan->context, "a", 1, chan->cid.cid_num)) {
+				if (ast_exists_extension(chan, chan->context, "a", 1,
+					S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 					mailbox[0] = '*';
 					return -1;
 				}

Modified: team/rmudgett/cid/apps/app_while.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/apps/app_while.c?view=diff&rev=265448&r1=265447&r2=265448
==============================================================================
--- team/rmudgett/cid/apps/app_while.c (original)
+++ team/rmudgett/cid/apps/app_while.c Mon May 24 15:37:28 2010
@@ -163,7 +163,11 @@
 				/* This is the matching context we want */
 				int cur_priority = chan->priority + 1, level=1;
 
-				for (e = find_matching_priority(c, chan->exten, cur_priority, chan->cid.cid_num); e; e = find_matching_priority(c, chan->exten, ++cur_priority, chan->cid.cid_num)) {
+				for (e = find_matching_priority(c, chan->exten, cur_priority,
+					S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL));
+					e;
+					e = find_matching_priority(c, chan->exten, ++cur_priority,
+						S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 					if (!strcasecmp(ast_get_extension_app(e), "WHILE")) {
 						level++;
 					} else if (!strcasecmp(ast_get_extension_app(e), "ENDWHILE")) {

Modified: team/rmudgett/cid/apps/app_zapateller.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/apps/app_zapateller.c?view=diff&rev=265448&r1=265447&r2=265448
==============================================================================
--- team/rmudgett/cid/apps/app_zapateller.c (original)
+++ team/rmudgett/cid/apps/app_zapateller.c Mon May 24 15:37:28 2010
@@ -103,8 +103,12 @@
 			res = ast_safe_sleep(chan, 500);
 	}
 
-	if (!ast_strlen_zero(chan->cid.cid_num) && nocallerid)
+	if (nocallerid	/* Zap caller if no caller id. */
+		&& chan->caller.id.XXX_number.valid
+		&& !ast_strlen_zero(chan->caller.id.XXX_number.str)) {
+		/* We have caller id. */
 		return res;
+	}
 
 	if (!res) 
 		res = ast_tonepair(chan, 950, 0, 330, 0);

Modified: team/rmudgett/cid/channels/chan_agent.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/channels/chan_agent.c?view=diff&rev=265448&r1=265447&r2=265448
==============================================================================
--- team/rmudgett/cid/channels/chan_agent.c (original)
+++ team/rmudgett/cid/channels/chan_agent.c Mon May 24 15:37:28 2010
@@ -1488,16 +1488,17 @@
 		if (p->chan) {
 			loginChan = ast_strdupa(p->chan->name);
 			if (p->owner && p->owner->_bridge) {
-				talkingto = p->chan->cid.cid_num;
+				talkingto = S_COR(p->chan->caller.id.XXX_number.valid,
+					p->chan->caller.id.XXX_number.str, "n/a");
 				if (ast_bridged_channel(p->owner))
 					talkingtoChan = ast_strdupa(ast_bridged_channel(p->owner)->name);
 				else
 					talkingtoChan = "n/a";
-        			status = "AGENT_ONCALL";
+				status = "AGENT_ONCALL";
 			} else {
 				talkingto = "n/a";
 				talkingtoChan = "n/a";
-        			status = "AGENT_IDLE";
+				status = "AGENT_IDLE";
 			}
 		} else {
 			loginChan = "n/a";
@@ -2147,10 +2148,12 @@
 		if (strchr(data, 'c'))
 			changeoutgoing = 1;
 	}
-	if (chan->cid.cid_num) {
+	if (chan->caller.id.XXX_number.valid
+		&& !ast_strlen_zero(chan->caller.id.XXX_number.str)) {
 		const char *tmp;
 		char agentvar[AST_MAX_BUF];
-		snprintf(agentvar, sizeof(agentvar), "%s_%s", GETAGENTBYCALLERID, chan->cid.cid_num);
+		snprintf(agentvar, sizeof(agentvar), "%s_%s", GETAGENTBYCALLERID,
+			chan->caller.id.XXX_number.str);
 		if ((tmp = pbx_builtin_getvar_helper(NULL, agentvar))) {
 			struct agent_pvt *p;
 			ast_copy_string(agent, tmp, sizeof(agent));

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=265448&r1=265447&r2=265448
==============================================================================
--- team/rmudgett/cid/channels/chan_dahdi.c (original)
+++ team/rmudgett/cid/channels/chan_dahdi.c Mon May 24 15:37:28 2010
@@ -2018,7 +2018,8 @@
 				 */
 				ast_mutex_unlock(&p->lock);
 				ast_channel_unlock(ast);
-				if (ast_exists_extension(ast, target_context, "fax", 1, ast->cid.cid_num)) {
+				if (ast_exists_extension(ast, target_context, "fax", 1,
+					S_COR(ast->caller.id.XXX_number.valid, ast->caller.id.XXX_number.str, NULL))) {
 					ast_channel_lock(ast);
 					ast_mutex_lock(&p->lock);
 					ast_verb(3, "Redirecting %s to fax extension\n", ast->name);
@@ -5050,7 +5051,7 @@
 			c = "";
 		}
 		if (!p->hidecallerid) {
-			l = ast->cid.cid_num;
+			l = ast->caller.id.XXX_number.valid ? ast->caller.id.XXX_number.str : NULL;
 		} else {
 			l = NULL;
 		}
@@ -7216,7 +7217,8 @@
 				 */
 				ast_mutex_unlock(&p->lock);
 				ast_channel_unlock(ast);
-				if (ast_exists_extension(ast, target_context, "fax", 1, ast->cid.cid_num)) {
+				if (ast_exists_extension(ast, target_context, "fax", 1,
+					S_COR(ast->caller.id.XXX_number.valid, ast->caller.id.XXX_number.str, NULL))) {
 					ast_channel_lock(ast);
 					ast_mutex_lock(&p->lock);
 					ast_verb(3, "Redirecting %s to fax extension\n", ast->name);
@@ -9450,7 +9452,8 @@
 			}
 		}
 
-		if (ast_exists_extension(chan, chan->context, exten, 1, chan->cid.cid_num)) {
+		if (ast_exists_extension(chan, chan->context, exten, 1,
+			S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, NULL))) {
 			ast_copy_string(chan->exten, exten, sizeof(chan->exten));
 			if (p->dsp) ast_dsp_digitreset(p->dsp);
 			res = ast_pbx_run(chan);
@@ -9699,9 +9702,12 @@
 					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,
+				S_COR(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,
+					S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, "<Unknown Caller>"),
+					chan->context);
 				break;
 			}
 			if (!timeout)

Modified: team/rmudgett/cid/channels/chan_local.c

[... 771 lines stripped ...]



More information about the svn-commits mailing list