[svn-commits] mmichelson: branch group/CCSS r214522 - in /team/group/CCSS: include/asterisk...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Aug 27 16:53:31 CDT 2009


Author: mmichelson
Date: Thu Aug 27 16:53:28 2009
New Revision: 214522

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=214522
Log:
Add interface name to ast_cc_agent and fix compilation errors.


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

Modified: team/group/CCSS/include/asterisk/ccss.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/include/asterisk/ccss.h?view=diff&rev=214522&r1=214521&r2=214522
==============================================================================
--- team/group/CCSS/include/asterisk/ccss.h (original)
+++ team/group/CCSS/include/asterisk/ccss.h Thu Aug 27 16:53:28 2009
@@ -565,6 +565,10 @@
 	struct ast_cc_config_params *cc_params;
 	/*! Data specific to agent implementation */
 	void *private_data;
+	/*! The name of the interface which this agent
+	 * represents/communicates with
+	 */
+	char interface[1];
 };
 
 struct ast_cc_agent_callbacks {

Modified: team/group/CCSS/main/ccss.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=214522&r1=214521&r2=214522
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Thu Aug 27 16:53:28 2009
@@ -534,11 +534,11 @@
 }
 
 static struct ast_cc_agent *cc_agent_init(struct ast_channel *caller_chan, 
-		const int core_id) 
+		const char * const caller_name, const int core_id) 
 {
 	struct ast_cc_agent *agent;
 
-	if (!(agent = ast_calloc(1, sizeof(*agent)))) {
+	if (!(agent = ast_calloc(1, sizeof(*agent) + strlen(caller_name)))) {
 		return NULL;
 	}
 
@@ -553,6 +553,7 @@
 		ast_free(agent);
 		return NULL;
 	}
+	strcpy(agent->interface, caller_name);
 	ast_cc_copy_config_params(agent->cc_params, ast_channel_get_cc_config_params(caller_chan));
 	if (agent->callbacks->init(agent, caller_chan)) {
 		ast_cc_config_params_destroy(agent->cc_params);
@@ -611,15 +612,13 @@
 	}
 
 	core_instance->core_id = pending_offer->core_id;
-	if (!(core_instance->agent = cc_agent_init(caller_chan, core_instance->core_id))) {
+	if (!(core_instance->agent = cc_agent_init(caller_chan, caller, core_instance->core_id))) {
 		ao2_ref(pending_offer, -1);
 		ao2_ref(core_instance, -1);
 		return -1;
 	}
 
 	ao2_link(cc_core_instances, core_instance);
-
-	/* Finally, start the state machine! */
 
 	return 0;
 }
@@ -715,8 +714,8 @@
 		ast_log(LOG_WARNING, "Someone requested to change to CC_AVAILABLE? Ignoring.\n");
 		break;
 	case CC_CALLER_OFFERED:
-		if (core_instance->state != CC_AVAILABLE) {
-			ast_log(LOG_NOTICE, "Invalid state change request. Cannot go from %d to %d\n", core_instance->state, args->state);
+		if (core_instance->current_state != CC_AVAILABLE) {
+			ast_log(LOG_NOTICE, "Invalid state change request. Cannot go from %d to %d\n", core_instance->current_state, args->state);
 			break;
 		}
 
@@ -735,40 +734,40 @@
 		 * 2. Caller became available, call agent's stop_monitoring callback and
 		 *    call monitor's unsuspend callback.
 		 */
-		if (core_instance->state == CC_CALLER_REQUESTED) {
+		if (core_instance->current_state == CC_CALLER_REQUESTED) {
 			/* Do 1 */
-		} else if (core_instance->state == CC_CALLER_BUSY) {
+		} else if (core_instance->current_state == CC_CALLER_BUSY) {
 			/* Do 2 */
 		} else {
-			ast_log(LOG_NOTICE, "Invalid state change request. Cannot go from %d to %d\n", core_instance->state, args->state);
+			ast_log(LOG_NOTICE, "Invalid state change request. Cannot go from %d to %d\n", core_instance->current_state, args->state);
 		}
 		break;
 	case CC_CALLEE_READY:
 		/* Callee has become available, call agent's status request callback
 		 */
-		if (core_instance->state != CC_ACTIVE) {
-			ast_log(LOG_NOTICE, "Invalid state change request. Cannot go from %d to %d\n", core_instance->state, args->state);
+		if (core_instance->current_state != CC_ACTIVE) {
+			ast_log(LOG_NOTICE, "Invalid state change request. Cannot go from %d to %d\n", core_instance->current_state, args->state);
 		}
 	case CC_CALLER_BUSY:
 		/* Callee was available, but caller was busy, call agent's begin_monitoring callback
 		 * and call monitor's suspend callback.
 		 */
-		if (core_instance->state != CC_CALLEE_READY) {
-			ast_log(LOG_NOTICE, "Invalid state change request. Cannot go from %d to %d\n", core_instance->state, args->state);
+		if (core_instance->current_state != CC_CALLEE_READY) {
+			ast_log(LOG_NOTICE, "Invalid state change request. Cannot go from %d to %d\n", core_instance->current_state, args->state);
 		}
 		break;
 	case CC_RECALLING:
 		/* Both caller and callee are available, call agent's recall callback
 		 */
-		if (core_instance->state != CC_CALLEE_READY) {
-			ast_log(LOG_NOTICE, "Invalid state change request. Cannot go from %d to %d\n", core_instance->state, args->state);
+		if (core_instance->current_state != CC_CALLEE_READY) {
+			ast_log(LOG_NOTICE, "Invalid state change request. Cannot go from %d to %d\n", core_instance->current_state, args->state);
 		}
 		break;
 	case CC_COMPLETE:
 		/* Recall has made progress, call agent and monitor destructor functions
 		 */
-		if (core_instance->state != CC_RECALLING) {
-			ast_log(LOG_NOTICE, "Invalid state change request. Cannot go from %d to %d\n", core_instance->state, args->state);
+		if (core_instance->current_state != CC_RECALLING) {
+			ast_log(LOG_NOTICE, "Invalid state change request. Cannot go from %d to %d\n", core_instance->current_state, args->state);
 		}
 		break;
 	case CC_FAILED:




More information about the svn-commits mailing list