[asterisk-commits] mmichelson: branch group/CCSS r226526 - in /team/group/CCSS: include/asterisk...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Oct 29 11:20:39 CDT 2009
Author: mmichelson
Date: Thu Oct 29 11:20:35 2009
New Revision: 226526
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=226526
Log:
Add an offer_cc callback for ast_cc_agents.
With ISDN, the calling channel driver needs to be made
aware of the availability of CC as well as the interfaces
that may accept CC prior to sending back the ALERTING
message in the case of CCNR or prior to sending back the
DISCONNECT in the case of CCBS.
Prior to the addition of this callback, the calling channel
driver was not made aware of the availability of CC until
after all information from each callee had been collected.
The tricky part with this change is that the agent itself
is not allocated until a core instance has been allocated.
Agent creation time will need to occur earlier, perhaps when
the first AST_CONTROL_CC frame is read during a call. I'll
probably simplify things and create the core instance there
as well.
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=226526&r1=226525&r2=226526
==============================================================================
--- team/group/CCSS/include/asterisk/ccss.h (original)
+++ team/group/CCSS/include/asterisk/ccss.h Thu Oct 29 11:20:35 2009
@@ -777,6 +777,21 @@
*/
int (*init)(struct ast_cc_agent *agent, struct ast_channel *chan);
/*!
+ * \brief Offer CC to caller
+ *
+ * This is called separately as each callee announces
+ * his ability to accept CC. The agent's behavior will
+ * likely vary widely between implementations. For instance,
+ * it may be necessary to send out a specific message to the
+ * caller for each time this function is called, or it may
+ * be necessary to send a message only the first time this
+ * callback is called. Still, another strategy may be to set
+ * a flag or flags when this function is called so that
+ * subsequent ringing or hangup messages will have the
+ * necessary information embedded within.
+ */
+ int (*offer_cc)(struct ast_cc_agent *agent, const char * const callee_interface);
+ /*!
* \brief Start the offer timer
*
* The core will call this when the
@@ -898,6 +913,11 @@
* This function is called from ast_hangup if the caller is
* eligible to be offered call completion service.
*
+ * XXX Since there is now an offer_cc callback for agents
+ * and this actually does not call that callback, the
+ * name of this function is quite confusing and should
+ * change.
+ *
* \param caller_chan The calling channel
* \retval -1 Error
* \retval 0 Success
Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=226526&r1=226525&r2=226526
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Thu Oct 29 11:20:35 2009
@@ -1750,6 +1750,7 @@
static void check_callback_sanity(const struct ast_cc_agent_callbacks *callbacks)
{
ast_assert(callbacks->init != NULL);
+ ast_assert(callbacks->offer_cc != NULL);
ast_assert(callbacks->start_offer_timer != NULL);
ast_assert(callbacks->stop_offer_timer != NULL);
ast_assert(callbacks->ack != NULL);
@@ -1802,6 +1803,7 @@
/* Generic agent callbacks */
static int cc_generic_agent_init(struct ast_cc_agent *agent, struct ast_channel *chan);
+static int cc_generic_agent_offer_cc(struct ast_cc_agent *agent, const char * const callee_interface);
static int cc_generic_agent_start_offer_timer(struct ast_cc_agent *agent);
static int cc_generic_agent_stop_offer_timer(struct ast_cc_agent *agent);
static void cc_generic_agent_ack(struct ast_cc_agent *agent);
@@ -1814,6 +1816,7 @@
static struct ast_cc_agent_callbacks generic_agent_callbacks = {
.type = "generic",
.init = cc_generic_agent_init,
+ .offer_cc = cc_generic_agent_offer_cc,
.start_offer_timer = cc_generic_agent_start_offer_timer,
.stop_offer_timer = cc_generic_agent_stop_offer_timer,
.ack = cc_generic_agent_ack,
@@ -1851,6 +1854,15 @@
generic_pvt->offer_timer_id = -1;
agent->private_data = generic_pvt;
ast_set_flag(agent, AST_CC_AGENT_SKIP_OFFER);
+ return 0;
+}
+
+static int cc_generic_agent_offer_cc(struct ast_cc_agent *agent, const char * const callee_interface)
+{
+ /* The generic agent doesn't care about when a specific callee is capable of accepting
+ * CC. The core maintains the list of interfaces called, and the caller doesn't need to
+ * have any messages sent to him. Just return.
+ */
return 0;
}
More information about the asterisk-commits
mailing list