[asterisk-commits] oej: branch oej/bug8824-temp r135999 - in /team/oej/bug8824-temp: apps/ chann...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Aug 6 06:07:10 CDT 2008


Author: oej
Date: Wed Aug  6 06:07:09 2008
New Revision: 135999

URL: http://svn.digium.com/view/asterisk?view=rev&rev=135999
Log:
Adding patch, now time for upgrade to current svn trunk. Automerge - where are you?

Modified:
    team/oej/bug8824-temp/apps/app_dial.c
    team/oej/bug8824-temp/apps/app_queue.c
    team/oej/bug8824-temp/channels/chan_agent.c
    team/oej/bug8824-temp/channels/chan_dahdi.c
    team/oej/bug8824-temp/channels/chan_h323.c
    team/oej/bug8824-temp/channels/chan_iax2.c
    team/oej/bug8824-temp/channels/chan_local.c
    team/oej/bug8824-temp/channels/chan_mgcp.c
    team/oej/bug8824-temp/channels/chan_phone.c
    team/oej/bug8824-temp/channels/chan_sip.c
    team/oej/bug8824-temp/channels/chan_skinny.c
    team/oej/bug8824-temp/channels/chan_unistim.c
    team/oej/bug8824-temp/include/asterisk/channel.h
    team/oej/bug8824-temp/include/asterisk/frame.h
    team/oej/bug8824-temp/main/channel.c
    team/oej/bug8824-temp/main/dial.c
    team/oej/bug8824-temp/main/features.c
    team/oej/bug8824-temp/main/rtp.c

Modified: team/oej/bug8824-temp/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/bug8824-temp/apps/app_dial.c?view=diff&rev=135999&r1=135998&r2=135999
==============================================================================
--- team/oej/bug8824-temp/apps/app_dial.c (original)
+++ team/oej/bug8824-temp/apps/app_dial.c Wed Aug  6 06:07:09 2008
@@ -112,10 +112,7 @@
 "           string is sent to the calling party. Both parameters can be used\n"
 "           alone.\n"
 "    e    - execute the 'h' extension for peer after the call ends\n"
-"    f    - Force the callerid of the *calling* channel to be set as the\n"
-"           extension associated with the channel using a dialplan 'hint'.\n"
-"           For example, some PSTNs do not allow CallerID to be set to anything\n"
-"           other than the number assigned to the caller.\n"
+"    f(x) - Force the outgoing callerid to 'x'\n"
 "    F(context^exten^pri) - When the caller hangs up, transfer the called party\n"
 "           to the specified context and extension and continue execution.\n"
 "    g    - Proceed with dialplan execution at the current extension if the\n"
@@ -129,6 +126,8 @@
 "    H    - Allow the calling party to hang up by hitting the '*' DTMF digit.\n"
 "    i    - Asterisk will ignore any forwarding requests it may receive on this\n"
 "           dial attempt.\n"
+"    I    - Asterisk will ignore any connected line update requests it may receive\n"
+"           on this dial attempt.\n"
 "    k    - Allow the called party to enable parking of the call by sending\n"
 "           the DTMF sequence defined for call parking in features.conf.\n"
 "    K    - Allow the calling party to enable parking of the call by sending\n"
@@ -239,16 +238,17 @@
 	OPT_RESETCDR =          (1 << 1),
 	OPT_DTMF_EXIT =         (1 << 2),
 	OPT_SENDDTMF =          (1 << 3),
-	OPT_FORCECLID =         (1 << 4),
+	OPT_FORCE_CALLERID =    (1 << 4),
 	OPT_GO_ON =             (1 << 5),
 	OPT_CALLEE_HANGUP =     (1 << 6),
 	OPT_CALLER_HANGUP =     (1 << 7),
+	OPT_PEER_H =		(1 << 8),
 	OPT_DURATION_LIMIT =    (1 << 9),
 	OPT_MUSICBACK =         (1 << 10),
 	OPT_CALLEE_MACRO =      (1 << 11),
 	OPT_SCREEN_NOINTRO =    (1 << 12),
-	OPT_SCREEN_NOCLID =     (1 << 13),
-	OPT_ORIGINAL_CLID =     (1 << 14),
+	OPT_SCREEN_NOCALLERID = (1 << 13),
+	OPT_IGNORE_CONNECTEDLINE = (1 << 14),
 	OPT_SCREENING =         (1 << 15),
 	OPT_PRIVACY =           (1 << 16),
 	OPT_RINGBACK =          (1 << 17),
@@ -269,9 +269,10 @@
 
 #define DIAL_STILLGOING      (1 << 31)
 #define DIAL_NOFORWARDHTML   ((uint64_t)1 << 32) /* flags are now 64 bits, so keep it up! */
-#define OPT_CANCEL_ELSEWHERE ((uint64_t)1 << 33)
-#define OPT_PEER_H           ((uint64_t)1 << 34)
-#define OPT_CALLEE_GO_ON     ((uint64_t)1 << 35)
+#define DIAL_NOCONNECTEDLINE ((uint64_t)1 << 33)
+#define OPT_CANCEL_ELSEWHERE ((uint64_t)1 << 34)
+#define OPT_PEER_H           ((uint64_t)1 << 35)
+#define OPT_CALLEE_GO_ON     ((uint64_t)1 << 36)
 
 enum {
 	OPT_ARG_ANNOUNCE = 0,
@@ -285,6 +286,7 @@
 	OPT_ARG_PRIVACY,
 	OPT_ARG_DURATION_STOP,
 	OPT_ARG_OPERMODE,
+	OPT_ARG_FORCE_CALLERID,
 	/* note: this entry _MUST_ be the last one in the enum */
 	OPT_ARG_ARRAY_SIZE,
 };
@@ -296,13 +298,14 @@
 	AST_APP_OPTION('d', OPT_DTMF_EXIT),
 	AST_APP_OPTION_ARG('D', OPT_SENDDTMF, OPT_ARG_SENDDTMF),
 	AST_APP_OPTION('e', OPT_PEER_H),
-	AST_APP_OPTION('f', OPT_FORCECLID),
+	AST_APP_OPTION_ARG('f', OPT_FORCE_CALLERID, OPT_ARG_FORCE_CALLERID),
 	AST_APP_OPTION_ARG('F', OPT_CALLEE_GO_ON, OPT_ARG_CALLEE_GO_ON),
 	AST_APP_OPTION('g', OPT_GO_ON),
 	AST_APP_OPTION_ARG('G', OPT_GOTO, OPT_ARG_GOTO),
 	AST_APP_OPTION('h', OPT_CALLEE_HANGUP),
 	AST_APP_OPTION('H', OPT_CALLER_HANGUP),
 	AST_APP_OPTION('i', OPT_IGNORE_FORWARDING),
