[asterisk-commits] mmichelson: branch group/CCSS r242412 - in /team/group/CCSS: apps/ channels/ ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 22 14:04:47 CST 2010


Author: mmichelson
Date: Fri Jan 22 14:04:42 2010
New Revision: 242412

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=242412
Log:
Add a new parameter to ast_cc_is_recall.

Adding the monitor type that we are looking for is helpful so that
there is no confusion when checking if a call to an outbound channel
is a recall and should have special handling.


Modified:
    team/group/CCSS/apps/app_dial.c
    team/group/CCSS/channels/chan_sip.c
    team/group/CCSS/include/asterisk/ccss.h
    team/group/CCSS/main/ccss.c

Modified: team/group/CCSS/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/apps/app_dial.c?view=diff&rev=242412&r1=242411&r2=242412
==============================================================================
--- team/group/CCSS/apps/app_dial.c (original)
+++ team/group/CCSS/apps/app_dial.c Fri Jan 22 14:04:42 2010
@@ -945,7 +945,7 @@
 		}
 	}
 
-	is_cc_recall = ast_cc_is_recall(in, &cc_recall_core_id);
+	is_cc_recall = ast_cc_is_recall(in, &cc_recall_core_id, NULL);
 
 #ifdef HAVE_EPOLL
 	for (epollo = outgoing; epollo; epollo = epollo->next)

Modified: team/group/CCSS/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/channels/chan_sip.c?view=diff&rev=242412&r1=242411&r2=242412
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Fri Jan 22 14:04:42 2010
@@ -6802,8 +6802,7 @@
 		return -1;
 	}
 
-	if (ast_get_cc_monitor_policy(ast_channel_get_cc_config_params(ast)) == AST_CC_MONITOR_NATIVE &&
-			ast_cc_is_recall(ast, &cc_core_id)) {
+	if (ast_cc_is_recall(ast, &cc_core_id, "SIP")) {
 		/* If this is a CC recall, then we have a particular
 		 * URI that we are supposed to send the INVITE to. We
 		 * get this information from the corresponding sip_monitor_instance

Modified: team/group/CCSS/include/asterisk/ccss.h
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/include/asterisk/ccss.h?view=diff&rev=242412&r1=242411&r2=242412
==============================================================================
--- team/group/CCSS/include/asterisk/ccss.h (original)
+++ team/group/CCSS/include/asterisk/ccss.h Fri Jan 22 14:04:42 2010
@@ -1397,10 +1397,12 @@
  * \param chan The channel to check
  * \param core_id[out] If this is a valid CC recall, the core_id of the failed call
  * will be placed in this output parameter
+ * \param monitor_type Clarify which type of monitor type we are looking for if this
+ * is happening on a called channel. For incoming channels, this parameter is not used.
  * \retval 0 Either this is not a recall or it is but this channel is not part of the recall
  * \retval non-zero This is a recall and the channel in question is directly involved.
  */
-int ast_cc_is_recall(struct ast_channel *chan, int *core_id);
+int ast_cc_is_recall(struct ast_channel *chan, int *core_id, const char * const monitor_type);
 
 /*!
  * \since 1.8

Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=242412&r1=242411&r2=242412
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Fri Jan 22 14:04:42 2010
@@ -2262,7 +2262,7 @@
 	 */
 	kill_duplicate_offers(caller);
 
-	ast_cc_is_recall(caller_chan, &recall_core_id);
+	ast_cc_is_recall(caller_chan, &recall_core_id, NULL);
 
 	cc_params = ast_channel_get_cc_config_params(caller_chan);
 	if (!cc_params) {
@@ -2862,7 +2862,7 @@
 	return 0;
 }
 
-int ast_cc_is_recall(struct ast_channel *chan, int *core_id)
+int ast_cc_is_recall(struct ast_channel *chan, int *core_id, const char * const monitor_type)
 {
 	struct ast_datastore *recall_datastore;
 	struct cc_recall_ds_data *recall_data;
@@ -2904,6 +2904,16 @@
 		return 1;
 	}
 
+	if (ast_strlen_zero(monitor_type)) {
+		/* If someone passed a NULL or empty monitor type, then it is clear
+		 * the channel they passed in was an incoming channel, and so searching
+		 * the list of dialed interfaces is not going to be helpful. Just return
+		 * false immediately.
+		 */
+		ast_channel_unlock(chan);
+		return 0;
+	}
+
 	interface_tree = cc_ref(recall_data->interface_tree, "Bump refcount for tree while we search for specific channel");
 	ast_channel_get_device_name(chan, device_name, sizeof(device_name));
 	ast_channel_unlock(chan);
@@ -2914,7 +2924,8 @@
 	 */
 	AST_LIST_LOCK(interface_tree);
 	AST_LIST_TRAVERSE(interface_tree, device_tree_item, next) {
-		if (!strcmp(device_tree_item->interface->name, device_name)) {
+		if (!strcmp(device_tree_item->interface->name, device_name) &&
+				!strcmp(device_tree_item->interface->monitor_type, monitor_type)) {
 			/* BOOM! Device is in the tree! We have a winner! */
 			*core_id = recall_data->core_id;
 			AST_LIST_UNLOCK(interface_tree);




More information about the asterisk-commits mailing list