[svn-commits] mmichelson: branch group/CCSS r226684 - in /team/group/CCSS: include/asterisk...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun Nov 1 16:08:17 CST 2009


Author: mmichelson
Date: Sun Nov  1 16:08:13 2009
New Revision: 226684

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=226684
Log:
Fix a bug introduced when the core allocation
was changed to at the reception of the first CC control frame.

The bug was that the AST_FLAG_OFFER_CC flag was never set on
the inbound channel, meaning that the offer timer was never
started.

This has been corrected by adding a flag to the dialed_cc_interfaces
datastore which indicates if CC is offerable to the channel. The logic
works such that only the channel on which the datastore was originally
created will have this flag set true. Channels which inherit the datastore
will have the flag cleared.


Modified:
    team/group/CCSS/include/asterisk/channel.h
    team/group/CCSS/main/ccss.c
    team/group/CCSS/main/channel.c

Modified: team/group/CCSS/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/include/asterisk/channel.h?view=diff&rev=226684&r1=226683&r2=226684
==============================================================================
--- team/group/CCSS/include/asterisk/channel.h (original)
+++ team/group/CCSS/include/asterisk/channel.h Sun Nov  1 16:08:13 2009
@@ -810,10 +810,6 @@
 	 *  bridge terminates, this will allow the hangup in the pbx loop to be run instead.
 	 *  */
 	AST_FLAG_BRIDGE_HANGUP_DONT = (1 << 18),
-	/*! This flag indicates that upon hangup, CCBS or CCNR should be offered to
-	 * the caller.
-	 */
-	AST_FLAG_OFFER_CC = (1 << 19),
 };
 
 /*! \brief ast_bridge_config flags */

Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=226684&r1=226683&r2=226684
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Sun Nov  1 16:08:13 2009
@@ -1289,6 +1289,14 @@
 	 */
 	char core_created;
 	/*!
+	 * When it comes time to offer CC to the caller, we only want to offer
+	 * it to the original incoming channel. For nested Dials and outbound
+	 * channels, it is incorrect to attempt such a thing. This flag indicates
+	 * if the channel to which this datastore is attached may be legally
+	 * offered CC when the call is finished.
+	 */
+	char cc_is_offerable;
+	/*!
 	 * 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.
 	 * This needs to be preserved as the dialable name on an extension tree item
@@ -1341,6 +1349,7 @@
 	}
 	new_cc_interfaces->done = old_cc_interfaces->done;
 	new_cc_interfaces->dial_parent_id = old_cc_interfaces->dial_parent_id;
+	new_cc_interfaces->cc_is_offerable = 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;
@@ -1500,6 +1509,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;
 	ast_channel_lock(chan);
 	ast_channel_datastore_add(chan, dial_cc_datastore);
 	ast_channel_unlock(chan);
@@ -2594,13 +2604,24 @@
 {
 	int core_id;
 	int res = -1;
-
-	if ((core_id = ast_cc_get_current_core_id(caller_chan)) < 0) {
-		ast_log(LOG_WARNING, "This should not be possible. No core instance found, so can't offer CC to caller\n");
+	struct ast_datastore *datastore;
+	struct dialed_cc_interfaces *cc_interfaces;
+	char cc_is_offerable;
+	
+	ast_channel_lock(caller_chan);
+	if (!(datastore = ast_channel_datastore_find(caller_chan, &dialed_cc_interfaces_info, NULL))) {
+		ast_channel_unlock(caller_chan);
 		return res;
 	}
 
-	res = cc_request_state_change(CC_CALLER_OFFERED, core_id, "Offer CC to caller");
+	cc_interfaces = datastore->data;
+	cc_is_offerable = cc_interfaces->cc_is_offerable;
+	core_id = cc_interfaces->core_id;
+	ast_channel_unlock(caller_chan);
+
+	if (cc_is_offerable) {
+		res = cc_request_state_change(CC_CALLER_OFFERED, core_id, "Offer CC to caller");
+	}
 	return res;
 }
 

Modified: team/group/CCSS/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/channel.c?view=diff&rev=226684&r1=226683&r2=226684
==============================================================================
--- team/group/CCSS/main/channel.c (original)
+++ team/group/CCSS/main/channel.c Sun Nov  1 16:08:13 2009
@@ -2227,10 +2227,7 @@
 	}
 			
 	ast_channel_unlock(chan);
-	if (ast_test_flag(chan, AST_FLAG_OFFER_CC)) {
-		ast_log(LOG_ERROR, "HEY!!!!\n");
-		ast_cc_offer(chan);
-	}
+	ast_cc_offer(chan);
 	manager_event(EVENT_FLAG_CALL, "Hangup",
 			"Channel: %s\r\n"
 			"Uniqueid: %s\r\n"




More information about the svn-commits mailing list