+	AST_APP_OPTION('I', OPT_IGNORE_CONNECTEDLINE),
 	AST_APP_OPTION('k', OPT_CALLEE_PARK),
 	AST_APP_OPTION('K', OPT_CALLER_PARK),
 	AST_APP_OPTION('k', OPT_CALLEE_PARK),
@@ -311,8 +314,7 @@
 	AST_APP_OPTION_ARG('m', OPT_MUSICBACK, OPT_ARG_MUSICBACK),
 	AST_APP_OPTION_ARG('M', OPT_CALLEE_MACRO, OPT_ARG_CALLEE_MACRO),
 	AST_APP_OPTION('n', OPT_SCREEN_NOINTRO),
-	AST_APP_OPTION('N', OPT_SCREEN_NOCLID),
-	AST_APP_OPTION('o', OPT_ORIGINAL_CLID),
+	AST_APP_OPTION('N', OPT_SCREEN_NOCALLERID),
 	AST_APP_OPTION_ARG('O', OPT_OPERMODE, OPT_ARG_OPERMODE),
 	AST_APP_OPTION('p', OPT_SCREENING),
 	AST_APP_OPTION_ARG('P', OPT_PRIVACY, OPT_ARG_PRIVACY),
@@ -426,15 +428,6 @@
 		}
 	}
 	return 0;
-}
-
-
-static const char *get_cid_name(char *name, int namelen, struct ast_channel *chan)
-{
-	const char *context = S_OR(chan->macrocontext, chan->context);
-	const char *exten = S_OR(chan->macroexten, chan->exten);
-
-	return ast_get_hint(NULL, 0, name, namelen, chan, context, exten) ? name : "";
 }
 
 static void senddialevent(struct ast_channel *src, struct ast_channel *dst, const char *dialstring)
@@ -515,28 +508,20 @@
 		ast_clear_flag64(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 (ast_test_flag64(o, OPT_FORCECLID)) {
-			new_cid_num = ast_strdup(S_OR(in->macroexten, in->exten));
-			new_cid_name = NULL; /* XXX no name ? */
-			src = c; /* XXX possible bug in previous code, which used 'winner' ? it may have changed */
-		} else {
-			new_cid_num = ast_strdup(in->cid.cid_num);
-			new_cid_name = ast_strdup(in->cid.cid_name);
-			src = in;
-		}
-		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_num, ast_strdup(in->cid.cid_num));
+		S_REPLACE(c->cid.cid_name, ast_strdup(in->cid.cid_name));
+		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)));
+
+		c->cid.cid_pres = in->cid.cid_pres;
+		c->cid.cid_ton = in->cid.cid_ton;
+		c->cid.cid_tns = in->cid.cid_tns;
+		c->cid.cid_ani2 = in->cid.cid_ani2;
+
+		ast_set_connectedline(c, in->lid.lid_num, in->lid.lid_name, in->lid.lid_pres);
+
 		if (ast_call(c, tmpchan, 0)) {
 			ast_log(LOG_NOTICE, "Failed to dial on local channel for call forward to '%s'\n", tmpchan);
 			ast_clear_flag64(o, DIAL_STILLGOING);
@@ -545,11 +530,6 @@
 			num->nochan++;
 		} else {
 			senddialevent(in, c, stuff);
-			/* After calling, set callerid to extension */
-			if (!ast_test_flag64(peerflags, OPT_ORIGINAL_CLID)) {
-				char cidname[AST_MAX_EXTENSION] = "";
-				ast_set_callerid(c, S_OR(in->macroexten, in->exten), get_cid_name(cidname, sizeof(cidname), in), NULL);
-			}
 			/* Hangup the original channel now, in case we needed it */
 			ast_hangup(original);
 		}
@@ -575,16 +555,21 @@
 	int orig = *to;
 	struct ast_channel *peer = NULL;
 	/* single is set if only one destination is enabled */
-	int single = outgoing && !outgoing->next && !ast_test_flag64(outgoing, OPT_MUSICBACK | OPT_RINGBACK);
+	int single = outgoing && !outgoing->next;
 #ifdef HAVE_EPOLL
 	struct chanlist *epollo;
 #endif
 
 	if (single) {
 		/* Turn off hold music, etc */
-		ast_deactivate_generator(in);
+		if (!ast_test_flag64(outgoing, OPT_MUSICBACK | OPT_RINGBACK))
+			ast_deactivate_generator(in);
+
 		/* If we are calling a single channel, make them compatible for in-band tone purpose */
 		ast_channel_make_compatible(outgoing->chan, in);
+
+		if (!ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE) && !ast_test_flag64(outgoing, DIAL_NOCONNECTEDLINE))
+			ast_connectedline_update(in, outgoing->chan->cid.cid_num, outgoing->chan->cid.cid_name, outgoing->chan->cid.cid_pres);
 	}
 
 #ifdef HAVE_EPOLL
@@ -631,6 +616,8 @@
 			if (ast_test_flag64(o, DIAL_STILLGOING) && c->_state == AST_STATE_UP) {
 				if (!peer) {
 					ast_verb(3, "%s answered %s\n", c->name, in->name);
+					if (!single && !ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE) && !ast_test_flag64(o, DIAL_NOCONNECTEDLINE))
+						ast_connectedline_update(in, c->cid.cid_num, c->cid.cid_name, c->cid.cid_pres);
 					peer = c;
 					ast_copy_flags64(peerflags, o,
 						OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER |
@@ -669,6 +656,8 @@
 					/* This is our guy if someone answered. */
 					if (!peer) {
 						ast_verb(3, "%s answered %s\n", c->name, in->name);
+						if (!single && !ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE) && !ast_test_flag64(o, DIAL_NOCONNECTEDLINE))
+							ast_connectedline_update(in, c->cid.cid_num, c->cid.cid_name, c->cid.cid_pres);
 						peer = c;
 						ast_copy_flags64(peerflags, o,
 							OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER |
@@ -729,6 +718,14 @@
 					ast_verb(3, "%s requested a source update, passing it to %s\n", c->name, in->name);
 					ast_indicate(in, AST_CONTROL_SRCUPDATE);
 					break;
+				case AST_CONTROL_CONNECTEDLINE:
+					if (!single || ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE)) {
+						ast_verb(3, "Connected line update to %s prevented.\n", in->name);
+					} else {
+						ast_verb(3, "%s connected line has changed, passing it to %s\n", c->name, in->name);
+						ast_indicate_data(in, AST_CONTROL_CONNECTEDLINE, f->data.ptr, f->datalen);
+					}
+					break;
 				case AST_CONTROL_PROCEEDING:
 					ast_verb(3, "%s is proceeding passing it to %s\n", c->name, in->name);
 					if (single && CAN_EARLY_BRIDGE(peerflags))
@@ -843,7 +840,8 @@
 				((f->subclass == AST_CONTROL_HOLD) ||
 				(f->subclass == AST_CONTROL_UNHOLD) ||
 				(f->subclass == AST_CONTROL_VIDUPDATE) ||
-				 (f->subclass == AST_CONTROL_SRCUPDATE))) {
+				(f->subclass == AST_CONTROL_SRCUPDATE) ||
+				(f->subclass == AST_CONTROL_CONNECTEDLINE))) {
 				ast_verb(3, "%s requested special control %d, passing it to %s\n", in->name, f->subclass, outgoing->chan->name);
 				ast_indicate_data(outgoing->chan, f->subclass, f->data.ptr, f->datalen);
 			}
