[asterisk-commits] mmichelson: branch group/CCSS r231736 - in /team/group/CCSS: channels/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Nov 30 17:11:36 CST 2009


Author: mmichelson
Date: Mon Nov 30 17:11:34 2009
New Revision: 231736

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=231736
Log:
Fill in the CC ESC initial handler and fix a compilation error in ccss.c


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

Modified: team/group/CCSS/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/channels/chan_sip.c?view=diff&rev=231736&r1=231735&r2=231736
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Mon Nov 30 17:11:34 2009
@@ -23133,16 +23133,29 @@
 
 static int cc_esc_publish_initial_handler(struct sip_pvt *pvt, struct sip_request *req, struct event_state_compositor *esc, struct sip_esc_entry *esc_entry)
 {
-	/*XXX STUB
-	 * An initial CC PUBLISH should be state "closed" but it is worth
-	 * checking the body of the request anyway just to be safe. Assuming
-	 * that the state is "closed" the appropriate action to take is to
-	 * call ast_cc_caller_busy. The CC core ID can be retrieved from the
-	 * event_specific_data of the esc_entry.
-	 *
-	 * If the initial state is "open" then we'll just store the state
-	 * and not take any specific action with regards to the CC core.
+	const char *uri = REQ_OFFSET_TO_STR(req, rlPart2);
+	struct ast_cc_agent *agent = find_sip_cc_agent_by_uri(uri);
+	struct sip_cc_agent_pvt *agent_pvt;
+
+	if (!agent) {
+		ast_log(LOG_WARNING, "Could not find agent using uri '%s'\n", uri);
+		transmit_response(pvt, "412 Conditional Request Failed", req);
+		return -1;
+	}
+
+	agent_pvt = agent->private_data;
+
+	/* XXX Add code here to get the body just in case some goofball has decided
+	 * to send an initial CC PUBLISH with state "open"
 	 */
+
+	agent_pvt->is_available = 0;
+	/* It's possible to get a PUBLISH before we have sent a NOTIFY that a callee is
+	 * available. If that is the case, this call to ast_cc_agent_caller_busy will not
+	 * have any effect. We handle that case properly, though, in the SIP agent's recall
+	 * callback.
+	 */
+	ast_cc_agent_caller_busy(agent->core_id, "Received PUBLISH stating SIP caller is busy");
 	return 0;
 }
 

Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=231736&r1=231735&r2=231736
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Mon Nov 30 17:11:34 2009
@@ -244,7 +244,7 @@
 }
 
 struct cc_callback_helper {
-	ao2_callback_fn function;
+	ao2_callback_fn *function;
 	void *args;
 	const char *type;
 };
@@ -261,7 +261,7 @@
 	return helper->function(core_instance->agent, helper->args, flags);
 }
 
-struct ast_cc_agent *ast_cc_agent_callback(int flags, ao2_callback_fn function, void *args, const char * const type)
+struct ast_cc_agent *ast_cc_agent_callback(int flags, ao2_callback_fn *function, void *args, const char * const type)
 {
 	struct cc_callback_helper helper = {.function = function, .args = args, .type = type};
 	return ao2_callback(cc_core_instances, flags, cc_agent_callback_helper, &helper);




More information about the asterisk-commits mailing list