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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Dec 15 17:42:29 CST 2009


Author: mmichelson
Date: Tue Dec 15 17:42:27 2009
New Revision: 235228

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=235228
Log:
Add another oddball monitor API/agent callback pair. This time, "party_b_free"

This is something that really is only needed when Asterisk acts as the NT side
for an ISDN PTMP caller and as the TE side for an ISDN PTMP callee (i.e. the
ISDN network). Since this requires receiving a message and passing it through
to the other side, it is implemented as a core API and agent callback. Plus, you
never know when a future supported protocol might need something similar.


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

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=235228&r1=235227&r2=235228
==============================================================================
--- team/group/CCSS/include/asterisk/ccss.h (original)
+++ team/group/CCSS/include/asterisk/ccss.h Tue Dec 15 17:42:27 2009
@@ -846,6 +846,20 @@
 	 */
 	int (*stop_ringing)(struct ast_cc_agent *agent);
 	/*!
+	 * \brief Let the caller know that the callee has become free
+	 * but that a recall is not yet possible.
+	 *
+	 * This is something that really only affects a scenario where
+	 * a phone places a call over ISDN PTMP to Asterisk, who then
+	 * connects over PTMP again to the ISDN network. For most agent
+	 * types, there is no need to implement this callback at all
+	 * because they don't really need to actually do anything in
+	 * this situation. If you're having trouble understanding what
+	 * the purpose of this callback is, then you can be safe simply
+	 * not implementing it.
+	 */
+	int (*party_b_free)(struct ast_cc_agent *agent);
+	/*!
 	 * \brief Begin monitoring a busy device
 	 *
 	 * The core will call this callback if the callee becomes
@@ -1053,6 +1067,8 @@
 /* END STATUS REQUEST/RESPONSE API */
 
 int ast_cc_monitor_stop_ringing(int core_id);
+
+int ast_cc_monitor_party_b_free(int core_id);
 
 /* BEGIN API FOR USE WITH/BY MONITORS */
 

Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=235228&r1=235227&r2=235228
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Tue Dec 15 17:42:27 2009
@@ -1980,6 +1980,7 @@
 	ast_softhangup(recall_chan, AST_SOFTHANGUP_EXPLICIT);
 	return 0;
 }
+
 static void generic_agent_devstate_cb(const struct ast_event *event, void *userdata)
 {
 	struct ast_cc_agent *agent = userdata;
@@ -3128,7 +3129,7 @@
 	 * whatever reason he needs to be called back again. The proper state to be in to
 	 * detect such a circumstance is the CC_ACTIVE state.
 	 */
-	cc_request_state_change(CC_ACTIVE, core_id, "Agent asked to stop ringing. Be prepared to be recalled again.");
+	cc_request_state_change(CC_ACTIVE, core_instance->core_id, "Agent asked to stop ringing. Be prepared to be recalled again.");
 	cc_unref(core_instance, "Stop ringing finished. Unref core_instance");
 	return res;
 }
@@ -3142,6 +3143,30 @@
 	}
 
 	return ast_taskprocessor_push(cc_core_taskprocessor, cc_stop_ringing,
+			cc_ref(core_instance, "Ref core instance for stop ringing callback"));
+}
+
+static int cc_party_b_free(void *data)
+{
+	struct cc_core_instance *core_instance = data;
+	int res = 0;
+
+	if (core_instance->agent->callbacks->stop_ringing) {
+		res = core_instance->agent->callbacks->stop_ringing(core_instance->agent);
+	}
+	cc_unref(core_instance, "Stop ringing finished. Unref core_instance");
+	return res;
+}
+
+int ast_cc_monitor_party_b_free(int core_id)
+{
+	struct cc_core_instance *core_instance = find_cc_core_instance(core_id);
+
+	if (!core_instance) {
+		return -1;
+	}
+
+	return ast_taskprocessor_push(cc_core_taskprocessor, cc_party_b_free,
 			cc_ref(core_instance, "Ref core instance for stop ringing callback"));
 }
 




More information about the asterisk-commits mailing list