@@ -1159,11 +1157,11 @@
 
 	ast_copy_string(pa->privcid, l, sizeof(pa->privcid));
 
-	if (strncmp(pa->privcid, "NOCALLERID", 10) != 0 && ast_test_flag64(opts, OPT_SCREEN_NOCLID)) {
-		/* if callerid is set and OPT_SCREEN_NOCLID is set also */
+	if (strncmp(pa->privcid, "NOCALLERID", 10) != 0 && ast_test_flag64(opts, OPT_SCREEN_NOCALLERID)) {
+		/* if callerid is set and OPT_SCREEN_NOCALLERID is set also */
 		ast_verb(3, "CallerID set (%s); N option set; Screening should be off\n", pa->privcid);
 		pa->privdb_val = AST_PRIVACY_ALLOW;
-	} else if (ast_test_flag64(opts, OPT_SCREEN_NOCLID) && strncmp(pa->privcid, "NOCALLERID", 10) == 0) {
+	} else if (ast_test_flag64(opts, OPT_SCREEN_NOCALLERID) && strncmp(pa->privcid, "NOCALLERID", 10) == 0) {
 		ast_verb(3, "CallerID blank; N option set; Screening should happen; dbval is %d\n", pa->privdb_val);
 	}
 	
@@ -1247,7 +1245,7 @@
 	struct cause_args num = { chan, 0, 0, 0 };
 	int cause;
 	char numsubst[256];
-	char cidname[AST_MAX_EXTENSION] = "";
+	char *cid_num = NULL, *cid_name = NULL;
 
 	struct ast_bridge_config config = { { 0, } };
 	unsigned int calldurationlimit = 0;
@@ -1324,6 +1322,8 @@
 			goto done;
 	}
 
+	if (ast_test_flag64(&opts, OPT_FORCE_CALLERID) && !ast_strlen_zero(opt_args[OPT_ARG_FORCE_CALLERID]))
+		ast_callerid_parse(opt_args[OPT_ARG_FORCE_CALLERID], &cid_name, &cid_num);
 	if (ast_test_flag64(&opts, OPT_RESETCDR) && chan->cdr)
 		ast_cdr_reset(chan->cdr, NULL);
 	if (ast_test_flag64(&opts, OPT_PRIVACY) && ast_strlen_zero(opt_args[OPT_ARG_PRIVACY]))
@@ -1349,7 +1349,7 @@
 		outbound_group = ast_strdupa(outbound_group);
 	}
 	ast_channel_unlock(chan);	
-	ast_copy_flags64(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID | OPT_CALLER_HANGUP | OPT_IGNORE_FORWARDING);
+	ast_copy_flags64(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_CALLER_HANGUP | OPT_IGNORE_FORWARDING | OPT_IGNORE_CONNECTEDLINE | OPT_FORCE_CALLERID);
 
 	/* Create datastore for channel dial features for caller */
 	if (!(ds_caller_features = ast_channel_datastore_alloc(&dial_features_info, NULL))) {
@@ -1401,7 +1401,7 @@
 				OPT_CALLEE_MONITOR | OPT_CALLER_MONITOR |
 				OPT_CALLEE_PARK | OPT_CALLER_PARK |
 				OPT_CALLEE_MIXMONITOR | OPT_CALLER_MIXMONITOR |
-				OPT_RINGBACK | OPT_MUSICBACK | OPT_FORCECLID);
+				OPT_RINGBACK | OPT_MUSICBACK);
 			ast_set2_flag64(tmp, args.url, DIAL_NOFORWARDHTML);
 		}
 		ast_copy_string(numsubst, number, sizeof(numsubst));
@@ -1491,20 +1491,37 @@
 		tc->data = "(Outgoing Line)";
 		memset(&tc->whentohangup, 0, sizeof(tc->whentohangup));
 
-		S_REPLACE(tc->cid.cid_num, ast_strdup(chan->cid.cid_num));
-		S_REPLACE(tc->cid.cid_name, ast_strdup(chan->cid.cid_name));
-		S_REPLACE(tc->cid.cid_ani, ast_strdup(chan->cid.cid_ani));
-		S_REPLACE(tc->cid.cid_rdnis, ast_strdup(chan->cid.cid_rdnis));
-		
+		/* If the new channel has no callerid, try to guess what it should be */
+		if (ast_strlen_zero(tc->cid.cid_num)) {
+			if (!ast_strlen_zero(chan->lid.lid_num)) {
+				ast_set_callerid(tc, chan->lid.lid_num, chan->lid.lid_name, chan->lid.lid_ani);
+			} else if (!ast_strlen_zero(chan->cid.cid_dnid)) {
+				ast_set_callerid(tc, chan->cid.cid_dnid, NULL, NULL);
+			} else if (!ast_strlen_zero(S_OR(chan->macroexten, chan->exten))) {
+				ast_set_callerid(tc, S_OR(chan->macroexten, chan->exten), NULL, NULL);
+			}
+			ast_set_flag64(tmp, DIAL_NOCONNECTEDLINE);
+		}
+
+		if (ast_test_flag64(peerflags, OPT_FORCE_CALLERID))
+			ast_set_connectedline(tc, cid_num, cid_name, AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN);
+		else {
+			S_REPLACE(tc->lid.lid_num, ast_strdup(chan->cid.cid_num));
+			S_REPLACE(tc->lid.lid_name, ast_strdup(chan->cid.cid_name));
+			S_REPLACE(tc->lid.lid_ani, ast_strdup(chan->cid.cid_ani));
+			S_REPLACE(tc->lid.lid_rdnis, ast_strdup(chan->cid.cid_rdnis));
+
+			tc->lid.lid_pres = chan->cid.cid_pres;
+			tc->lid.lid_ton = chan->cid.cid_ton;
+			tc->lid.lid_tns = chan->cid.cid_tns;
+			tc->lid.lid_ani2 = chan->cid.cid_ani2;
+		}
+
 		ast_string_field_set(tc, accountcode, chan->accountcode);
 		tc->cdrflags = chan->cdrflags;
 		if (ast_strlen_zero(tc->musicclass))
 			ast_string_field_set(tc, musicclass, chan->musicclass);
