[asterisk-commits] mmichelson: branch group/CCSS r224842 - in /team/group/CCSS: include/asterisk...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Oct 20 14:51:25 CDT 2009
Author: mmichelson
Date: Tue Oct 20 14:51:22 2009
New Revision: 224842
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=224842
Log:
Step one of abstracting out the state machine.
Modified:
team/group/CCSS/include/asterisk/ccss.h
team/group/CCSS/main/ccss.c
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=224842&r1=224841&r2=224842
==============================================================================
--- team/group/CCSS/include/asterisk/ccss.h (original)
+++ team/group/CCSS/include/asterisk/ccss.h Tue Oct 20 14:51:22 2009
@@ -944,6 +944,62 @@
/*!
* \since 1.6.4
+ * \brief Accept inbound CC request
+ *
+ * When a caller requests CC, this function should be called to let
+ * the core know that the request has been accepted.
+ *
+ * \param core_id core_id of the CC transaction
+ * \param debug optional string to print for debugging purposes
+ * \retval 0 Success
+ * \retval -1 Failure
+ */
+int ast_cc_accept_request(int core_id, const char * const debug);
+
+/*!
+ * \since 1.6.4
+ * \brief Indicate that an outbound entity has accepted our CC request
+ *
+ * When we receive confirmation that an outbound device has accepted the
+ * CC request we sent it, this function must be called.
+ *
+ * \param core_id core_id of the CC transaction
+ * \param debug optional string to print for debugging purposes
+ * \retval 0 Success
+ * \retval -1 Failure
+ */
+int ast_cc_request_acknowledged(int core_id, const char * const debug);
+
+/*!
+ * \since 1.6.4
+ * \brief Indicate recall has been acknowledged
+ *
+ * When we receive confirmation that an endpoint has responded to our
+ * CC recall, we call this function.
+ *
+ * \param core_id core_id of the CC transaction
+ * \param debug optional string to print for debugging purposes
+ * \retval 0 Success
+ * \retval -1 Failure
+ */
+int ast_cc_completed(int core_id, const char * const debug);
+
+/*!
+ * \since 1.6.4
+ * \brief Indicate failure has occurred
+ *
+ * If at any point a failure occurs, this is the function to call
+ * so that the core can initiate cleanup procedures.
+ *
+ * \param core_id core_id of the CC transaction
+ * \param debug optional string to print for debugging purposes
+ * \retval 0 Success
+ * \retval -1 Failure
+ */
+int ast_cc_failed(int core_id, const char * const debug);
+
+/*!
+ * \since 1.6.4
*
* XXX In retrospect, I think it's a bad idea to expose the internals of the state machine.
* Instead, what I want to do is to make individual API calls for each state change. The names
Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=224842&r1=224841&r2=224842
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Tue Oct 20 14:51:22 2009
@@ -1988,20 +1988,6 @@
return core_instance->core_id;
}
-int ast_cc_offer(struct ast_channel *caller_chan)
-{
- 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");
- return res;
- }
-
- res = ast_cc_request_state_change(CC_CALLER_OFFERED, core_id, "Offer CC to caller");
- return res;
-}
-
static void monitor_destroy(void *data)
{
struct ast_cc_monitor *monitor = data;
@@ -2389,6 +2375,40 @@
return ast_taskprocessor_push(cc_core_taskprocessor, cc_do_state_change, args);
}
+int ast_cc_offer(struct ast_channel *caller_chan)
+{
+ 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");
+ return res;
+ }
+
+ res = ast_cc_request_state_change(CC_CALLER_OFFERED, core_id, "Offer CC to caller");
+ return res;
+}
+
+int ast_cc_accept_request(int core_id, const char * const debug)
+{
+ return ast_cc_request_state_change(CC_CALLER_REQUESTED, core_id, debug);
+}
+
+int ast_cc_request_acknowledged(int core_id, const char * const debug)
+{
+ return ast_cc_request_state_change(CC_ACTIVE, core_id, debug);
+}
+
+int ast_cc_completed(int core_id, const char * const debug)
+{
+ return ast_cc_request_state_change(CC_COMPLETE, core_id, debug);
+}
+
+int ast_cc_failed(int core_id, const char * const debug)
+{
+ return ast_cc_request_state_change(CC_FAILED, core_id, debug);
+}
+
static char *ccreq_app = "CallCompletionRequest";
static int ccreq_exec(struct ast_channel *chan, const char *data)
More information about the asterisk-commits
mailing list