[asterisk-commits] mmichelson: branch group/CCSS r236182 - /team/group/CCSS/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Dec 22 17:54:36 CST 2009


Author: mmichelson
Date: Tue Dec 22 17:54:34 2009
New Revision: 236182

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=236182
Log:
Fill in a bit more.


Modified:
    team/group/CCSS/channels/chan_sip.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=236182&r1=236181&r2=236182
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Tue Dec 22 17:54:34 2009
@@ -3659,26 +3659,46 @@
 
 static int sip_cc_monitor_request_cc(struct ast_cc_monitor *monitor, const int core_id, struct ast_cc_monitor_link *parent_link)
 {
-	/* XXX STUB */
 	struct sip_monitor_instance *monitor_instance = find_sip_monitor_instance(core_id);
+	enum ast_cc_service_type service = parent_link->service;
+	int when;
 
 	if (!monitor_instance) {
 		return -1;
 	}
 
-	/* Find the appropriate sip_monitor_instance based on the given core_id.
-	 * Point the sip_monitor_instance monitor field at the monitor param
-	 * Allocate the sip_monitor_instance subscription_pvt
-	 * Send a SUBSCRIBE to the subscribe_uri
-	 * Start the available timer using information from the parent link. 
-	 */
+	monitor_instance->monitor = monitor;
+	ao2_ref(monitor_instance->monitor, +1);
+
+	if (!(monitor_instance->subscription_pvt = sip_alloc(NULL, NULL, 0, SIP_SUBSCRIBE, NULL))) {
+		ao2_ref(monitor_instance->monitor, -1);
+		return -1;
+	}
+	
+	/* XXX Should call create_addr or some such here to set appropriate values on the pvt */
+
+	transmit_invite(monitor_instance->subscription_pvt, SIP_SUBSCRIBE, FALSE, TRUE);
+
+	when = service == AST_CC_CCBS ? ast_get_ccbs_available_timer(monitor->interface->config_params) :
+		ast_get_ccnr_available_timer(monitor->interface->config_params);
+
+	parent_link->child_avail_id = ast_sched_add(sched, when * 1000, ast_cc_available_timer_expire, parent_link);
 	ao2_ref(monitor_instance, -1);
 	return 0;
 }
 
 static int sip_cc_monitor_suspend(struct ast_cc_monitor *monitor, const int core_id)
 {
-	/* XXX STUB */
+	struct sip_monitor_instance *monitor_instance = find_sip_monitor_instance(core_id);
+
+	if (!monitor_instance) {
+		return -1;
+	}
+
+	/* Hmmm, transmit_publish allocates the sip_pvt to be used...but it doesn't return that
+	 * in any useful way. That needs to change.
+	 */
+
 	/* Find the appropriate sip_monitor_instance based on the given core_id.
 	 * Allocate teh sip_monitor_instance publish_pvt
 	 * Send a PUBLISH to the notify_uri with PIDF state "closed"
@@ -12268,7 +12288,9 @@
 	struct sip_request req;
 	char expires_str[10];
 
-	sip_alloc(NULL, NULL, 0, SIP_PUBLISH, NULL);
+	if (!(pvt = sip_alloc(NULL, NULL, 0, SIP_PUBLISH, NULL))) {
+		return -1;
+	}
 
 	create_addr(pvt, epa_entry->destination, NULL, TRUE);
 




More information about the asterisk-commits mailing list