-		/* Pass callingpres, type of number, tns, ADSI CPE, transfer capability */
-		tc->cid.cid_pres = chan->cid.cid_pres;
-		tc->cid.cid_ton = chan->cid.cid_ton;
-		tc->cid.cid_tns = chan->cid.cid_tns;
-		tc->cid.cid_ani2 = chan->cid.cid_ani2;
+		/* Pass ADSI CPE and transfer capability */
 		tc->adsicpe = chan->adsicpe;
 		tc->transfercapability = chan->transfercapability;
 
@@ -1561,8 +1578,6 @@
 		} else {
 			senddialevent(chan, tc, numsubst);
 			ast_verb(3, "Called %s\n", numsubst);
-			if (!ast_test_flag64(peerflags, OPT_ORIGINAL_CLID))
-				ast_set_callerid(tc, S_OR(chan->macroexten, chan->exten), get_cid_name(cidname, sizeof(cidname), chan), NULL);
 		}
 		/* Put them in the list of outgoing thingies...  We're ready now.
 		   XXX If we're forcibly removed, these outgoing calls won't get

Modified: team/oej/bug8824-temp/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/oej/bug8824-temp/apps/app_queue.c?view=diff&rev=135999&r1=135998&r2=135999
==============================================================================
--- team/oej/bug8824-temp/apps/app_queue.c (original)
+++ team/oej/bug8824-temp/apps/app_queue.c Wed Aug  6 06:07:09 2008
@@ -2198,15 +2198,36 @@
 	tmp->chan->appl = "AppQueue";
 	tmp->chan->data = "(Outgoing Line)";
 	memset(&tmp->chan->whentohangup, 0, sizeof(tmp->chan->whentohangup));
-	if (tmp->chan->cid.cid_num)
-		ast_free(tmp->chan->cid.cid_num);
-	tmp->chan->cid.cid_num = ast_strdup(qe->chan->cid.cid_num);
-	if (tmp->chan->cid.cid_name)
-		ast_free(tmp->chan->cid.cid_name);
-	tmp->chan->cid.cid_name = ast_strdup(qe->chan->cid.cid_name);
-	if (tmp->chan->cid.cid_ani)
-		ast_free(tmp->chan->cid.cid_ani);
-	tmp->chan->cid.cid_ani = ast_strdup(qe->chan->cid.cid_ani);
+
+	/* If the new channel has no callerid, try to guess what it should be */
+	if (ast_strlen_zero(tmp->chan->cid.cid_num)) {
+		if (!ast_strlen_zero(qe->chan->lid.lid_num)) {
+			ast_set_callerid(tmp->chan, qe->chan->lid.lid_num, qe->chan->lid.lid_name, qe->chan->lid.lid_ani);
+			tmp->chan->cid.cid_pres = qe->chan->lid.lid_pres;
+		} else if (!ast_strlen_zero(qe->chan->cid.cid_dnid)) {
+			ast_set_callerid(tmp->chan, qe->chan->cid.cid_dnid, NULL, NULL);
+		} else if (!ast_strlen_zero(S_OR(qe->chan->macroexten, qe->chan->exten))) {
+			ast_set_callerid(tmp->chan, S_OR(qe->chan->macroexten, qe->chan->exten), NULL, NULL); 
+		}
+	}
+
+	if (tmp->chan->lid.lid_num)
+		ast_free(tmp->chan->lid.lid_num);
+	tmp->chan->lid.lid_num = ast_strdup(qe->chan->cid.cid_num);
+	if (tmp->chan->lid.lid_name)
+		ast_free(tmp->chan->lid.lid_name);
+	tmp->chan->lid.lid_name = ast_strdup(qe->chan->cid.cid_name);
+	if (tmp->chan->lid.lid_ani)
+		ast_free(tmp->chan->lid.lid_ani);
+	tmp->chan->lid.lid_ani = ast_strdup(qe->chan->cid.cid_ani);
+	if (tmp->chan->lid.lid_rdnis)
+		ast_free(tmp->chan->lid.lid_rdnis);
+	tmp->chan->lid.lid_rdnis = ast_strdup(qe->chan->cid.cid_rdnis);
+
+	tmp->chan->lid.lid_pres = qe->chan->cid.cid_pres;
+	tmp->chan->lid.lid_ton = qe->chan->cid.cid_ton;
+	tmp->chan->lid.lid_tns = qe->chan->cid.cid_tns;
+	tmp->chan->lid.lid_ani2 = qe->chan->cid.cid_ani2;
 
 	/* Inherit specially named variables from parent channel */
 	ast_channel_inherit_variables(qe->chan, tmp->chan);
