[asterisk-commits] rmudgett: branch group/v14_colp r146248 - in /team/group/v14_colp: apps/ chan...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Oct 3 18:05:31 CDT 2008


Author: rmudgett
Date: Fri Oct  3 18:05:30 2008
New Revision: 146248

URL: http://svn.digium.com/view/asterisk?view=rev&rev=146248
Log:
Initial merge from issue8824 branch back to 1.4 code level.
Only missing merge of chan_sip.c.


Added:
    team/group/v14_colp/funcs/func_connectedline.c
      - copied, changed from r145912, team/group/issue8824/funcs/func_connectedline.c
    team/group/v14_colp/funcs/func_redirecting.c
      - copied, changed from r145914, team/group/issue8824/funcs/func_redirecting.c
Modified:
    team/group/v14_colp/apps/app_dial.c
    team/group/v14_colp/apps/app_queue.c
    team/group/v14_colp/channels/chan_agent.c
    team/group/v14_colp/channels/chan_dahdi.c
    team/group/v14_colp/channels/chan_features.c
    team/group/v14_colp/channels/chan_h323.c
    team/group/v14_colp/channels/chan_iax2.c
    team/group/v14_colp/channels/chan_local.c
    team/group/v14_colp/channels/chan_mgcp.c
    team/group/v14_colp/channels/chan_misdn.c
    team/group/v14_colp/channels/chan_phone.c
    team/group/v14_colp/channels/chan_skinny.c
    team/group/v14_colp/channels/misdn/chan_misdn_config.h
    team/group/v14_colp/channels/misdn/isdn_lib.c
    team/group/v14_colp/channels/misdn/isdn_lib.h
    team/group/v14_colp/channels/misdn/isdn_lib_intern.h
    team/group/v14_colp/channels/misdn/isdn_msg_parser.c
    team/group/v14_colp/channels/misdn_config.c
    team/group/v14_colp/configs/misdn.conf.sample
    team/group/v14_colp/configs/sip.conf.sample
    team/group/v14_colp/funcs/func_callerid.c
    team/group/v14_colp/include/asterisk/callerid.h
    team/group/v14_colp/include/asterisk/channel.h
    team/group/v14_colp/include/asterisk/frame.h
    team/group/v14_colp/main/callerid.c
    team/group/v14_colp/main/channel.c
    team/group/v14_colp/main/dial.c
    team/group/v14_colp/main/rtp.c
    team/group/v14_colp/res/res_features.c

Modified: team/group/v14_colp/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/group/v14_colp/apps/app_dial.c?view=diff&rev=146248&r1=146247&r2=146248
==============================================================================
--- team/group/v14_colp/apps/app_dial.c (original)
+++ team/group/v14_colp/apps/app_dial.c Fri Oct  3 18:05:30 2008
@@ -115,10 +115,9 @@
 "           DTMF string is sent to the called party, and the 'calling' DTMF\n"
 "           string is sent to the calling party. Both parameters can be used\n"
 "           alone.\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"
 "           destination channel hangs up.\n"
 "    G(context^exten^pri) - If the call is answered, transfer the calling party to\n"
@@ -130,6 +129,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"
 "    j    - Jump to priority n+101 if all of the requested channels were busy.\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"
