[asterisk-commits] mmichelson: branch group/CCSS r227461 - /team/group/CCSS/main/ccss.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Nov 3 16:04:17 CST 2009


Author: mmichelson
Date: Tue Nov  3 16:04:13 2009
New Revision: 227461

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=227461
Log:
Fix a bug that affected calls to local channels.

One change that was made was to allocate a cc_core_instance
and an ast_cc_agent when we read the first AST_CONTROL_CC frame
we receive. The problem is that if a call went through a local
channel, then the structures would be allocated on the local channel
instead of the original caller.

To fix the problem, I changed the is_cc_offerable field  of the
cc_dialed_interfaces structure to be is_original_caller instead, since
that was what it was used for anyway. Then, I use this field's value
to determine if the inbound channel to Dial is the original caller.
If it is not, then the assumption is made that the call is from a local
channel instead, and so we indicate the condition to the local channel.

chan_local is cool enough to automatically queue the frame over to the
other side for us, so it all works out in the end and everyone's happy.
God bless America.


Modified:
    team/group/CCSS/main/ccss.c

Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=227461&r1=227460&r2=227461
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Tue Nov  3 16:04:13 2009
@@ -1305,7 +1305,7 @@
 	 * if the channel to which this datastore is attached may be legally
 	 * offered CC when the call is finished.
 	 */
-	char cc_is_offerable;
+	char is_original_caller;
 	/*!
 	 * When nested dials occur (i.e. dialing local channels), the invocation
 	 * of the Local channel may have modifiers like /n or /b on the channel name.
@@ -1359,7 +1359,7 @@
 	}
 	new_cc_interfaces->ignore = old_cc_interfaces->ignore;
 	new_cc_interfaces->dial_parent_id = old_cc_interfaces->dial_parent_id;
-	new_cc_interfaces->cc_is_offerable = 0;
+	new_cc_interfaces->is_original_caller = 0;
 	ao2_t_ref(old_cc_interfaces->interface_tree, +1, "New ref due to duplication of interface tree");
 	new_cc_interfaces->interface_tree = old_cc_interfaces->interface_tree;
 	return new_cc_interfaces;
@@ -1497,7 +1497,7 @@
 	dial_cc_datastore->inheritance = DATASTORE_INHERIT_FOREVER;
 	interfaces->dial_parent_id = tree_item->id;
 	interfaces->core_id = ast_atomic_fetchadd_int(&core_id_counter, +1);
-	interfaces->cc_is_offerable = 1;
+	interfaces->is_original_caller = 1;
 	ast_channel_lock(chan);
 	ast_channel_datastore_add(chan, dial_cc_datastore);
 	ast_channel_unlock(chan);
@@ -1603,6 +1603,17 @@
 
 	if (cc_interfaces->ignore) {
 		ast_channel_unlock(inbound);
+		return;
+	}
+
+	if (!cc_interfaces->is_original_caller) {
+		/* If the is_original_caller is not set on the *inbound* channel, then
+		 * it must be a local channel. As such, we do not want to create a core instance
+		 * or an agent for the local channel. Instead, we want to pass this along to the
+		 * other side of the local channel so that the original caller can benefit.
+		 */
+		ast_channel_unlock(inbound);
+		ast_indicate_data(inbound, AST_CONTROL_CC, frame_data, sizeof(*frame_data));
 		return;
 	}
 
@@ -2824,7 +2835,7 @@
 	}
 
 	cc_interfaces = datastore->data;
-	cc_is_offerable = cc_interfaces->cc_is_offerable;
+	cc_is_offerable = cc_interfaces->is_original_caller;
 	core_id = cc_interfaces->core_id;
 	ast_channel_unlock(caller_chan);
 




More information about the asterisk-commits mailing list