@@ -2584,6 +2605,7 @@
 					} else {
 						ast_channel_inherit_variables(in, o->chan);
 						ast_channel_datastore_inherit(in, o->chan);
+
 						if (o->chan->cid.cid_num)
 							ast_free(o->chan->cid.cid_num);
 						o->chan->cid.cid_num = ast_strdup(in->cid.cid_num);
@@ -2592,17 +2614,21 @@
 							ast_free(o->chan->cid.cid_name);
 						o->chan->cid.cid_name = ast_strdup(in->cid.cid_name);
 
-						ast_string_field_set(o->chan, accountcode, in->accountcode);
-						o->chan->cdrflags = in->cdrflags;
-
-						if (in->cid.cid_ani) {
-							if (o->chan->cid.cid_ani)
-								ast_free(o->chan->cid.cid_ani);
-							o->chan->cid.cid_ani = ast_strdup(in->cid.cid_ani);
-						}
+						if (o->chan->cid.cid_ani)
+							ast_free(o->chan->cid.cid_ani);
+						o->chan->cid.cid_ani = ast_strdup(in->cid.cid_ani);
+
 						if (o->chan->cid.cid_rdnis)
 							ast_free(o->chan->cid.cid_rdnis);
 						o->chan->cid.cid_rdnis = ast_strdup(S_OR(in->macroexten, in->exten));
+
+						o->chan->cid.cid_pres = in->cid.cid_pres;
+						o->chan->cid.cid_ton = in->cid.cid_ton;
+						o->chan->cid.cid_tns = in->cid.cid_tns;
+						o->chan->cid.cid_ani2 = in->cid.cid_ani2;
+
+						ast_set_connectedline(o->chan, in->lid.lid_num, in->lid.lid_name, in->lid.lid_pres);
+
 						if (ast_call(o->chan, tmpchan, 0)) {
 							ast_log(LOG_NOTICE, "Failed to dial on local channel for call forward to '%s'\n", tmpchan);
 							do_hang(o);

Modified: team/oej/bug8824-temp/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/oej/bug8824-temp/channels/chan_agent.c?view=diff&rev=135999&r1=135998&r2=135999
==============================================================================
--- team/oej/bug8824-temp/channels/chan_agent.c (original)
+++ team/oej/bug8824-temp/channels/chan_agent.c Wed Aug  6 06:07:09 2008
@@ -656,8 +656,7 @@
 		time(&p->start);
 		/* Call on this agent */
 		ast_verb(3, "outgoing agentcall, to agent '%s', on '%s'\n", p->agent, p->chan->name);
-		ast_set_callerid(p->chan,
-			ast->cid.cid_num, ast->cid.cid_name, NULL);
+		ast_set_connectedline(p->chan, ast->lid.lid_num, ast->lid.lid_name, ast->lid.lid_pres);
 		ast_channel_inherit_variables(ast, p->chan);
 		res = ast_call(p->chan, p->loginchan, 0);
 		CLEANUP(ast,p);

Modified: team/oej/bug8824-temp/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/oej/bug8824-temp/channels/chan_dahdi.c?view=diff&rev=135999&r1=135998&r2=135999
==============================================================================
--- team/oej/bug8824-temp/channels/chan_dahdi.c (original)
+++ team/oej/bug8824-temp/channels/chan_dahdi.c Wed Aug  6 06:07:09 2008
@@ -2124,7 +2124,7 @@
 				}
 				p->callwaitcas = 0;
 				if ((p->cidspill = ast_malloc(MAX_CALLERID_SIZE))) {
-					p->cidlen = ast_callerid_generate(p->cidspill, ast->cid.cid_name, ast->cid.cid_num, AST_LAW(p));
+					p->cidlen = ast_callerid_generate(p->cidspill, ast->lid.lid_name, ast->lid.lid_num, AST_LAW(p));
 					p->cidpos = 0;
 					send_callerid(p);
 				}
@@ -2165,12 +2165,12 @@
 		} else {
 			/* Call waiting call */
 			p->callwaitrings = 0;
-			if (ast->cid.cid_num)
-				ast_copy_string(p->callwait_num, ast->cid.cid_num, sizeof(p->callwait_num));
+			if (ast->lid.lid_num)
+				ast_copy_string(p->callwait_num, ast->lid.lid_num, sizeof(p->callwait_num));
 			else
 				p->callwait_num[0] = '\0';
-			if (ast->cid.cid_name)
-				ast_copy_string(p->callwait_name, ast->cid.cid_name, sizeof(p->callwait_name));
+			if (ast->lid.lid_name)
+				ast_copy_string(p->callwait_name, ast->lid.lid_name, sizeof(p->callwait_name));
 			else
 				p->callwait_name[0] = '\0';
 			/* Call waiting tone instead */
@@ -2183,8 +2183,8 @@
 				ast_log(LOG_WARNING, "Unable to generate call-wait ring-back on channel %s\n", ast->name);
 				
 		}
-		n = ast->cid.cid_name;
-		l = ast->cid.cid_num;
+		n = ast->lid.lid_name;
+		l = ast->lid.lid_num;
 		if (l)
 			ast_copy_string(p->lastcid_num, l, sizeof(p->lastcid_num));
 		else
@@ -2250,14 +2250,14 @@
 
 		switch (mysig) {
 		case SIG_FEATD:
-			l = ast->cid.cid_num;
+			l = ast->lid.lid_num;
 			if (l) 
 				snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "T*%s*%s*", l, c);
 			else
 				snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "T**%s*", c);
 			break;
 		case SIG_FEATDMF:
-			l = ast->cid.cid_num;
+			l = ast->lid.lid_num;
 			if (l) 
 				snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "M*00%s#*%s#", l, c);
 			else
@@ -2370,7 +2370,7 @@
 			c = dest;
 
 		if (!p->hidecallerid) {
-			l = ast->cid.cid_num;
+			l = ast->lid.lid_num;
 		} else {
 			l = NULL;
 		}
@@ -2419,10 +2419,10 @@
 			}
 		}
 		isup_set_calling(p->ss7call, l ? (l + calling_nai_strip) : NULL, ss7_calling_nai,
-			p->use_callingpres ? cid_pres2ss7pres(ast->cid.cid_pres) : (l ? SS7_PRESENTATION_ALLOWED : SS7_PRESENTATION_RESTRICTED),
-			p->use_callingpres ? cid_pres2ss7screen(ast->cid.cid_pres) : SS7_SCREENING_USER_PROVIDED );
-
-		isup_set_oli(p->ss7call, ast->cid.cid_ani2);
+			p->use_callingpres ? cid_pres2ss7pres(ast->lid.lid_pres) : (l ? SS7_PRESENTATION_ALLOWED : SS7_PRESENTATION_RESTRICTED),
+			p->use_callingpres ? cid_pres2ss7screen(ast->lid.lid_pres) : SS7_SCREENING_USER_PROVIDED );
+
+		isup_set_oli(p->ss7call, ast->lid.lid_ani2);
 		isup_init_call(p->ss7->ss7, p->ss7call, p->cic, p->dpc);
 
 		ast_channel_lock(ast);
@@ -2500,9 +2500,9 @@
 		n = NULL;
 
 		if (!p->hidecallerid) {
-			l = ast->cid.cid_num;
+			l = ast->lid.lid_num;
 			if (!p->hidecalleridname) {
-				n = ast->cid.cid_name;
+				n = ast->lid.lid_name;
 			}
 		}
 
@@ -2708,7 +2708,7 @@
 			}
 		}
 		pri_sr_set_caller(sr, l ? (l + ldp_strip) : NULL, n, prilocaldialplan,
-			p->use_callingpres ? ast->cid.cid_pres : (l ? PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN : PRES_NUMBER_NOT_AVAILABLE));
+			p->use_callingpres ? ast->lid.lid_pres : (l ? PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN : PRES_NUMBER_NOT_AVAILABLE));
 		if ((rr_str = pbx_builtin_getvar_helper(ast, "PRIREDIRECTREASON"))) {
 			if (!strcasecmp(rr_str, "UNKNOWN"))
 				redirect_reason = 0;
@@ -2722,7 +2722,7 @@
 				redirect_reason = PRI_REDIR_UNCONDITIONAL;
 		} else
 			redirect_reason = PRI_REDIR_UNCONDITIONAL;
-		pri_sr_set_redirecting(sr, ast->cid.cid_rdnis, p->pri->localdialplan - 1, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN, redirect_reason);
+		pri_sr_set_redirecting(sr, ast->lid.lid_rdnis, p->pri->localdialplan - 1, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN, redirect_reason);
 
 #ifdef SUPPORT_USERUSER
 		/* User-user info */

Modified: team/oej/bug8824-temp/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/oej/bug8824-temp/channels/chan_h323.c?view=diff&rev=135999&r1=135998&r2=135999
==============================================================================
--- team/oej/bug8824-temp/channels/chan_h323.c (original)
+++ team/oej/bug8824-temp/channels/chan_h323.c Wed Aug  6 06:07:09 2008
@@ -606,18 +606,18 @@
 	/* make sure null terminated */
 	called_addr[sizeof(called_addr) - 1] = '\0';
 