@@ -220,38 +221,39 @@
 "to the Dial application.\n";
 
 enum {
-	OPT_ANNOUNCE =		(1 << 0),
-	OPT_RESETCDR =		(1 << 1),
-	OPT_DTMF_EXIT =		(1 << 2),
-	OPT_SENDDTMF =		(1 << 3),
-	OPT_FORCECLID =		(1 << 4),
-	OPT_GO_ON =		(1 << 5),
-	OPT_CALLEE_HANGUP =	(1 << 6),
-	OPT_CALLER_HANGUP =	(1 << 7),
-	OPT_PRIORITY_JUMP =	(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_SCREENING =		(1 << 15),
-	OPT_PRIVACY =		(1 << 16),
-	OPT_RINGBACK =		(1 << 17),
-	OPT_DURATION_STOP =	(1 << 18),
-	OPT_CALLEE_TRANSFER =	(1 << 19),
-	OPT_CALLER_TRANSFER =	(1 << 20),
-	OPT_CALLEE_MONITOR =	(1 << 21),
-	OPT_CALLER_MONITOR =	(1 << 22),
-	OPT_GOTO =		(1 << 23),
-	OPT_OPERMODE = 		(1 << 24),
-	OPT_CALLEE_PARK =	(1 << 25),
-	OPT_CALLER_PARK =	(1 << 26),
+	OPT_ANNOUNCE =          (1 << 0),
+	OPT_RESETCDR =          (1 << 1),
+	OPT_DTMF_EXIT =         (1 << 2),
+	OPT_SENDDTMF =          (1 << 3),
+	OPT_FORCE_CALLERID =    (1 << 4),
+	OPT_GO_ON =             (1 << 5),
+	OPT_CALLEE_HANGUP =     (1 << 6),
+	OPT_CALLER_HANGUP =     (1 << 7),
+	OPT_PRIORITY_JUMP =     (1 << 8),
+	OPT_DURATION_LIMIT =    (1 << 9),
+	OPT_MUSICBACK =         (1 << 10),
+	OPT_CALLEE_MACRO =      (1 << 11),
+	OPT_SCREEN_NOINTRO =    (1 << 12),
+	OPT_SCREEN_NOCALLERID = (1 << 13),
+	OPT_IGNORE_CONNECTEDLINE = (1 << 14),
+	OPT_SCREENING =         (1 << 15),
+	OPT_PRIVACY =           (1 << 16),
+	OPT_RINGBACK =          (1 << 17),
+	OPT_DURATION_STOP =     (1 << 18),
+	OPT_CALLEE_TRANSFER =   (1 << 19),
+	OPT_CALLER_TRANSFER =   (1 << 20),
+	OPT_CALLEE_MONITOR =    (1 << 21),
+	OPT_CALLER_MONITOR =    (1 << 22),
+	OPT_GOTO =              (1 << 23),
+	OPT_OPERMODE =          (1 << 24),
+	OPT_CALLEE_PARK =       (1 << 25),
+	OPT_CALLER_PARK =       (1 << 26),
 	OPT_IGNORE_FORWARDING = (1 << 27),
 } dial_exec_option_flags;
 
 #define DIAL_STILLGOING			(1 << 30)
 #define DIAL_NOFORWARDHTML		(1 << 31)
+#define DIAL_NOCONNECTEDLINE	(1 << 29)	/* 33 on trunk */
 
 enum {
 	OPT_ARG_ANNOUNCE = 0,
@@ -263,6 +265,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,
 } dial_exec_option_args;
@@ -272,12 +275,13 @@
 	AST_APP_OPTION('C', OPT_RESETCDR),
 	AST_APP_OPTION('d', OPT_DTMF_EXIT),
 	AST_APP_OPTION_ARG('D', OPT_SENDDTMF, OPT_ARG_SENDDTMF),
-	AST_APP_OPTION('f', OPT_FORCECLID),
+	AST_APP_OPTION_ARG('f', OPT_FORCE_CALLERID, OPT_ARG_FORCE_CALLERID),
 	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('j', OPT_PRIORITY_JUMP),
 	AST_APP_OPTION('k', OPT_CALLEE_PARK),
 	AST_APP_OPTION('K', OPT_CALLER_PARK),
@@ -285,8 +289,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),
@@ -356,6 +359,14 @@
 	} \
 } while (0)
 
+/*! \brief free the buffer if allocated, and set the pointer to the second arg */
+#define S_REPLACE(s, new_val) \
+	do {                      \
+		if (s) {              \
+			ast_free(s);      \
+		}                     \
+		s = (new_val);        \
+	} while (0)
 
 static int onedigit_goto(struct ast_channel *chan, const char *context, char exten, int pri) 
 {
@@ -373,15 +384,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)
@@ -408,13 +410,22 @@
 	int orig = *to;
 	struct ast_channel *peer = NULL;
 	/* single is set if only one destination is enabled */
