[asterisk-commits] mmichelson: branch group/CCSS r224846 - in /team/group/CCSS: apps/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Oct 20 15:33:20 CDT 2009


Author: mmichelson
Date: Tue Oct 20 15:33:17 2009
New Revision: 224846

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=224846
Log:
Convert several places where ast_cc_request_state_change was used
into using the clearer API.


Modified:
    team/group/CCSS/apps/app_dial.c
    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=224846&r1=224845&r2=224846
==============================================================================
--- team/group/CCSS/apps/app_dial.c (original)
+++ team/group/CCSS/apps/app_dial.c Tue Oct 20 15:33:17 2009
@@ -1019,7 +1019,7 @@
 			 * 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!");
+				ast_cc_completed(cc_recall_core_id, "Call completed successfully!");
 				/* Setting this to -1 will make sure that no further frames cause superfluous
 				 * state changes.
 				 */

Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=224846&r1=224845&r2=224846
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Tue Oct 20 15:33:17 2009
@@ -721,7 +721,7 @@
 		 * a state change to CC_FAILED
 		 */
 		if (monitor->interface->monitor_class == AST_CC_ROOT_MONITOR) {
-			ast_cc_request_state_change(CC_FAILED, core_id, "All monitors failed to request CC");
+			ast_cc_failed(core_id, "All monitors failed to request CC");
 		}
 		return -1;
 	}
@@ -918,7 +918,7 @@
 	 * which means we need to request a change to CC_FAILED.
 	 */
 	if (AST_LIST_EMPTY(&parent_monitor->child_links)) {
-		ast_cc_request_state_change(CC_FAILED, core_id, "All available timers have expired");
+		ast_cc_failed(core_id, "All available timers have expired");
 	}
 	return 0;
 }
@@ -958,7 +958,7 @@
 	 * will that mean a missed opportunity?
 	 */
 	if (service == AST_CC_CCBS && gen_mon_pvt->current_state == AST_DEVICE_NOT_INUSE) {
-		ast_cc_request_state_change(CC_ACTIVE, core_id, "Formality. Device is already available but we have to go through the motions\n");
+		ast_cc_request_acknowledged(core_id, "Formality. Device is already available but we have to go through the motions\n");
 		return ast_cc_monitor_announce_availability(monitor);
 	}
 
@@ -974,7 +974,7 @@
 			AST_EVENT_IE_END))) {
 		return -1;
 	}
-	ast_cc_request_state_change(CC_ACTIVE, core_id, "Generic monitor subscribed to device state.\n");
+	ast_cc_request_acknowledged(core_id, "Generic monitor subscribed to device state.\n");
 	return 0;
 }
 
@@ -1771,7 +1771,7 @@
 	struct cc_generic_agent_pvt *agent_pvt = agent->private_data;
 	ast_log(LOG_NOTICE, "Queuing change request because offer timer has expired.\n");
 	agent_pvt->offer_timer_id = -1;
-	ast_cc_request_state_change(CC_FAILED, agent->core_id, "Generic agent offer timer expired");
+	ast_cc_failed(agent->core_id, "Generic agent offer timer expired");
 	return 0;
 }
 
@@ -1874,13 +1874,13 @@
 		/* Hmm, no channel. Sucks for you, bud.
 		 */
 		ast_log(LOG_NOTICE, "Failed to call back %s for reason %d\n", agent->interface, reason);
-		ast_cc_request_state_change(CC_FAILED, agent->core_id, "Failed to call back interface\n");
+		ast_cc_failed(agent->core_id, "Failed to call back interface\n");
 		return NULL;
 	}
 	if (!ast_strlen_zero(callback_macro)) {
 		ast_log(LOG_NOTICE, "There's a callback macro configured\n");
 		if (ast_app_run_macro(NULL, chan, callback_macro, NULL)) {
-			ast_cc_request_state_change(CC_FAILED, agent->core_id, "Callback macro failed. Maybe a hangup?");
+			ast_cc_failed(agent->core_id, "Callback macro failed. Maybe a hangup?");
 			ast_hangup(chan);
 			return NULL;
 		}
@@ -2254,7 +2254,7 @@
 			break;
 		}
 		if (core_instance->agent->callbacks->start_offer_timer(core_instance->agent)) {
-			ast_cc_request_state_change(CC_FAILED, core_instance->core_id, "Failed to start the offer timer\n");
+			ast_cc_failed(core_instance->core_id, "Failed to start the offer timer\n");
 			break;
 		}
 		ast_log(LOG_NOTICE, "Started the offer timer for the agent!\n");
@@ -2271,7 +2271,7 @@
 		}
 		if (!ast_cc_request_within_limits()) {
 			ast_log(LOG_WARNING, "Cannot request CC since there is no more room for requests\n");
-			ast_cc_request_state_change(CC_FAILED, core_instance->core_id, "Too many requests in the system");
+			ast_cc_failed(core_instance->core_id, "Too many requests in the system");
 		}
 		core_instance->current_state = args->state;
 		core_instance->agent->callbacks->stop_offer_timer(core_instance->agent);
@@ -2399,6 +2399,11 @@
 	return ast_cc_request_state_change(CC_ACTIVE, core_id, debug);
 }
 
+int ast_cc_monitor_announce_availability(struct ast_cc_monitor *monitor) {
+	return ast_taskprocessor_push(cc_core_taskprocessor, cc_devstate_change,
+			cc_ref(monitor, "Bump reference count until cc_devstate_change executes"));
+}
+
 int ast_cc_completed(int core_id, const char * const debug)
 {
 	return ast_cc_request_state_change(CC_COMPLETE, core_id, debug);
@@ -2440,11 +2445,11 @@
 
 	if (!ast_cc_request_within_limits()) {
 		ast_log(LOG_NOTICE, "CallCompletionRequest failed. Too many requests in the system\n");
-		ast_cc_request_state_change(CC_FAILED, core_instance->core_id, "Too many CC requests\n");
-		return -1;
-	}
-
-	res = ast_cc_request_state_change(CC_CALLER_REQUESTED, core_instance->core_id, "CallCompletionRequest called");
+		ast_cc_failed(core_instance->core_id, "Too many CC requests\n");
+		return -1;
+	}
+
+	res = ast_cc_accept_request(core_instance->core_id, "CallCompletionRequest called");
 	cc_unref(core_instance, "Done with CallCompletionRequest");
 	return res;
 }
@@ -2475,7 +2480,7 @@
 		cc_unref(core_instance, "Unref core instance found during CallCompletionCancel");
 		return -1;
 	}
-	res = ast_cc_request_state_change(CC_FAILED, core_instance->core_id, "Call completion request Cancelled");
+	res = ast_cc_failed(core_instance->core_id, "Call completion request Cancelled");
 	cc_unref(core_instance, "Unref core instance found during CallCompletionCancel");
 	return res;
 }
@@ -2494,11 +2499,6 @@
 	retval = monitor->num_requests;
 	cc_unref(monitor, "Unref from ao2_find");
 	return retval;
-}
-
-int ast_cc_monitor_announce_availability(struct ast_cc_monitor *monitor) {
-	return ast_taskprocessor_push(cc_core_taskprocessor, cc_devstate_change,
-			cc_ref(monitor, "Bump reference count until cc_devstate_change executes"));
 }
 
 struct cc_recall_ds_data {




More information about the asterisk-commits mailing list