-	if (c->cid.cid_num)
-		ast_copy_string(pvt->options.cid_num, c->cid.cid_num, sizeof(pvt->options.cid_num));
-
-	if (c->cid.cid_name)
-		ast_copy_string(pvt->options.cid_name, c->cid.cid_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));
-	}
-
-	pvt->options.presentation = c->cid.cid_pres;
-	pvt->options.type_of_number = c->cid.cid_ton;
+	if (c->lid.lid_num)
+		ast_copy_string(pvt->options.cid_num, c->lid.lid_num, sizeof(pvt->options.cid_num));
+
+	if (c->lid.lid_name)
+		ast_copy_string(pvt->options.cid_name, c->lid.lid_name, sizeof(pvt->options.cid_name));
+
+	if (c->lid.lid_rdnis) {
+		ast_copy_string(pvt->options.cid_rdnis, c->lid.lid_rdnis, sizeof(pvt->options.cid_rdnis));
+	}
+
+	pvt->options.presentation = c->lid.lid_pres;
+	pvt->options.type_of_number = c->lid.lid_ton;
 
 	if ((addr = pbx_builtin_getvar_helper(c, "PRIREDIRECTREASON"))) {
 		if (!strcasecmp(addr, "UNKNOWN"))

Modified: team/oej/bug8824-temp/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/bug8824-temp/channels/chan_iax2.c?view=diff&rev=135999&r1=135998&r2=135999
==============================================================================
--- team/oej/bug8824-temp/channels/chan_iax2.c (original)
+++ team/oej/bug8824-temp/channels/chan_iax2.c Wed Aug  6 06:07:09 2008
@@ -277,6 +277,8 @@
 	IAX_DELAYPBXSTART =	(1 << 25),	/*!< Don't start a PBX on the channel until the peer sends us a
 						     response, so that we've achieved a three-way handshake with
 						     them before sending voice or anything else*/
+	IAX_SENDCONNECTEDLINE = (1 << 26),	/*!< Allow sending of connected line updates */
+	IAX_RECVCONNECTEDLINE = (1 << 27),	/*!< Allow receiving of connected line updates */
 };
 
 static int global_rtautoclear = 120;
@@ -1746,7 +1748,7 @@
 			iaxs[x]->pingid = iax2_sched_add(sched, ping_time * 1000, send_ping, (void *)(long)x);
 			iaxs[x]->lagid = iax2_sched_add(sched, lagrq_time * 1000, send_lagrq, (void *)(long)x);
 			iaxs[x]->amaflags = amaflags;
-			ast_copy_flags(iaxs[x], (&globalflags), IAX_NOTRANSFER | IAX_TRANSFERMEDIA | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF);
+			ast_copy_flags(iaxs[x], (&globalflags), IAX_NOTRANSFER | IAX_TRANSFERMEDIA | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF | IAX_SENDCONNECTEDLINE | IAX_RECVCONNECTEDLINE);
 			
 			ast_string_field_set(iaxs[x], accountcode, accountcode);
 			ast_string_field_set(iaxs[x], mohinterpret, mohinterpret);
@@ -3310,6 +3312,8 @@
 	char outkey[80];
 	char timezone[80];
 	char prefs[32];
+	char cid_num[80];
+	char cid_name[80];
 	char context[AST_MAX_CONTEXT];
 	char peercontext[AST_MAX_CONTEXT];
 	char mohinterpret[MAX_MUSICCLASS];
@@ -3353,7 +3357,7 @@
 	if (peer->maxms && ((peer->lastms > peer->maxms) || (peer->lastms < 0)))
 		goto return_unref;
 
-	ast_copy_flags(cai, peer, IAX_SENDANI | IAX_TRUNK | IAX_NOTRANSFER | IAX_TRANSFERMEDIA | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF);
+	ast_copy_flags(cai, peer, IAX_SENDANI | IAX_TRUNK | IAX_NOTRANSFER | IAX_TRANSFERMEDIA | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF | IAX_SENDCONNECTEDLINE | IAX_RECVCONNECTEDLINE);
 	cai->maxtime = peer->maxms;
 	cai->capability = peer->capability;
 	cai->encmethods = peer->encmethods;
@@ -3371,6 +3375,8 @@
 	ast_copy_string(cai->username, peer->username, sizeof(cai->username));
 	ast_copy_string(cai->timezone, peer->zonetag, sizeof(cai->timezone));
 	ast_copy_string(cai->outkey, peer->outkey, sizeof(cai->outkey));
+	ast_copy_string(cai->cid_num, peer->cid_num, sizeof(cai->cid_num));
+	ast_copy_string(cai->cid_name, peer->cid_name, sizeof(cai->cid_name));
 	ast_copy_string(cai->mohinterpret, peer->mohinterpret, sizeof(cai->mohinterpret));
 	ast_copy_string(cai->mohsuggest, peer->mohsuggest, sizeof(cai->mohsuggest));
 	if (ast_strlen_zero(peer->dbsecret)) {
@@ -3569,8 +3575,8 @@
 	if (pds.port)
 		sin.sin_port = htons(atoi(pds.port));
 
-	l = c->cid.cid_num;
-	n = c->cid.cid_name;
+	l = c->lid.lid_num;
+	n = c->lid.lid_name;
 
 	/* Now build request */	
 	memset(&ied, 0, sizeof(ied));
@@ -3587,28 +3593,28 @@
 
 	if (l) {
 		iax_ie_append_str(&ied, IAX_IE_CALLING_NUMBER, l);
-		iax_ie_append_byte(&ied, IAX_IE_CALLINGPRES, c->cid.cid_pres);
+		iax_ie_append_byte(&ied, IAX_IE_CALLINGPRES, c->lid.lid_pres);
 	} else {
 		if (n)
-			iax_ie_append_byte(&ied, IAX_IE_CALLINGPRES, c->cid.cid_pres);
+			iax_ie_append_byte(&ied, IAX_IE_CALLINGPRES, c->lid.lid_pres);
 		else
 			iax_ie_append_byte(&ied, IAX_IE_CALLINGPRES, AST_PRES_NUMBER_NOT_AVAILABLE);
 	}
 
-	iax_ie_append_byte(&ied, IAX_IE_CALLINGTON, c->cid.cid_ton);
-	iax_ie_append_short(&ied, IAX_IE_CALLINGTNS, c->cid.cid_tns);
+	iax_ie_append_byte(&ied, IAX_IE_CALLINGTON, c->lid.lid_ton);
+	iax_ie_append_short(&ied, IAX_IE_CALLINGTNS, c->lid.lid_tns);
 
 	if (n)
 		iax_ie_append_str(&ied, IAX_IE_CALLING_NAME, n);
-	if (ast_test_flag(iaxs[callno], IAX_SENDANI) && c->cid.cid_ani)
-		iax_ie_append_str(&ied, IAX_IE_CALLING_ANI, c->cid.cid_ani);
+	if (ast_test_flag(iaxs[callno], IAX_SENDANI) && c->lid.lid_ani)
+		iax_ie_append_str(&ied, IAX_IE_CALLING_ANI, c->lid.lid_ani);
 
 	if (!ast_strlen_zero(c->language))
 		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);
