[asterisk-commits] mmichelson: branch group/CCSS r219945 - in /team/group/CCSS: apps/ include/as...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Sep 23 16:09:45 CDT 2009


Author: mmichelson
Date: Wed Sep 23 16:09:41 2009
New Revision: 219945

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=219945
Log:
Add logic to app_dial to request state change upon
CC recall.

Tests well!


Modified:
    team/group/CCSS/apps/app_dial.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=219945&r1=219944&r2=219945
==============================================================================
--- team/group/CCSS/apps/app_dial.c (original)
+++ team/group/CCSS/apps/app_dial.c Wed Sep 23 16:09:41 2009
@@ -876,7 +876,7 @@
 	struct chanlist *outgoing, int *to, struct ast_flags64 *peerflags,
 	struct privacy_args *pa,
 	const struct cause_args *num_in, int *result, char *dtmf_progress,
-	const int ignore_cc)
+	const int ignore_cc, int cc_recall_core_id)
 {
 	struct cause_args num = *num_in;
 	int prestart = num.busy + num.congestion + num.nochan;
@@ -1008,6 +1008,22 @@
 				ast_clear_flag64(o, DIAL_STILLGOING);
 				handle_cause(in->hangupcause, &num);
 				continue;
+			}
+			/* We successfully read a frame from one of the outbound channels.
+			 * If this is a cc recall, then that means we have succeeded in the
+			 * recall process. It really doesn't matter what type of frame we received,
+			 * just that we received something.
+			 */
+			if (cc_recall_core_id != -1) {
+				ast_cc_request_state_change(CC_COMPLETE, cc_recall_core_id, "Call completed successfully!");
+				/* Setting this to -1 will make sure that no further frames cause superfluous
+				 * state changes.
+				 */
+				/* XXX While this certainly will quiet a single dial to multiple channels, a dial to a local
+				 * channel will still cause superfluous state changes to be queued potentially. It's not a
+				 * showstopper, but it does mean some wasted cycles.
+				 */
+				cc_recall_core_id = -1;
 			}
 			if (f->frametype == AST_FRAME_CONTROL) {
 				switch(f->subclass) {
@@ -2492,7 +2508,7 @@
 		}
 	}
 
-	peer = wait_for_answer(chan, outgoing, &to, peerflags, &pa, &num, &result, dtmf_progress, ignore_cc);
+	peer = wait_for_answer(chan, outgoing, &to, peerflags, &pa, &num, &result, dtmf_progress, ignore_cc, ast_cc_get_recall_core_id(chan));
 
 	/* The ast_channel_datastore_remove() function could fail here if the
 	 * datastore was moved to another channel during a masquerade. If this is

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=219945&r1=219944&r2=219945
==============================================================================
--- team/group/CCSS/include/asterisk/ccss.h (original)
+++ team/group/CCSS/include/asterisk/ccss.h Wed Sep 23 16:09:41 2009
@@ -814,6 +814,16 @@
 
 /*!
  * \since 1.6.4
+ * \brief Get the core id from the cc_recall datastore
+ *
+ * \param chan The channel the datastore may be on
+ * \retval -1 Datastore could not be found
+ * \retval non-negative core_id found on the datastore
+ */
+int ast_cc_get_recall_core_id(struct ast_channel *chan);
+
+/*!
+ * \since 1.6.4
  * \brief Set the CC_INTERFACES channel variable for a channel
  *
  * Implementors of protocol-specific CC agents should call this function after

Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=219945&r1=219944&r2=219945
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Wed Sep 23 16:09:41 2009
@@ -1822,6 +1822,24 @@
 	return 0;
 }
 
+int ast_cc_get_recall_core_id(struct ast_channel *chan)
+{
+	struct ast_datastore *recall_datastore;
+	struct cc_recall_ds_data *recall_data;
+	int core_id_return;
+
+	ast_channel_lock(chan);
+	if (!(recall_datastore = ast_channel_datastore_find(chan, &recall_ds_info, NULL))) {
+		ast_channel_unlock(chan);
+		return -1;
+	}
+
+	recall_data = recall_datastore->data;
+	core_id_return = recall_data->core_id;
+	ast_channel_unlock(chan);
+	return core_id_return;
+}
+
 int ast_set_cc_interfaces_chanvar(struct ast_channel *chan, const char * const extension)
 {
 	struct ast_datastore *recall_datastore;




More information about the asterisk-commits mailing list