-	int single = outgoing && !outgoing->next && !ast_test_flag(outgoing, OPT_MUSICBACK | OPT_RINGBACK);
-	
+	int single = outgoing && !outgoing->next;
+	struct ast_party_connected_line connected_caller;
+
 	if (single) {
 		/* Turn off hold music, etc */
-		ast_deactivate_generator(in);
+		if (!ast_test_flag(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_flag(peerflags, OPT_IGNORE_CONNECTEDLINE) && !ast_test_flag(outgoing, DIAL_NOCONNECTEDLINE)) {
+			ast_party_connected_line_collect_caller(&connected_caller, &outgoing->chan->cid);
+			connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
+			ast_connected_line_update(in, &connected_caller);
+		}
 	}
 	
 	
@@ -462,6 +473,11 @@
 				if (!peer) {
 					if (option_verbose > 2)
 						ast_verbose(VERBOSE_PREFIX_3 "%s answered %s\n", c->name, in->name);
+					if (!single && !ast_test_flag(peerflags, OPT_IGNORE_CONNECTEDLINE) && !ast_test_flag(o, DIAL_NOCONNECTEDLINE)) {
+						ast_party_connected_line_collect_caller(&connected_caller, &c->cid);
+						connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
+						ast_connected_line_update(in, &connected_caller);
+					}
 					peer = c;
 					ast_copy_flags(peerflags, o,
 						       OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER |
@@ -478,6 +494,8 @@
 				continue;
 			if (!ast_strlen_zero(c->call_forward)) {
 				char tmpchan[256];
+				struct ast_party_redirecting *apr = &o->chan->redirecting;
+				struct ast_party_connected_line *apc = &o->chan->connected;
 				char *stuff;
 				char *tech;
 				int cause;
@@ -516,32 +534,20 @@
 					HANDLE_CAUSE(cause, in);
 				} else {
 					ast_rtp_make_compatible(c, in, single);
-					if (c->cid.cid_num)
-						free(c->cid.cid_num);
-					c->cid.cid_num = NULL;
-					if (c->cid.cid_name)
-						free(c->cid.cid_name);
-					c->cid.cid_name = NULL;
-
-					if (ast_test_flag(o, OPT_FORCECLID)) {
-						c->cid.cid_num = ast_strdup(S_OR(in->macroexten, in->exten));
-						ast_string_field_set(c, accountcode, winner->accountcode);
-						c->cdrflags = winner->cdrflags;
-					} else {
-						c->cid.cid_num = ast_strdup(in->cid.cid_num);
-						c->cid.cid_name = ast_strdup(in->cid.cid_name);
-						ast_string_field_set(c, accountcode, in->accountcode);
-						c->cdrflags = in->cdrflags;
-					}
-
-					if (in->cid.cid_ani) {
-						if (c->cid.cid_ani)
-							free(c->cid.cid_ani);
-						c->cid.cid_ani = ast_strdup(in->cid.cid_ani);
-					}
-					if (c->cid.cid_rdnis) 
-						free(c->cid.cid_rdnis);
-					c->cid.cid_rdnis = ast_strdup(S_OR(in->macroexten, in->exten));
+
+					ast_string_field_set(c, accountcode, in->accountcode);
+					c->cdrflags = in->cdrflags;
+
+					ast_party_redirecting_copy(&o->chan->redirecting, apr);
+
+					S_REPLACE(c->cid.cid_rdnis, ast_strdup(S_OR(in->macroexten, in->exten)));
+					c->cid.cid_tns = in->cid.cid_tns;
+
+					ast_party_caller_copy(&c->cid, &in->cid);
+					ast_party_connected_line_copy(&c->connected, apc);
+
+					ast_redirecting_update(in, apr);
+
 					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_flag(o, DIAL_STILLGOING);	
@@ -550,11 +556,6 @@
 						numnochan++;
 					} else {
 						senddialevent(in, c);
-						/* After calling, set callerid to extension */
-						if (!ast_test_flag(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 */
@@ -577,6 +578,11 @@
 					if (!peer) {
 						if (option_verbose > 2)
 							ast_verbose( VERBOSE_PREFIX_3 "%s answered %s\n", c->name, in->name);
+						if (!single && !ast_test_flag(peerflags, OPT_IGNORE_CONNECTEDLINE) && !ast_test_flag(o, DIAL_NOCONNECTEDLINE)) {
+							ast_party_connected_line_collect_caller(&connected_caller, &c->cid);
+							connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
+							ast_connected_line_update(in, &connected_caller);
+						}
 						peer = c;
 						if (peer->cdr) {
 							peer->cdr->answer = ast_tvnow();
@@ -646,6 +652,21 @@
 						ast_verbose (VERBOSE_PREFIX_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_CONNECTED_LINE:
+					if (!single || ast_test_flag(peerflags, OPT_IGNORE_CONNECTEDLINE)) {
+						if (option_verbose > 2)
+							ast_verbose (VERBOSE_PREFIX_3 "Connected line update to %s prevented.\n", in->name);
+					} else {
+						if (option_verbose > 2)
+							ast_verbose (VERBOSE_PREFIX_3 "%s connected line has changed, passing it to %s\n", c->name, in->name);
+						ast_indicate_data(in, AST_CONTROL_CONNECTED_LINE, f->data, f->datalen);
+					}
+					break;
+				case AST_CONTROL_REDIRECTING:
+					if (option_verbose > 2)
+						ast_verbose (VERBOSE_PREFIX_3 "%s redirecting info has changed, passing it to %s\n", c->name, in->name);
+					ast_indicate_data(in, AST_CONTROL_REDIRECTING, f->data, f->datalen);
+					break;
 				case AST_CONTROL_PROCEEDING:
 					if (option_verbose > 2)
 						ast_verbose (VERBOSE_PREFIX_3 "%s is proceeding passing it to %s\n", c->name, in->name);
@@ -757,7 +778,9 @@
 				((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_CONNECTED_LINE) ||
+				 (f->subclass == AST_CONTROL_REDIRECTING))) {
 				if (option_verbose > 2)
 					ast_verbose(VERBOSE_PREFIX_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, f->datalen);
@@ -837,7 +860,7 @@
 	int numnochan = 0;
 	int cause;
 	char numsubst[256];
-	char cidname[AST_MAX_EXTENSION] = "";
+	char *cid_num = NULL, *cid_name = NULL;
 	int privdb_val = 0;
 	unsigned int calldurationlimit = 0;
 	long timelimit = 0;
@@ -993,6 +1016,8 @@
 		}
 	}
 
+	if (ast_test_flag(&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_flag(&opts, OPT_RESETCDR) && chan->cdr)
 		ast_cdr_reset(chan->cdr, NULL);
 	if (ast_test_flag(&opts, OPT_PRIVACY) && ast_strlen_zero(opt_args[OPT_ARG_PRIVACY]))
@@ -1032,12 +1057,13 @@
 		
 		ast_copy_string(privcid,l,sizeof(privcid));
 
-		if( strncmp(privcid,"NOCALLERID",10) != 0 && ast_test_flag(&opts, OPT_SCREEN_NOCLID) ) { /* if callerid is set, and ast_test_flag(&opts, OPT_SCREEN_NOCLID) is set also */  
+		if (strncmp(privcid, "NOCALLERID", 10) != 0 && ast_test_flag(&opts, OPT_SCREEN_NOCALLERID)) {
+			/* if callerid is set and OPT_SCREEN_NOCALLERID is set also */  
 			if (option_verbose > 2)
 				ast_verbose( VERBOSE_PREFIX_3  "CallerID set (%s); N option set; Screening should be off\n", privcid);
 			privdb_val = AST_PRIVACY_ALLOW;
 		}
-		else if(ast_test_flag(&opts, OPT_SCREEN_NOCLID) && strncmp(privcid,"NOCALLERID",10) == 0 ) {
+		else if (ast_test_flag(&opts, OPT_SCREEN_NOCALLERID) && strncmp(privcid, "NOCALLERID", 10) == 0) {
 			if (option_verbose > 2)
 				ast_verbose( VERBOSE_PREFIX_3  "CallerID blank; N option set; Screening should happen; dbval is %d\n", privdb_val);
 		}
@@ -1123,7 +1149,7 @@
 		outbound_group = pbx_builtin_getvar_helper(chan, "OUTBOUND_GROUP");
 	}
 	    
-	ast_copy_flags(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID | OPT_CALLER_HANGUP | OPT_IGNORE_FORWARDING);
+	ast_copy_flags(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))) {
@@ -1165,11 +1191,11 @@
 			goto out;
 		if (opts.flags) {
 			ast_copy_flags(tmp, &opts,
-				       OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER |
-				       OPT_CALLEE_HANGUP | OPT_CALLER_HANGUP |
-				       OPT_CALLEE_MONITOR | OPT_CALLER_MONITOR |
-				       OPT_CALLEE_PARK | OPT_CALLER_PARK |
-				       OPT_RINGBACK | OPT_MUSICBACK | OPT_FORCECLID);
+				OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER |
+				OPT_CALLEE_HANGUP | OPT_CALLER_HANGUP |
+				OPT_CALLEE_MONITOR | OPT_CALLER_MONITOR |
+				OPT_CALLEE_PARK | OPT_CALLER_PARK |
+				OPT_RINGBACK | OPT_MUSICBACK);
 			ast_set2_flag(tmp, args.url, DIAL_NOFORWARDHTML);	
 		}
 		ast_copy_string(numsubst, number, sizeof(numsubst));
@@ -1259,17 +1285,34 @@
 		tmp->chan->data = "(Outgoing Line)";
 		tmp->chan->whentohangup = 0;
 
-		if (tmp->chan->cid.cid_num)
-			free(tmp->chan->cid.cid_num);
-		tmp->chan->cid.cid_num = ast_strdup(chan->cid.cid_num);
-
-		if (tmp->chan->cid.cid_name)
-			free(tmp->chan->cid.cid_name);
-		tmp->chan->cid.cid_name = ast_strdup(chan->cid.cid_name);
-
-		if (tmp->chan->cid.cid_ani)
-			free(tmp->chan->cid.cid_ani);
-		tmp->chan->cid.cid_ani = ast_strdup(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(chan->connected.id.number)) {
+				ast_set_callerid(tmp->chan, chan->connected.id.number, chan->connected.id.name, chan->connected.ani);
+			} else if (!ast_strlen_zero(chan->cid.cid_dnid)) {
+				ast_set_callerid(tmp->chan, chan->cid.cid_dnid, NULL, NULL);
+			} else if (!ast_strlen_zero(S_OR(chan->macroexten, chan->exten))) {
+				ast_set_callerid(tmp->chan, S_OR(chan->macroexten, chan->exten), NULL, NULL);
+			}
+			ast_set_flag(tmp, DIAL_NOCONNECTEDLINE);
+		}
+
+		if (ast_test_flag(peerflags, OPT_FORCE_CALLERID)) {
+			struct ast_party_connected_line connected;
+
+			ast_party_connected_line_set_init(&connected, &tmp->chan->connected);
+			connected.id.number = cid_num;
+			connected.id.name = cid_name;
+			connected.id.number_presentation = AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN;
+			ast_set_connected_line(tmp->chan, &connected);
+		} else {
+			ast_copy_caller_to_connected(&tmp->chan->connected, &chan->cid);
+		}
+
+		S_REPLACE(tmp->chan->cid.cid_rdnis, ast_strdup(chan->cid.cid_rdnis));
+		ast_party_redirecting_copy(&tmp->chan->redirecting, &chan->redirecting);
+
+		tmp->chan->cid.cid_tns = chan->cid.cid_tns;
 		
 		/* Copy language from incoming to outgoing */
 		ast_string_field_set(tmp->chan, language, chan->language);
@@ -1277,17 +1320,9 @@
 		tmp->chan->cdrflags = chan->cdrflags;
 		if (ast_strlen_zero(tmp->chan->musicclass))
 			ast_string_field_set(tmp->chan, musicclass, chan->musicclass);
-		/* XXX don't we free previous values ? */
-		tmp->chan->cid.cid_rdnis = ast_strdup(chan->cid.cid_rdnis);
-		/* Pass callingpres setting */
-		tmp->chan->cid.cid_pres = chan->cid.cid_pres;
-		/* Pass type of number */
-		tmp->chan->cid.cid_ton = chan->cid.cid_ton;
-		/* Pass type of tns */
-		tmp->chan->cid.cid_tns = chan->cid.cid_tns;
-		/* Presense of ADSI CPE on outgoing channel follows ours */
+
+		/* Pass ADSI CPE and transfer capability */
 		tmp->chan->adsicpe = chan->adsicpe;
-		/* Pass the transfer capability */
 		tmp->chan->transfercapability = chan->transfercapability;
 
 		/* If we have an outbound group, set this peer channel to it */
@@ -1347,8 +1382,6 @@
 			senddialevent(chan, tmp->chan);
 			if (option_verbose > 2)
 				ast_verbose(VERBOSE_PREFIX_3 "Called %s\n", numsubst);
-			if (!ast_test_flag(peerflags, OPT_ORIGINAL_CLID))
-				ast_set_callerid(tmp->chan, 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/group/v14_colp/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/group/v14_colp/apps/app_queue.c?view=diff&rev=146248&r1=146247&r2=146248
==============================================================================
--- team/group/v14_colp/apps/app_queue.c (original)
+++ team/group/v14_colp/apps/app_queue.c Fri Oct  3 18:05:30 2008
@@ -98,6 +98,7 @@
 #include "asterisk/stringfields.h"
 #include "asterisk/astobj2.h"
 #include "asterisk/global_datastores.h"
+#include "asterisk/callerid.h"
 
 /* Please read before modifying this file.
  * There are three locks which are regularly used
@@ -162,6 +163,8 @@
 "             go to the next step.\n"
 "      'i' -- ignore call forward requests from queue members and do nothing\n"
 "             when they are requested.\n"
+"      'I' -- Asterisk will ignore any connected line update requests it may receive\n"
+"             on this dial attempt.\n"
 "      'r' -- ring instead of playing MOH\n"
 "      't' -- allow the called user transfer the calling user\n"
 "      'T' -- to allow the calling user to transfer the call.\n"
@@ -316,6 +319,7 @@
 	int oldstatus;
 	time_t lastcall;
 	struct member *member;
+	int update_connectedline;
 };
 
 
@@ -1851,15 +1855,28 @@
 	tmp->chan->appl = "AppQueue";
 	tmp->chan->data = "(Outgoing Line)";
 	tmp->chan->whentohangup = 0;
-	if (tmp->chan->cid.cid_num)
-		free(tmp->chan->cid.cid_num);
-	tmp->chan->cid.cid_num = ast_strdup(qe->chan->cid.cid_num);
-	if (tmp->chan->cid.cid_name)
-		free(tmp->chan->cid.cid_name);
-	tmp->chan->cid.cid_name = ast_strdup(qe->chan->cid.cid_name);
-	if (tmp->chan->cid.cid_ani)
-		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->connected.id.number)) {
+			ast_set_callerid(tmp->chan, qe->chan->connected.id.number, qe->chan->connected.id.name, qe->chan->connected.ani);
+			tmp->chan->cid.cid_pres = qe->chan->connected.id.number_presentation;
+		} 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); 
+		}
+		tmp->update_connectedline = 0;
+	}
+
+	if (tmp->chan->cid.cid_rdnis)
+		ast_free(tmp->chan->cid.cid_rdnis);
+	tmp->chan->cid.cid_rdnis = ast_strdup(qe->chan->cid.cid_rdnis);
+	ast_party_redirecting_copy(&tmp->chan->redirecting, &qe->chan->redirecting);
+
+	tmp->chan->cid.cid_tns = qe->chan->cid.cid_tns;
+
+	ast_copy_caller_to_connected(&tmp->chan->connected, &qe->chan->cid);
 
 	/* Inherit specially named variables from parent channel */
 	ast_channel_inherit_variables(qe->chan, tmp->chan);
@@ -2084,7 +2101,7 @@
  * \param[in] caller_disconnect if the 'H' option is used when calling Queue(), this is used to detect if the caller pressed * to disconnect the call
  * \param[in] forwardsallowed used to detect if we should allow call forwarding, based on the 'i' option to Queue()
  */
-static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callattempt *outgoing, int *to, char *digit, int prebusies, int caller_disconnect, int forwardsallowed)
+static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callattempt *outgoing, int *to, char *digit, int prebusies, int caller_disconnect, int forwardsallowed, int update_connectedline)
 {
 	char *queue = qe->parent->name;
 	struct callattempt *o, *start = NULL, *prev = NULL;
@@ -2101,6 +2118,7 @@
 	char membername[80] = "";
 	long starttime = 0;
 	long endtime = 0;	
+	struct ast_party_connected_line connected_caller;
 
 	starttime = (long) time(NULL);
 	
@@ -2149,6 +2167,11 @@
 				if (!peer) {
 					if (option_verbose > 2)
 						ast_verbose( VERBOSE_PREFIX_3 "%s answered %s\n", o->chan->name, in->name);
+					if (update_connectedline && o->update_connectedline) {
+						ast_party_connected_line_collect_caller(&connected_caller, &o->chan->cid);
+						connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
+						ast_connected_line_update(in, &connected_caller);
+					}
 					peer = o;
 				}
 			} else if (o->chan && (o->chan == winner)) {
@@ -2164,6 +2187,8 @@
 					winner = NULL;
 					continue;
 				} else if (!ast_strlen_zero(o->chan->call_forward)) {
+					struct ast_party_redirecting *apr = &o->chan->redirecting;
+					struct ast_party_connected_line *apc = &o->chan->connected;
 					char tmpchan[256];
 					char *stuff;
 					char *tech;
@@ -2189,25 +2214,23 @@
 					} else {
 						ast_channel_inherit_variables(in, o->chan);
 						ast_channel_datastore_inherit(in, o->chan);
-						if (o->chan->cid.cid_num)
-							free(o->chan->cid.cid_num);
-						o->chan->cid.cid_num = ast_strdup(in->cid.cid_num);
-
-						if (o->chan->cid.cid_name)
-							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)
-								free(o->chan->cid.cid_ani);
-							o->chan->cid.cid_ani = ast_strdup(in->cid.cid_ani);
-						}
+						ast_party_redirecting_copy(&o->chan->redirecting, apr);
+
 						if (o->chan->cid.cid_rdnis)
-							free(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_tns = in->cid.cid_tns;
+
+						ast_party_caller_copy(&o->chan->cid, &in->cid);
+						ast_party_connected_line_copy(&o->chan->connected, apc);
+
+						ast_redirecting_update(in, apr);
+
 						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);
@@ -2227,6 +2250,11 @@
 							if (!peer) {
 								if (option_verbose > 2)
 									ast_verbose( VERBOSE_PREFIX_3 "%s answered %s\n", o->chan->name, in->name);
+								if (update_connectedline && o->update_connectedline) {
+									ast_party_connected_line_collect_caller(&connected_caller, &o->chan->cid);
+									connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
+									ast_connected_line_update(in, &connected_caller);
+								}
 								peer = o;
 							}
 							break;
@@ -2269,8 +2297,24 @@
 						case AST_CONTROL_OFFHOOK:
 							/* Ignore going off hook */
 							break;
+						case AST_CONTROL_CONNECTED_LINE:
+							if (!update_connectedline) {
+								if (option_verbose > 2)
+									ast_verbose(VERBOSE_PREFIX_3 "Connected line update to %s prevented.\n", in->name);
+							} else {
+								if (option_verbose > 2)
+									ast_verbose(VERBOSE_PREFIX_3 "%s connected line has changed, passing it to %s\n", o->chan->name, in->name);
+								ast_indicate_data(in, AST_CONTROL_CONNECTED_LINE, f->data, f->datalen);
+							}
+							break;
+						case AST_CONTROL_REDIRECTING:
+							if (option_verbose > 2)
+								ast_verbose(VERBOSE_PREFIX_3 "%s redirecting info has changed, passing it to %s\n", o->chan->name, in->name);
+							ast_indicate_data(in, AST_CONTROL_REDIRECTING, f->data, f->datalen);
+							break;
 						default:
 							ast_log(LOG_DEBUG, "Dunno what to do with control type %d\n", f->subclass);
+							break;
 						}
 					}
 					ast_frfree(f);
@@ -2710,6 +2754,7 @@
 	char *p;
 	char vars[2048];
 	int forwardsallowed = 1;
+	int update_connectedline = 1;
 	int callcompletedinsl;
 	struct ao2_iterator memi;
 	struct ast_datastore *datastore;
@@ -2763,6 +2808,9 @@
 		case 'i':
 			forwardsallowed = 0;
 			break;
+		case 'I':
+			update_connectedline = 0;
+			break;
 		}
 
 	/* Hold the lock while we setup the outgoing calls */
@@ -2856,6 +2904,7 @@
 		tmp->member = cur;
 		tmp->oldstatus = cur->status;
 		tmp->lastcall = cur->lastcall;
+		tmp->update_connectedline = 1;
 		ast_copy_string(tmp->interface, cur->interface, sizeof(tmp->interface));
 		/* Special case: If we ring everyone, go ahead and ring them, otherwise
 		   just calculate their metric for the appropriate strategy */
@@ -2882,7 +2931,7 @@
 	ring_one(qe, outgoing, &numbusies);
 	if (use_weight)
 		AST_LIST_UNLOCK(&queues);
-	lpeer = wait_for_answer(qe, outgoing, &to, &digit, numbusies, ast_test_flag(&(bridge_config.features_caller), AST_FEATURE_DISCONNECT), forwardsallowed);
+	lpeer = wait_for_answer(qe, outgoing, &to, &digit, numbusies, ast_test_flag(&(bridge_config.features_caller), AST_FEATURE_DISCONNECT), forwardsallowed, update_connectedline);
 	/* The ast_channel_datastore_remove() function could fail here if the
 	 * datastore was moved to another channel during a masquerade. If this is
 	 * the case, don't free the datastore here because later, when the channel

Modified: team/group/v14_colp/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/group/v14_colp/channels/chan_agent.c?view=diff&rev=146248&r1=146247&r2=146248
==============================================================================
--- team/group/v14_colp/channels/chan_agent.c (original)
+++ team/group/v14_colp/channels/chan_agent.c Fri Oct  3 18:05:30 2008
@@ -721,8 +721,7 @@
 		/* Call on this agent */
 		if (option_verbose > 2)
 			ast_verbose(VERBOSE_PREFIX_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_connected_line(p->chan, &ast->connected);
 		ast_channel_inherit_variables(ast, p->chan);
 		res = ast_call(p->chan, p->loginchan, 0);
 		CLEANUP(ast,p);

Modified: team/group/v14_colp/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/group/v14_colp/channels/chan_dahdi.c?view=diff&rev=146248&r1=146247&r2=146248
==============================================================================
--- team/group/v14_colp/channels/chan_dahdi.c (original)
+++ team/group/v14_colp/channels/chan_dahdi.c Fri Oct  3 18:05:30 2008
@@ -1877,7 +1877,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->connected.id.name, ast->connected.id.number, AST_LAW(p));
 					p->cidpos = 0;
 					send_callerid(p);
 				}