+		iax_ie_append_str(&ied, IAX_IE_DNID, c->lid.lid_dnid);
 	if (!ast_strlen_zero(c->cid.cid_rdnis))
-		iax_ie_append_str(&ied, IAX_IE_RDNIS, c->cid.cid_rdnis);
+		iax_ie_append_str(&ied, IAX_IE_RDNIS, c->lid.lid_rdnis);
 
 	if (pds.context)
 		iax_ie_append_str(&ied, IAX_IE_CALLED_CONTEXT, pds.context);
@@ -3993,6 +3999,8 @@
 	unsigned short callno = PTR_TO_CALLNO(c->tech_pvt);
 	struct chan_iax2_pvt *pvt;
 	int res = 0;
+	char cid_num[80], cid_name[80];
+	int cid_pres;
 
 	if (iaxdebug)
 		ast_debug(1, "Indicating condition %d\n", condition);
@@ -4025,6 +4033,14 @@
 			ast_moh_stop(c);
 			goto done;
 		}
+		break;
+	case AST_CONTROL_CONNECTEDLINE:
+		if (ast_parse_connectedline_data((unsigned char *) data, datalen, cid_num, sizeof(cid_num), cid_name, sizeof(cid_name), &cid_pres) == -1)
+			goto done;
+		ast_set_connectedline(c, cid_num, cid_name, cid_pres);
+		if (!ast_test_flag(pvt, IAX_SENDCONNECTEDLINE))
+			goto done;
+		break;
 	}
 
 	res = send_command(pvt, AST_FRAME_CONTROL, condition, 0, data, datalen, -1);
@@ -5950,7 +5966,7 @@
 			iaxs[callno]->amaflags = user->amaflags;
 		if (!ast_strlen_zero(user->language))
 			ast_string_field_set(iaxs[callno], language, user->language);
-		ast_copy_flags(iaxs[callno], user, IAX_NOTRANSFER | IAX_TRANSFERMEDIA | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF);	
+		ast_copy_flags(iaxs[callno], user, IAX_NOTRANSFER | IAX_TRANSFERMEDIA | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF | IAX_SENDCONNECTEDLINE | IAX_RECVCONNECTEDLINE);	
 		/* Keep this check last */
 		if (!ast_strlen_zero(user->dbsecret)) {
 			char *family, *key=NULL;
@@ -7971,6 +7987,9 @@
 	char caller_pref_buf[128];
 	struct ast_codec_pref pref;
 	char *using_prefs = "mine";
+	char cid_num[80];
+	char cid_name[80];
+	int cid_pres;
 
 	/* allocate an iax_frame with 4096 bytes of data buffer */
 	fr = alloca(sizeof(*fr) + 4096);
@@ -9497,6 +9516,23 @@
 		ast_mutex_unlock(&iaxsl[fr->callno]);
 		return 1;
 	}
+	/* Don't allow connected line updates unless we are configured to */
+	if (f.frametype == AST_FRAME_CONTROL && f.subclass == AST_CONTROL_CONNECTEDLINE) {
+		if (!ast_test_flag(iaxs[fr->callno], IAX_RECVCONNECTEDLINE)) {
+			ast_mutex_unlock(&iaxsl[fr->callno]);
+			return 1;
+		}
+		if (!ast_parse_connectedline_data((unsigned char *) f.data.ptr, f.datalen, cid_num, sizeof(cid_num), cid_name, sizeof(cid_name), &cid_pres)) {
+			ast_string_field_set(iaxs[fr->callno], cid_num, cid_num);
+			ast_string_field_set(iaxs[fr->callno], cid_name, cid_name);
+			iaxs[fr->callno]->calling_pres = cid_pres;
+
+			if (iaxs[fr->callno]->owner) {
+				ast_set_callerid(iaxs[fr->callno]->owner, cid_num, cid_name, NULL);
+				iaxs[fr->callno]->owner->cid.cid_pres = cid_pres;
+			}
+		}
+	}
 	/* Common things */
 	f.src = "IAX2";
 	f.mallocd = 0;
@@ -9990,7 +10026,7 @@
 	memset(&cai, 0, sizeof(cai));
 	cai.capability = iax2_capability;
 
-	ast_copy_flags(&cai, &globalflags, IAX_NOTRANSFER | IAX_TRANSFERMEDIA | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF);
+	ast_copy_flags(&cai, &globalflags, IAX_NOTRANSFER | IAX_TRANSFERMEDIA | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF | IAX_SENDCONNECTEDLINE | IAX_RECVCONNECTEDLINE);
 	
 	/* Populate our address from the given */
 	if (create_addr(pds.peer, NULL, &sin, &cai)) {
@@ -10009,7 +10045,7 @@
 	}
 
 	/* If this is a trunk, update it now */
