[asterisk-commits] mmichelson: branch group/CCSS r244065 - in /team/group/CCSS: configs/ include...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Feb 1 10:30:13 CST 2010


Author: mmichelson
Date: Mon Feb  1 10:30:11 2010
New Revision: 244065

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=244065
Log:
Add a new configuration option, the cc_recall_timer.

See configs/ccss.conf.sample for an explanation of this timer.


Modified:
    team/group/CCSS/configs/ccss.conf.sample
    team/group/CCSS/include/asterisk/ccss.h
    team/group/CCSS/main/ccss.c

Modified: team/group/CCSS/configs/ccss.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/configs/ccss.conf.sample?view=diff&rev=244065&r1=244064&r2=244065
==============================================================================
--- team/group/CCSS/configs/ccss.conf.sample (original)
+++ team/group/CCSS/configs/ccss.conf.sample Mon Feb  1 10:30:11 2010
@@ -18,10 +18,11 @@
 ;---------------------------------------------------------------------
 ;                                Timers
 ;---------------------------------------------------------------------
-;There are three configurable timers for CC: the cc_offer_timer,
-;the ccbs_available_timer, and the ccnr_available_timer. All timers
-;are configured in seconds, and the values shown below are the
-;defaults.
+;There are three configurable timers for all types of CC: the 
+;cc_offer_timer, the ccbs_available_timer, and the ccnr_available_timer.
+;In addition, when using a generic agent, there is a fourth timer,
+;the cc_recall_timer. All timers are configured in seconds, and the
+;values shown below are the defaults.
 ;
 ;When a caller is offered CCBS or CCNR, the cc_offer_timer will
 ;be started. If the caller does not request CC before the
@@ -41,6 +42,13 @@
 ; ccbs_available_timer = 4800
 ; ccnr_available_timer = 7200
 ;
+; When using a generic agent, the original caller is called back
+; when one of the original called parties becomes available. The
+; cc_recall_timer tells Asterisk how long it should let the original
+; caller's phone ring before giving up. Please note that this parameter
+; only affects operation when using a generic agent.
+;
+;cc_recall_timer = 20
 ;---------------------------------------------------------------------
 ;                                Policies
 ;---------------------------------------------------------------------

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=244065&r1=244064&r2=244065
==============================================================================
--- team/group/CCSS/include/asterisk/ccss.h (original)
+++ team/group/CCSS/include/asterisk/ccss.h Mon Feb  1 10:30:11 2010
@@ -269,6 +269,23 @@
  * \retval void
  */
 void ast_set_ccnr_available_timer(struct ast_cc_config_params *config, unsigned int value);
+
+/*!
+ * \since 1.8
+ * \brief Get the cc_recall_timer
+ * \param config The configuration to retrieve the cc_recall_timer from
+ * \return The cc_recall_timer from this configuration
+ */
+unsigned int ast_get_cc_recall_timer(struct ast_cc_config_params *config);
+
+/*!
+ * \since 1.8
+ * \brief Set the cc_recall_timer
+ * \param config The configuration to set the cc_recall_timer on
+ * \param value The new cc_recall_timer we want to change to
+ * \retval void
+ */
+void ast_set_cc_recall_timer(struct ast_cc_config_params *config, unsigned int value);
 
 /*!
  * \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=244065&r1=244064&r2=244065
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Mon Feb  1 10:30:11 2010
@@ -380,6 +380,7 @@
 	unsigned int ccbs_available_timer;
 	unsigned int cc_max_agents;
 	unsigned int cc_max_monitors;
+	unsigned int cc_recall_timer;
 	char cc_callback_macro[AST_MAX_EXTENSION];
 	char cc_agent_dialstring[AST_MAX_EXTENSION];
 };
@@ -387,6 +388,7 @@
 static const unsigned int CC_OFFER_TIMER_DEFAULT = 20u;
 static const unsigned int CCNR_AVAILABLE_TIMER_DEFAULT = 7200u;
 static const unsigned int CCBS_AVAILABLE_TIMER_DEFAULT = 4800u;
+static const unsigned int CC_RECALL_TIMER_DEFAULT = 20u;
 static const unsigned int CC_MAX_AGENTS_DEFAULT = 5u;
 static const unsigned int CC_MAX_MONITORS_DEFAULT = 5u;
 static const unsigned int GLOBAL_CC_MAX_REQUESTS_DEFAULT = 20u;
@@ -411,6 +413,7 @@
 	params->cc_offer_timer = CC_OFFER_TIMER_DEFAULT;
 	params->ccnr_available_timer = CCNR_AVAILABLE_TIMER_DEFAULT;
 	params->ccbs_available_timer = CCBS_AVAILABLE_TIMER_DEFAULT;
+	params->cc_recall_timer = CC_RECALL_TIMER_DEFAULT;
 	params->cc_max_agents = CC_MAX_AGENTS_DEFAULT;
 	params->cc_max_monitors = CC_MAX_MONITORS_DEFAULT;
 	/* No need to set cc_callback_macro since calloc will 0 it out anyway */
