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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Dec 15 16:46:43 CST 2009


Author: mmichelson
Date: Tue Dec 15 16:46:42 2009
New Revision: 235218

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=235218
Log:
Implement a new agent callback, stop_ringing.

The comment above the callback in ccss.h explains its purpose
and use pretty well. It's basically one of those odd edge cases
that only will be needed when Asterisk is used as the TE side
of an ISDN PTMP call, and likely won't even be needed then. However,
the possibility exists and so it is important that we provide the
necessary means to do what needs to be done.


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=235218&r1=235217&r2=235218
==============================================================================
--- team/group/CCSS/include/asterisk/ccss.h (original)
+++ team/group/CCSS/include/asterisk/ccss.h Tue Dec 15 16:46:42 2009
@@ -830,6 +830,22 @@
 	 */
 	int (*status_request)(struct ast_cc_agent *agent);
 	/*!
+	 * \brief Request for an agent's phone to stop ringing
+	 *
+	 * The usefulness of this is quite limited. The only specific
+	 * known case for this is if Asterisk requests CC over an ISDN
+	 * PTMP link as the TE side. If other phones are in the same
+	 * recall group as the Asterisk server, and one of those phones
+	 * picks up the recall notice, then Asterisk will receive a
+	 * "stop ringing" notification from the NT side of the PTMP
+	 * link. This indication needs to be passed to the phone
+	 * on the other side of the Asterisk server which originally
+	 * placed the call so that it will stop ringing. Since the
+	 * phone may be of any type, it is necessary to have a callback
+	 * that the core can know about.
+	 */
+	int (*stop_ringing)(struct ast_cc_agent *agent);
+	/*!
 	 * \brief Begin monitoring a busy device
 	 *
 	 * The core will call this callback if the callee becomes

Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=235218&r1=235217&r2=235218
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Tue Dec 15 16:46:42 2009
@@ -1858,6 +1858,7 @@
 static int cc_generic_agent_stop_offer_timer(struct ast_cc_agent *agent);
 static void cc_generic_agent_ack(struct ast_cc_agent *agent);
 static int cc_generic_agent_status_request(struct ast_cc_agent *agent);
+static int cc_generic_agent_stop_ringing(struct ast_cc_agent *agent);
 static int cc_generic_agent_start_monitoring(struct ast_cc_agent *agent);
 static int cc_generic_agent_recall(struct ast_cc_agent *agent);
 static void cc_generic_agent_destructor(struct ast_cc_agent *agent);
@@ -1870,6 +1871,7 @@
 	.stop_offer_timer = cc_generic_agent_stop_offer_timer,
 	.ack = cc_generic_agent_ack,
 	.status_request = cc_generic_agent_status_request,
+	.stop_ringing = cc_generic_agent_stop_ringing,
 	.start_monitoring = cc_generic_agent_start_monitoring,
 	.callee_available = cc_generic_agent_recall,
 	.destructor = cc_generic_agent_destructor,
@@ -1967,6 +1969,17 @@
 	return 0;
 }
 
+static int cc_generic_agent_stop_ringing(struct ast_cc_agent *agent)
+{
+	struct ast_channel *recall_chan = ast_channel_get_by_name_prefix(agent->interface, strlen(agent->interface));
+
+	if (!recall_chan) {
+		return 0;
+	}
+
+	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;




More information about the asterisk-commits mailing list