@@ -1918,12 +1918,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->connected.id.number)
+				ast_copy_string(p->callwait_num, ast->connected.id.number, 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->connected.id.name)
+				ast_copy_string(p->callwait_name, ast->connected.id.name, sizeof(p->callwait_name));
 			else
 				p->callwait_name[0] = '\0';
 			/* Call waiting tone instead */
@@ -1936,8 +1936,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->connected.id.name;
+		l = ast->connected.id.number;
 		if (l)
 			ast_copy_string(p->lastcid_num, l, sizeof(p->lastcid_num));
 		else
@@ -2003,14 +2003,14 @@
 
 		switch (mysig) {
 		case SIG_FEATD:
-			l = ast->cid.cid_num;
+			l = ast->connected.id.number;
 			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->connected.id.number;
 			if (l) 
 				snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "M*00%s#*%s#", l, c);
 			else
@@ -2117,9 +2117,9 @@
 		n = NULL;
 
 		if (!p->hidecallerid) {
-			l = ast->cid.cid_num;
+			l = ast->connected.id.number;
 			if (!p->hidecalleridname) {
-				n = ast->cid.cid_name;
+				n = ast->connected.id.name;
 			}
 		}
 
@@ -2219,7 +2219,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->connected.id.number_presentation : (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;

Modified: team/group/v14_colp/channels/chan_features.c
URL: http://svn.digium.com/view/asterisk/team/group/v14_colp/channels/chan_features.c?view=diff&rev=146248&r1=146247&r2=146248
==============================================================================
--- team/group/v14_colp/channels/chan_features.c (original)
+++ team/group/v14_colp/channels/chan_features.c Fri Oct  3 18:05:30 2008
@@ -345,12 +345,11 @@
 		ast_mutex_lock(&p->lock);
 		x = indexof(p, ast, 0);
 		if (!x && p->subchan) {
-			p->subchan->cid.cid_num = ast_strdup(p->owner->cid.cid_num);
-			p->subchan->cid.cid_name = ast_strdup(p->owner->cid.cid_name);
 			p->subchan->cid.cid_rdnis = ast_strdup(p->owner->cid.cid_rdnis);
-			p->subchan->cid.cid_ani = ast_strdup(p->owner->cid.cid_ani);
-		
-			p->subchan->cid.cid_pres = p->owner->cid.cid_pres;
+			ast_party_redirecting_copy(&p->subchan->redirecting, &p->owner->redirecting);
+
+			ast_party_caller_copy(&p->subchan->cid, &p->owner->cid);
+
 			ast_string_field_set(p->subchan, language, p->owner->language);
 			ast_string_field_set(p->subchan, accountcode, p->owner->accountcode);
 			p->subchan->cdrflags = p->owner->cdrflags;

Modified: team/group/v14_colp/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/group/v14_colp/channels/chan_h323.c?view=diff&rev=146248&r1=146247&r2=146248
==============================================================================
--- team/group/v14_colp/channels/chan_h323.c (original)
+++ team/group/v14_colp/channels/chan_h323.c Fri Oct  3 18:05:30 2008
@@ -614,18 +614,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->connected.id.number)
+		ast_copy_string(pvt->options.cid_num, c->connected.id.number, sizeof(pvt->options.cid_num));
+
+	if (c->connected.id.name)
+		ast_copy_string(pvt->options.cid_name, c->connected.id.name, sizeof(pvt->options.cid_name));
 
 	if (c->cid.cid_rdnis) {
 		ast_copy_string(pvt->options.cid_rdnis, c->cid.cid_rdnis, sizeof(pvt->options.cid_rdnis));
 	}
 
-	pvt->options.presentation = c->cid.cid_pres;
-	pvt->options.type_of_number = c->cid.cid_ton;
+	pvt->options.presentation = c->connected.id.number_presentation;
+	pvt->options.type_of_number = c->connected.id.number_type;
 
 	if ((addr = pbx_builtin_getvar_helper(c, "PRIREDIRECTREASON"))) {
 		if (!strcasecmp(addr, "UNKNOWN"))

Modified: team/group/v14_colp/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/group/v14_colp/channels/chan_iax2.c?view=diff&rev=146248&r1=146247&r2=146248
==============================================================================
--- team/group/v14_colp/channels/chan_iax2.c (original)
+++ team/group/v14_colp/channels/chan_iax2.c Fri Oct  3 18:05:30 2008
@@ -239,7 +239,7 @@
 	struct iax2_context *next;
 };
 
-enum {
+enum iax2_flags {
 	IAX_HASCALLERID = 	(1 << 0),	/*!< CallerID has been specified */
 	IAX_DELME =		(1 << 1),	/*!< Needs to be deleted */
 	IAX_TEMPONLY =		(1 << 2),	/*!< Temporary (realtime) */
@@ -269,7 +269,10 @@
 						     response, so that we've achieved a three-way handshake with
 						     them before sending voice or anything else*/
 	IAX_ALLOWFWDOWNLOAD = (1 << 26),	/*!< Allow the FWDOWNL command? */
-} iax2_flags;
+	/* IAX_NOKEYROTATE = (1 << 27), / * !< Disable key rotation with encryption */
+	IAX_SENDCONNECTEDLINE = (1 << 28), /*!< Allow sending of connected line updates */
+	IAX_RECVCONNECTEDLINE = (1 << 29), /*!< Allow receiving of connected line updates */
+};
 
 static int global_rtautoclear = 120;
 
@@ -1659,7 +1662,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);
@@ -3046,6 +3049,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];
@@ -3095,7 +3100,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;
@@ -3113,6 +3118,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)) {
@@ -3317,8 +3324,8 @@
 	if (pds.port)
 		sin.sin_port = htons(atoi(pds.port));
 
-	l = c->cid.cid_num;
-	n = c->cid.cid_name;
+	l = c->connected.id.number;
+	n = c->connected.id.name;
 
 	/* Now build request */	
 	memset(&ied, 0, sizeof(ied));
@@ -3335,21 +3342,21 @@
 
 	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->connected.id.number_presentation);
 	} else {
 		if (n)
-			iax_ie_append_byte(&ied, IAX_IE_CALLINGPRES, c->cid.cid_pres);
+			iax_ie_append_byte(&ied, IAX_IE_CALLINGPRES, c->connected.id.number_presentation);
 		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_byte(&ied, IAX_IE_CALLINGTON, c->connected.id.number_type);
 	iax_ie_append_short(&ied, IAX_IE_CALLINGTNS, c->cid.cid_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->connected.ani)

[... 8010 lines stripped ...]



More information about the asterisk-commits mailing list