[svn-commits] mmichelson: branch group/CCSS r214773 - /team/group/CCSS/main/ccss.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Aug 28 16:04:01 CDT 2009


Author: mmichelson
Date: Fri Aug 28 16:03:58 2009
New Revision: 214773

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=214773
Log:
Unstub CallCompletionRequest application


Modified:
    team/group/CCSS/main/ccss.c

Modified: team/group/CCSS/main/ccss.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=214773&r1=214772&r2=214773
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Fri Aug 28 16:03:58 2009
@@ -518,8 +518,6 @@
 	 * This is why we pass CMP_STOP in addition to CMP_MATCH.
 	 */
 	if (!strcmp(pending_offer->caller, caller)) {
-		/* XXX Remember to remove this notice if I use this callback for other purposes */
-		ast_log(LOG_NOTICE, "Killing duplicate pending offer for caller '%s'\n", caller);
 		return CMP_MATCH | CMP_STOP;
 	}
 	return 0;
@@ -886,23 +884,35 @@
 
 static int ccreq_exec(struct ast_channel *chan, const char *data)
 {
-	/* Let's map this shizzle out.
-	 *
-	 * First, let's be sure that the channel is configured to
-	 * use a generic agent, because otherwise, calling this
-	 * application is invalid as all git out.
-	 *
-	 * Then, we neec to find the pending offer which corresponds to
-	 * this device's previous failed attempt.
-	 *
-	 * Once we have that, we can then request a state change to
-	 * the appropriate core instance. Then it's up to the core to
-	 * change states, change the pending offer into a monitor, and
-	 * destroy the pending offer.
-	 */
-	
-	/* STUB */
-	return 0;
+	struct cc_pending_offer *pending_offer;
+	struct cc_core_instance *core_instance;
+	struct cc_core_instance finder;
+	char interface[AST_CHANNEL_NAME];
+	char *dash;
+
+	ast_copy_string(interface, chan->name, sizeof(interface));
+	if ((dash = strrchr(interface, '-'))) {
+		*dash = '\0';
+	}
+
+	if (!(pending_offer = ao2_callback(pending_cc_offers, 0, match_caller, interface))) {
+		ast_log(LOG_NOTICE, "Couldn't find a pending offer for interface %s\n", interface);
+		return -1;
+	}
+
+	finder.core_id = pending_offer->core_id;
+
+	if (!(core_instance = ao2_find(cc_core_instances, &finder, OBJ_POINTER))) {
+		ast_log(LOG_NOTICE, "Couldn't find a core instance with core_id %d\n", pending_offer->core_id);
+		return -1;
+	}
+
+	if (strcmp(core_instance->agent->callbacks->type, "generic")) {
+		ast_log(LOG_NOTICE, "CallCompletionRequest is only for generic agent types.\n");
+		return -1;
+	}
+
+	return ast_cc_request_state_change(CC_CALLER_REQUESTED, core_instance->core_id, "CallCompletionRequest called");
 }
 
 int ast_cc_init(void)




More information about the svn-commits mailing list