[svn-commits] mmichelson: branch group/CCSS r236354 - /team/group/CCSS/channels/chan_sip.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Dec 23 16:22:41 CST 2009


Author: mmichelson
Date: Wed Dec 23 16:22:39 2009
New Revision: 236354

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=236354
Log:
Commit progress.

This doesn't compile since I haven't written the function to
write the PIDF body for the PUBLISH, but I want my latest work
to be present in case I decide to work on this during the
extended weekend.


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=236354&r1=236353&r2=236354
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Wed Dec 23 16:22:39 2009
@@ -1839,8 +1839,7 @@
 	return backend ? backend->static_data : NULL;
 }
 
-/* XXX Remember to remove the unused attribute once call-completion stuff is in place */
-static __attribute__((unused)) struct sip_epa_entry *create_epa_entry (const char * const event_package, const char * const destination)
+static struct sip_epa_entry *create_epa_entry (const char * const event_package, const char * const destination)
 {
 	struct sip_epa_entry *epa_entry;
 	const struct epa_static_data *static_data;
@@ -2962,8 +2961,7 @@
 static void transmit_fake_auth_response(struct sip_pvt *p, int sipmethod, struct sip_request *req, enum xmittype reliable);
 static int transmit_request(struct sip_pvt *p, int sipmethod, int inc, enum xmittype reliable, int newbranch);
 static int transmit_request_with_auth(struct sip_pvt *p, int sipmethod, int seqno, enum xmittype reliable, int newbranch);
-/*XXX Remember to remove the unused attribute once call-completion is in place */
-static __attribute__((unused)) int transmit_publish(struct sip_epa_entry *epa_entry, enum sip_publish_type publish_type, const char * body);
+static int transmit_publish(struct sip_epa_entry *epa_entry, enum sip_publish_type publish_type, const char * body);
 static int transmit_invite(struct sip_pvt *p, int sipmethod, int sdp, int init);
 static int transmit_reinvite_with_sdp(struct sip_pvt *p, int t38version, int oldsdp);
 static int transmit_info_with_digit(struct sip_pvt *p, const char digit, unsigned int duration);
@@ -3576,7 +3574,7 @@
 	struct ast_cc_monitor *monitor;
 	int core_id;
 	struct sip_pvt *subscription_pvt;
-	struct sip_pvt *publish_pvt;
+	struct sip_epa_entry *suspension_entry;
 	char subscribe_uri[SIPBUFSIZE];
 	char notify_uri[SIPBUFSIZE];
 };
@@ -3601,8 +3599,8 @@
 	if (monitor_instance->subscription_pvt) {
 		dialog_unref(monitor_instance->subscription_pvt, "Unref monitor instance ref of subscription pvt");
 	}
-	if (monitor_instance->publish_pvt) {
-		dialog_unref(monitor_instance->publish_pvt, "Unref monitor instance ref of publish pvt");
+	if (monitor_instance->suspension_entry) {
+		ao2_ref(monitor_instance->suspension_entry, -1);
 	}
 	if (monitor_instance->monitor) {
 		ao2_ref(monitor_instance->monitor, -1);
@@ -3690,14 +3688,26 @@
 static int sip_cc_monitor_suspend(struct ast_cc_monitor *monitor, const int core_id)
 {
 	struct sip_monitor_instance *monitor_instance = find_sip_monitor_instance(core_id);
+	enum sip_publish_type publish_type;
+	char pidf_body[256];
 
 	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.
-	 */
+	if (!monitor_instance->suspension_entry) {
+		/* We haven't yet allocated the suspension entry, so let's give it a shot */
+		if (!(monitor_instance->suspension_entry = create_epa_entry("call-completion", monitor_instance->notify_uri))) {
+			ast_log(LOG_WARNING, "Unable to allocate sip EPA entry for call-completion\n");
+			return -1;
+		}
+		publish_type = SIP_PUBLISH_INITIAL;
+	} else {
+		publish_type = SIP_PUBLISH_MODIFY;
+	}
+
+	construct_pidf_body(CC_CLOSED, pidf_body, sizeof(pidf_body));
+	transmit_publish(monitor_instance->suspension_entry, publish_type, pidf_body);
 
 	/* Find the appropriate sip_monitor_instance based on the given core_id.
 	 * Allocate teh sip_monitor_instance publish_pvt




More information about the svn-commits mailing list