[asterisk-commits] mmichelson: branch group/CCSS r222355 - in /team/group/CCSS: include/asterisk...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Oct 6 16:10:35 CDT 2009
Author: mmichelson
Date: Tue Oct 6 16:10:31 2009
New Revision: 222355
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=222355
Log:
Add flags to CC agents.
There was a check in the code which would specifically
see if the agent being used was generic. Well, while that
made sense, what makes more sense is to check whether a
specific flag is set instead. That way, other agent types
who might also be affected can also set that flag and things
will just work. It also makes the code more clear too.
There's still one other place where the check being used
is to see if the agent policy is set to generic, but I'm
leaving that one because at the time, the agent has not
yet been created.
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=222355&r1=222354&r2=222355
==============================================================================
--- team/group/CCSS/include/asterisk/ccss.h (original)
+++ team/group/CCSS/include/asterisk/ccss.h Tue Oct 6 16:10:31 2009
@@ -99,6 +99,20 @@
};
/*!
+ * \brief agent flags that can alter core behavior
+ */
+enum ast_cc_agent_flags {
+ /* Some agent types allow for a caller to
+ * request CC without reaching the CC_CALLER_OFFERED
+ * state. In other words, the caller can request
+ * CC while he is still on the phone from the failed
+ * call. The generic agent is an agent which allows
+ * for this behavior.
+ */
+ AST_CC_AGENT_SKIP_OFFER = (1 << 0),
+};
+
+/*!
* \since 1.6.4
* \brief The various possibilities for cc_monitor_policy values
*/
@@ -748,6 +762,15 @@
* creating the monitor structure.
*/
struct ast_cc_interface_tree *interface_tree;
+ /*!
+ * \flags for agent operation
+ *
+ * There are some attributes of certain agent types
+ * that can alter the behavior of certain CC functions.
+ * For a list of these flags, see the ast_cc_agent_flags
+ * enum
+ */
+ unsigned int flags;
/*! Data specific to agent implementation */
void *private_data;
/*! The name of the interface which this agent
Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=222355&r1=222354&r2=222355
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Tue Oct 6 16:10:31 2009
@@ -1184,6 +1184,7 @@
*/
kill_duplicate_offers(caller);
+ /* Generic agents can only have a single outstanding CC request per caller. */
if (ast_get_cc_agent_policy(ast_channel_get_cc_config_params(caller_chan)) == AST_CC_AGENT_GENERIC) {
unsigned long match_flags = MATCH_MONITOR;
if (ao2_t_callback_data(cc_core_instances, OBJ_NODATA, match_agent, caller, &match_flags, "Trying to find requests from this caller") != NULL) {
@@ -1245,6 +1246,7 @@
generic_pvt->offer_timer_id = -1;
agent->private_data = generic_pvt;
+ ast_set_flag(agent, AST_CC_AGENT_SKIP_OFFER);
return 0;
}
@@ -1750,7 +1752,7 @@
* in use is generic.
*/
if (!(core_instance->current_state == CC_CALLER_OFFERED ||
- (core_instance->current_state == CC_AVAILABLE && !strcmp(core_instance->agent->callbacks->type, "generic")))) {
+ (core_instance->current_state == CC_AVAILABLE && ast_test_flag(core_instance->agent, AST_CC_AGENT_SKIP_OFFER)))) {
ast_log(LOG_NOTICE, "Invalid state change request. Cannot go from %d to %d\n", core_instance->current_state, args->state);
}
core_instance->current_state = args->state;
More information about the asterisk-commits
mailing list