@@ -516,6 +519,8 @@
 		snprintf(buf, buf_len, "%u", ast_get_cc_max_agents(params));
 	} else if (!strcasecmp(name, "cc_max_monitors")) {
 		snprintf(buf, buf_len, "%u", ast_get_cc_max_monitors(params));
+	} else if (!strcasecmp(name, "cc_recall_timer")) {
+		snprintf(buf, buf_len, "%u", ast_get_cc_recall_timer(params));
 	} else {
 		ast_log(LOG_WARNING, "%s is not a valid CC parameter. Ignoring.\n", name);
 		return -1;
@@ -553,6 +558,8 @@
 		ast_set_cc_max_agents(params, value_as_uint);
 	} else if (!strcasecmp(name, "cc_max_monitors")) {
 		ast_set_cc_max_monitors(params, value_as_uint);
+	} else if (!strcasecmp(name, "cc_recall_timer")) {
+		ast_set_cc_recall_timer(params, value_as_uint);
 	} else {
 		ast_log(LOG_WARNING, "%s is not a valid CC parameter. Ignoring.\n", name);
 		return -1;
@@ -571,7 +578,8 @@
 				!strcasecmp(name, "cc_max_agents") ||
 				!strcasecmp(name, "cc_max_monitors") ||
 				!strcasecmp(name, "cc_callback_macro") ||
-				!strcasecmp(name, "cc_agent_dialstring"));
+				!strcasecmp(name, "cc_agent_dialstring") ||
+				!strcasecmp(name, "cc_recall_timer"));
 }
 
 void ast_cc_copy_config_params(struct ast_cc_config_params *dest, const struct ast_cc_config_params *src)
@@ -641,6 +649,21 @@
 		return;
 	}
 	config->ccnr_available_timer = value;
+}
+
+unsigned int ast_get_cc_recall_timer(struct ast_cc_config_params *config)
+{
+	return config->cc_recall_timer;
+}
+
+void ast_set_cc_recall_timer(struct ast_cc_config_params *config, unsigned int value)
+{
+	/* 0 is an unreasonable value for any timer. Stick with the default */
+	if (value == 0) {
+		ast_log(LOG_WARNING, "0 is an invalid value for ccnr_available_timer. Retaining value as %u\n", config->cc_recall_timer);
+		return;
+	}
+	config->cc_recall_timer = value;
 }
 
 unsigned int ast_get_ccbs_available_timer(struct ast_cc_config_params *config)
@@ -2127,12 +2150,13 @@
 	char *context;
 	char *exten;
 	const char *callback_macro = ast_get_cc_callback_macro(agent->cc_params);
+	unsigned int recall_timer = ast_get_cc_recall_timer(agent->cc_params) * 1000;
 
 	tech = interface;
 	if ((target = strchr(interface, '/'))) {
 		*target++ = '\0';
 	}
-	if (!(chan = ast_request_and_dial(tech, AST_FORMAT_SLINEAR, NULL, target, 20000, &reason, generic_pvt->cid_num, generic_pvt->cid_name))) {
+	if (!(chan = ast_request_and_dial(tech, AST_FORMAT_SLINEAR, NULL, target, recall_timer, &reason, generic_pvt->cid_num, generic_pvt->cid_name))) {
 		/* Hmm, no channel. Sucks for you, bud.
 		 */
 		ast_log_dynamic_level(cc_logger_level, "Failed to call back %s for reason %d\n", agent->interface, reason);




More information about the asterisk-commits mailing list