[asterisk-commits] mmichelson: branch group/issue8824 r151868 - in /team/group/issue8824: apps/ ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Oct 23 19:13:22 CDT 2008


Author: mmichelson
Date: Thu Oct 23 19:13:22 2008
New Revision: 151868

URL: http://svn.digium.com/view/asterisk?view=rev&rev=151868
Log:
First pass at making sure that connected line logic
is working properly for parallel dialing and ringall queues,
as well as fixing logic used with local channels.

For dialing multiple destinations, we handle connected line
updates by locally updating the outgoing structure in app_dial
or app_queue and then applying this change once someone actually
answers. There are some XXX comments indicating that I need to
fix the answer logic up somewhat considering that there is 
redundancy in there.

Local channels are another beast. Since a connected line control
frame is only meant to *update* the channel receiving the indication,
it does not contain all pieces of information necessary. Therefore,
when a local channel attempts to use its default action of queuing
the data to the other side of the local channel, it means incomplete
information is reaching the original outgoing channel. This has been
fixed by using the cumulatively collected connected line information
present in the local channel when queueing the update instead of
just what was in the locally indicated frame. Note that there is a
XXX comment here since I'm not sure if there may actually be potential
for deadlock here. I will need to investigate further.

As said before, this is a first pass, more tweaks will happen...tomorrow!


Modified:
    team/group/issue8824/apps/app_dial.c
    team/group/issue8824/apps/app_queue.c
    team/group/issue8824/channels/chan_local.c

Modified: team/group/issue8824/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/apps/app_dial.c?view=diff&rev=151868&r1=151867&r2=151868
==============================================================================
--- team/group/issue8824/apps/app_dial.c (original)
+++ team/group/issue8824/apps/app_dial.c Thu Oct 23 19:13:22 2008
@@ -341,6 +341,7 @@
 	struct chanlist *next;
 	struct ast_channel *chan;
 	uint64_t flags;
+	struct ast_party_connected_line connected;
 };
 
 
@@ -631,6 +632,10 @@
 						connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
 						ast_connected_line_update(in, &connected_caller);
 					}
+					/* XXX Redundant code. Fix later */
+					if (!single && !ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE)) {
+						ast_connected_line_update(in, &o->connected);
+					}
 					peer = c;
 					ast_copy_flags64(peerflags, o,
 						OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER |
@@ -669,6 +674,7 @@
 					/* This is our guy if someone answered. */
 					if (!peer) {
 						ast_verb(3, "%s answered %s\n", c->name, in->name);
+						/* XXX Need to figure out whether to use the o->connected or c->cid here */
 						if (!single && !ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE) && !ast_test_flag64(o, DIAL_NOCONNECTEDLINE)) {
 							ast_party_connected_line_collect_caller(&connected_caller, &c->cid);
 							connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
@@ -688,6 +694,10 @@
 							DIAL_NOFORWARDHTML);
 						ast_string_field_set(c, dialcontext, "");
 						ast_copy_string(c->exten, "", sizeof(c->exten));
+						/* XXX Yes, I know this is redundant. Will fix */
+						if (!single && !ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE)) {
+							ast_connected_line_update(in, &o->connected);
+						}
 						if (CAN_EARLY_BRIDGE(peerflags, in, peer))
 							/* Setup early bridge if appropriate */
 							ast_channel_early_bridge(in, peer);
@@ -739,8 +749,14 @@
 					ast_indicate(in, AST_CONTROL_SRCUPDATE);
 					break;
 				case AST_CONTROL_CONNECTED_LINE:
-					if (!single || ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE)) {
+					if (ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE)) {
 						ast_verb(3, "Connected line update to %s prevented.\n", in->name);
+					} else if (!single) {
+						struct ast_party_connected_line connected;
+						ast_verb(3, "%s connected line has changed. Saving it until answer for %s\n", c->name, in->name);
+						ast_party_connected_line_set_init(&connected, &c->connected);
+						ast_parse_connected_line_data(f->data.ptr, f->datalen, &connected);
+						ast_party_connected_line_copy(&o->connected, &connected);
 					} else {
 						ast_verb(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.ptr, f->datalen);
@@ -1434,6 +1450,8 @@
 
 		ast_channel_lock(chan);
 		datastore = ast_channel_datastore_find(chan, &dialed_interface_info, NULL);
+		/* Might as well while the channel's locked, right?\n */
+		ast_party_connected_line_copy(&tmp->connected, &chan->connected);
 		ast_channel_unlock(chan);
 
 		if (datastore)

Modified: team/group/issue8824/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/apps/app_queue.c?view=diff&rev=151868&r1=151867&r2=151868
==============================================================================
--- team/group/issue8824/apps/app_queue.c (original)
+++ team/group/issue8824/apps/app_queue.c Thu Oct 23 19:13:22 2008
@@ -348,6 +348,7 @@
 	struct call_queue *lastqueue;
 	struct member *member;
 	int update_connectedline;
+	struct ast_party_connected_line connected;
 };
 
 
@@ -2499,6 +2500,10 @@
 						connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
 						ast_connected_line_update(in, &connected_caller);
 					}
+					/*XXX Yes, I know, you don't have to tell me */
+					if (update_connectedline && qe->parent->strategy == QUEUE_STRATEGY_RINGALL) {
+						ast_connected_line_update(in, &o->connected);
+					}
 					peer = o;
 				}
 			} else if (o->chan && (o->chan == winner)) {
@@ -2578,6 +2583,10 @@
 									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);
+								}
+								/*XXX THis is redundant. Fix later */
+								if (update_connectedline && qe->parent->strategy == QUEUE_STRATEGY_RINGALL) {
+									ast_connected_line_update(in, &o->connected);
 								}
 								peer = o;
 							}
@@ -2621,6 +2630,12 @@
 						case AST_CONTROL_CONNECTED_LINE:
 							if (!update_connectedline) {
 								ast_verb(3, "Connected line update to %s prevented.\n", in->name);
+							} else if (qe->parent->strategy == QUEUE_STRATEGY_RINGALL) {
+								struct ast_party_connected_line connected;
+								ast_verb(3, "%s connected line has changed. Saving it until answer for %s\n", o->chan->name, in->name);
+								ast_party_connected_line_set_init(&connected, &o->chan->connected);
+								ast_parse_connected_line_data(f->data.ptr, f->datalen, &connected);
+								ast_party_connected_line_copy(&o->connected, &connected);
 							} else {
 								ast_verb(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.ptr, f->datalen);
@@ -3322,6 +3337,9 @@
 			}
 		}
 		AST_LIST_UNLOCK(dialed_interfaces);
+
+		ast_channel_lock(qe->chan);
+		ast_party_connected_line_copy(&tmp->connected, &qe->chan->connected);
 		
 		if (di) {
 			free(tmp);

Modified: team/group/issue8824/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/channels/chan_local.c?view=diff&rev=151868&r1=151867&r2=151868
==============================================================================
--- team/group/issue8824/channels/chan_local.c (original)
+++ team/group/issue8824/channels/chan_local.c Thu Oct 23 19:13:22 2008
@@ -395,6 +395,13 @@
 		ast_moh_start(ast, data, NULL);
 	} else if (condition == AST_CONTROL_UNHOLD) {
 		ast_moh_stop(ast);
+	} else if (condition == AST_CONTROL_CONNECTED_LINE) {
+		/* We need to queue the actual channel's info, dawg */
+		isoutbound = IS_OUTBOUND(ast, p);
+		if (isoutbound) {
+			/*XXX investigate later for potential deadlock issues */
+			ast_queue_connected_line_update(p->owner, &p->chan->connected);
+		}
 	} else {
 		/* Queue up a frame representing the indication as a control frame */
 		ast_mutex_lock(&p->lock);




More information about the asterisk-commits mailing list