[svn-commits] mmichelson: branch group/CCSS r238538 - in /team/group/CCSS: channels/ includ...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jan 7 15:32:44 CST 2010


Author: mmichelson
Date: Thu Jan  7 15:32:39 2010
New Revision: 238538

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=238538
Log:
Remove the offer_cc callback from CC agents.

After discussing things with Richard, we came to the conclusion
that this callback just isn't really necessary. and that the .init
callback works just as well for doing what needs to be done in the
offer_cc callback.


Modified:
    team/group/CCSS/channels/chan_sip.c
    team/group/CCSS/include/asterisk/ccss.h
    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=238538&r1=238537&r2=238538
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Thu Jan  7 15:32:39 2010
@@ -3352,7 +3352,6 @@
 static struct ast_channel_tech sip_tech_info;
 
 static int sip_cc_agent_init(struct ast_cc_agent *agent, struct ast_channel *chan);
-static int sip_cc_agent_offer_cc(struct ast_cc_agent *agent, const char * const callee_interface);
 static int sip_cc_agent_start_offer_timer(struct ast_cc_agent *agent);
 static int sip_cc_agent_stop_offer_timer(struct ast_cc_agent *agent);
 static void sip_cc_agent_ack(struct ast_cc_agent *agent);
@@ -3364,7 +3363,6 @@
 static struct ast_cc_agent_callbacks sip_cc_agent_callbacks = {
 	.type = "SIP",
 	.init = sip_cc_agent_init,
-	.offer_cc = sip_cc_agent_offer_cc,
 	.start_offer_timer = sip_cc_agent_start_offer_timer,
 	.stop_offer_timer = sip_cc_agent_stop_offer_timer,
 	.ack = sip_cc_agent_ack,
@@ -3459,23 +3457,11 @@
 
 	agent_pvt->original_call = dialog_ref(call_pvt, "Get reference to original call dialog");
 	agent->private_data = agent_pvt;
-	return 0;
-}
-
-static int sip_cc_agent_offer_cc(struct ast_cc_agent *agent, const char * const callee_interface)
-{
-	/* SIP agents don't care about the callee interface. However, it is convenient to be able
-	 * to mark the original call as being able to offer CC, so we'll set a flag here. Further
-	 * responses sent to the caller will then have CC offers.
-	 */
-	struct sip_cc_agent_pvt *agent_pvt = agent->private_data;
-
 	sip_pvt_lock(agent_pvt->original_call);
 	ast_set_flag(&agent_pvt->original_call->flags[0], SIP_OFFER_CC);
 	sip_pvt_unlock(agent_pvt->original_call);
 	return 0;
 }