-	ast_copy_flags(iaxs[callno], &cai, IAX_TRUNK | IAX_SENDANI | IAX_NOTRANSFER | IAX_TRANSFERMEDIA | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF);	
+	ast_copy_flags(iaxs[callno], &cai, IAX_TRUNK | IAX_SENDANI | IAX_NOTRANSFER | IAX_TRANSFERMEDIA | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF | IAX_SENDCONNECTEDLINE | IAX_RECVCONNECTEDLINE);
 	if (ast_test_flag(&cai, IAX_TRUNK)) {
 		int new_callno;
 		if ((new_callno = make_trunk(callno, 1)) != -1)
@@ -10350,7 +10386,7 @@
 
 	if (peer) {
 		if (firstpass) {
-			ast_copy_flags(peer, &globalflags, IAX_USEJITTERBUF | IAX_FORCEJITTERBUF);
+			ast_copy_flags(peer, &globalflags, IAX_USEJITTERBUF | IAX_FORCEJITTERBUF | IAX_SENDCONNECTEDLINE | IAX_RECVCONNECTEDLINE);
 			peer->encmethods = iax2_encryption;
 			peer->adsi = adsi;
 			ast_string_field_set(peer,secret,"");
@@ -10524,6 +10560,20 @@
 				ast_string_field_set(peer, zonetag, v->value);
 			} else if (!strcasecmp(v->name, "adsi")) {
 				peer->adsi = ast_true(v->value);
+			} else if (!strcasecmp(v->name, "connectedline")) {
+				if (ast_true(v->value)) {
+					ast_set_flag(peer, IAX_SENDCONNECTEDLINE);
+					ast_set_flag(peer, IAX_RECVCONNECTEDLINE);
+				} else if (!strcasecmp(v->value, "send")) {
+					ast_clear_flag(peer, IAX_RECVCONNECTEDLINE);
+					ast_set_flag(peer, IAX_SENDCONNECTEDLINE);
+				} else if (!strcasecmp(v->value, "receive")) {
+					ast_clear_flag(peer, IAX_SENDCONNECTEDLINE);
+					ast_set_flag(peer, IAX_RECVCONNECTEDLINE);
+				} else {
+					ast_clear_flag(peer, IAX_SENDCONNECTEDLINE);
+					ast_clear_flag(peer, IAX_RECVCONNECTEDLINE);
+				}
 			}/* else if (strcasecmp(v->name,"type")) */
 			/*	ast_log(LOG_WARNING, "Ignoring %s\n", v->name); */
 			v = v->next;
@@ -10622,7 +10672,7 @@
 			user->adsi = adsi;
 			ast_string_field_set(user, name, name);
 			ast_string_field_set(user, language, language);
-			ast_copy_flags(user, &globalflags, IAX_USEJITTERBUF | IAX_FORCEJITTERBUF | IAX_CODEC_USER_FIRST | IAX_CODEC_NOPREFS | IAX_CODEC_NOCAP);	
+			ast_copy_flags(user, &globalflags, IAX_USEJITTERBUF | IAX_FORCEJITTERBUF | IAX_SENDCONNECTEDLINE | IAX_RECVCONNECTEDLINE | IAX_CODEC_USER_FIRST | IAX_CODEC_NOPREFS | IAX_CODEC_NOCAP);	
 			ast_clear_flag(user, IAX_HASCALLERID);
 			ast_string_field_set(user, cid_name, "");
 			ast_string_field_set(user, cid_num, "");
@@ -10753,6 +10803,20 @@
 					user->maxauthreq = 0;
 			} else if (!strcasecmp(v->name, "adsi")) {
 				user->adsi = ast_true(v->value);
+			} else if (!strcasecmp(v->name, "connectedline")) {
+				if (ast_true(v->value)) {
+					ast_set_flag(user, IAX_SENDCONNECTEDLINE);
+					ast_set_flag(user, IAX_RECVCONNECTEDLINE);
+				} else if (!strcasecmp(v->value, "send")) {
+					ast_clear_flag(user, IAX_RECVCONNECTEDLINE);
+					ast_set_flag(user, IAX_SENDCONNECTEDLINE);
+				} else if (!strcasecmp(v->value, "receive")) {
+					ast_clear_flag(user, IAX_SENDCONNECTEDLINE);
+					ast_set_flag(user, IAX_RECVCONNECTEDLINE);
+				} else {
+					ast_clear_flag(user, IAX_SENDCONNECTEDLINE);
+					ast_clear_flag(user, IAX_RECVCONNECTEDLINE);
+				}
 			}/* else if (strcasecmp(v->name,"type")) */
 			/*	ast_log(LOG_WARNING, "Ignoring %s\n", v->name); */
 			v = v->next;
@@ -10868,6 +10932,8 @@
 	ast_clear_flag((&globalflags), IAX_TRANSFERMEDIA);	
 	ast_clear_flag((&globalflags), IAX_USEJITTERBUF);	
 	ast_clear_flag((&globalflags), IAX_FORCEJITTERBUF);	
+	ast_clear_flag((&globalflags), IAX_SENDCONNECTEDLINE);
+	ast_clear_flag((&globalflags), IAX_RECVCONNECTEDLINE);
 	delete_users();
 }
 
@@ -11146,6 +11212,20 @@
 			adsi = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "srvlookup")) {
 			srvlookup = ast_true(v->value);
+		} else if (!strcasecmp(v->name, "connectedline")) {
+			if (ast_true(v->value)) {
+				ast_set_flag((&globalflags), IAX_SENDCONNECTEDLINE);
+				ast_set_flag((&globalflags), IAX_RECVCONNECTEDLINE);
+			} else if (!strcasecmp(v->value, "send")) {
+				ast_clear_flag((&globalflags), IAX_RECVCONNECTEDLINE);
+				ast_set_flag((&globalflags), IAX_SENDCONNECTEDLINE);
+			} else if (!strcasecmp(v->value, "receive")) {
+				ast_clear_flag((&globalflags), IAX_SENDCONNECTEDLINE);
+				ast_set_flag((&globalflags), IAX_RECVCONNECTEDLINE);
+			} else {
+				ast_clear_flag((&globalflags), IAX_SENDCONNECTEDLINE);
+				ast_clear_flag((&globalflags), IAX_RECVCONNECTEDLINE);
+			}
 		} /*else if (strcasecmp(v->name,"type")) */
 		/*	ast_log(LOG_WARNING, "Ignoring %s\n", v->name); */
 		v = v->next;

Modified: team/oej/bug8824-temp/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/oej/bug8824-temp/channels/chan_local.c?view=diff&rev=135999&r1=135998&r2=135999
==============================================================================
--- team/oej/bug8824-temp/channels/chan_local.c (original)
+++ team/oej/bug8824-temp/channels/chan_local.c Wed Aug  6 06:07:09 2008
@@ -501,11 +501,18 @@
 	 * Note that cid_num and cid_name aren't passed in the ast_channel_alloc
 	 * call, so it's done here instead.
 	 */
-	p->chan->cid.cid_num = ast_strdup(p->owner->cid.cid_num);
-	p->chan->cid.cid_name = ast_strdup(p->owner->cid.cid_name);
-	p->chan->cid.cid_rdnis = ast_strdup(p->owner->cid.cid_rdnis);
-	p->chan->cid.cid_ani = ast_strdup(p->owner->cid.cid_ani);
-	p->chan->cid.cid_pres = p->owner->cid.cid_pres;
+	p->chan->cid.cid_num = ast_strdup(p->owner->lid.lid_num);
+	p->chan->cid.cid_name = ast_strdup(p->owner->lid.lid_name);
+	p->chan->cid.cid_ani = ast_strdup(p->owner->lid.lid_ani);
+	p->chan->cid.cid_rdnis = ast_strdup(p->owner->lid.lid_rdnis);
+
+	p->chan->cid.cid_pres = p->owner->lid.lid_pres;
+	p->chan->cid.cid_ton = p->owner->lid.lid_ton;
+	p->chan->cid.cid_tns = p->owner->lid.lid_tns;
+	p->chan->cid.cid_ani2 = p->owner->lid.lid_ani2;
+
+	ast_set_connectedline(p->chan, p->owner->cid.cid_num, p->owner->cid.cid_name, p->owner->cid.cid_pres);
+
 	ast_string_field_set(p->chan, language, p->owner->language);

[... 1275 lines stripped ...]



More information about the asterisk-commits mailing list