-
 
 static int sip_offer_timer_expire(const void *data)
 {
@@ -3613,8 +3599,10 @@
 {
 	struct sip_monitor_instance *monitor_instance = data;
 	if (monitor_instance->subscription_pvt) {
+		sip_pvt_lock(monitor_instance->subscription_pvt);
 		monitor_instance->subscription_pvt->expiry = 0;
 		transmit_invite(monitor_instance->subscription_pvt, SIP_SUBSCRIBE, FALSE, 0, monitor_instance->subscribe_uri);
+		sip_pvt_unlock(monitor_instance->subscription_pvt);
 		dialog_unref(monitor_instance->subscription_pvt, "Unref monitor instance ref of subscription pvt");
 	}
 	if (monitor_instance->suspension_entry) {
@@ -3706,11 +3694,13 @@
 	when = service == AST_CC_CCBS ? ast_get_ccbs_available_timer(monitor->interface->config_params) :
 		ast_get_ccnr_available_timer(monitor->interface->config_params);
 
+	sip_pvt_lock(monitor_instance->subscription_pvt);
 	create_addr(monitor_instance->subscription_pvt, monitor_instance->peername, 0, 1);
 	monitor_instance->subscription_pvt->subscribed = CALL_COMPLETION;
 	monitor_instance->subscription_pvt->expiry = when;
 
 	transmit_invite(monitor_instance->subscription_pvt, SIP_SUBSCRIBE, FALSE, 2, monitor_instance->subscribe_uri);
+	sip_pvt_unlock(monitor_instance->subscription_pvt);
 
 	parent_link->child_avail_id = ast_sched_add(sched, when * 1000, ast_cc_available_timer_expire, parent_link);
 	ao2_ref(monitor_instance, -1);
@@ -12495,6 +12485,8 @@
 		return -1;
 	}
 
+	sip_pvt_lock(pvt);
+
 	create_addr(pvt, epa_entry->destination, NULL, TRUE);
 
 	req.method = SIP_PUBLISH;
@@ -12528,6 +12520,7 @@
 	pvt->epa_entry = epa_entry;
 
 	send_request(pvt, &req, XMIT_RELIABLE, INITIAL_CSEQ);
+	sip_pvt_unlock(pvt);
 	dialog_unref(pvt, "Done with the sip_pvt allocated for transmitting PUBLISH");
 
 	return 0;

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=238538&r1=238537&r2=238538
==============================================================================
--- team/group/CCSS/include/asterisk/ccss.h (original)
+++ team/group/CCSS/include/asterisk/ccss.h Thu Jan  7 15:32:39 2010
@@ -895,28 +895,6 @@
 	 * \retval -1 on error.
 	 */
 	int (*init)(struct ast_cc_agent *agent, struct ast_channel *chan);
-	/*!
-	 * \brief Offer CC to caller.
-	 *
-	 * \param agent CC core agent control.
-	 * \param callee_interface Callee channel name.
-	 *
-	 * \details
-	 * This is called separately as each callee announces
-	 * his ability to accept CC. The agent's behavior will
-	 * likely vary widely between implementations. For instance,
-	 * it may be necessary to send out a specific message to the
-	 * caller for each time this function is called, or it may
-	 * be necessary to send a message only the first time this
-	 * callback is called. Still, another strategy may be to set
-	 * a flag or flags when this function is called so that
-	 * subsequent ringing or hangup messages will have the
-	 * necessary information embedded within.
-	 *
-	 * \retval 0 on success.
-	 * \retval -1 on error.
-	 */
-	int (*offer_cc)(struct ast_cc_agent *agent, const char * const callee_interface);
 	/*!
 	 * \brief Start the offer timer.
 	 *

Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=238538&r1=238537&r2=238538
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Thu Jan  7 15:32:39 2010
@@ -1724,8 +1724,7 @@
 		cc_interfaces->core_id, device_name, cc_service_to_string(cc_data->service)
 	);
 
-	core_instance->agent->callbacks->offer_cc(core_instance->agent, device_name);
-	cc_unref(core_instance, "Done with core_instance after calling agent offer_cc callback");
+	cc_unref(core_instance, "Done with core_instance after handling CC control frame");
 }
 
 int ast_cc_call_init(struct ast_channel *chan, int *ignore_cc)
@@ -1836,7 +1835,6 @@
 static void check_callback_sanity(const struct ast_cc_agent_callbacks *callbacks)
 {
 	ast_assert(callbacks->init != NULL);
-	ast_assert(callbacks->offer_cc != NULL);
 	ast_assert(callbacks->start_offer_timer != NULL);
 	ast_assert(callbacks->stop_offer_timer != NULL);
 	ast_assert(callbacks->ack != NULL);
@@ -1888,7 +1886,6 @@
 
 /* Generic agent callbacks */
 static int cc_generic_agent_init(struct ast_cc_agent *agent, struct ast_channel *chan);
-static int cc_generic_agent_offer_cc(struct ast_cc_agent *agent, const char * const callee_interface);
 static int cc_generic_agent_start_offer_timer(struct ast_cc_agent *agent);
 static int cc_generic_agent_stop_offer_timer(struct ast_cc_agent *agent);
 static void cc_generic_agent_ack(struct ast_cc_agent *agent);
@@ -1901,7 +1898,6 @@
 static struct ast_cc_agent_callbacks generic_agent_callbacks = {
 	.type = "generic",
 	.init = cc_generic_agent_init,
-	.offer_cc = cc_generic_agent_offer_cc,
 	.start_offer_timer = cc_generic_agent_start_offer_timer,
 	.stop_offer_timer = cc_generic_agent_stop_offer_timer,
 	.ack = cc_generic_agent_ack,
@@ -1939,15 +1935,6 @@
 	generic_pvt->offer_timer_id = -1;
 	agent->private_data = generic_pvt;
 	ast_set_flag(agent, AST_CC_AGENT_SKIP_OFFER);
-	return 0;
-}
-
-static int cc_generic_agent_offer_cc(struct ast_cc_agent *agent, const char * const callee_interface)
-{
-	/* The generic agent doesn't care about when a specific callee is capable of accepting
-	 * CC. The core maintains the list of interfaces called, and the caller doesn't need to
-	 * have any messages sent to him. Just return.
-	 */
 	return 0;
 }
 




More information about the svn-commits mailing list