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

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Dec 1 14:16:44 CST 2009


Author: mmichelson
Date: Tue Dec  1 14:16:40 2009
New Revision: 231846

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=231846
Log:
Augment handle_request_subscribe to handle CC SUBSCRIBEs.


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=231846&r1=231845&r2=231846
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Tue Dec  1 14:16:40 2009
@@ -23425,6 +23425,12 @@
 	}
 }
 
+static int handle_cc_subscribe(struct sip_pvt *p, struct sip_request *req)
+{
+	/* XXX STUB */
+	return 0;
+}
+
 /*! \brief  Handle incoming SUBSCRIBE request */
 static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, int seqno, const char *e)
 {
@@ -23537,7 +23543,7 @@
 		return 0;
 	}
 
-	if (strcmp(event, "message-summary")) {
+	if (strcmp(event, "message-summary") && strcmp(event, "call-completion")) {
 		/* Get destination right away */
 		gotdest = get_destination(p, NULL);
 	}
@@ -23644,6 +23650,8 @@
 			unref_peer(p->relatedpeer, "Unref previously stored relatedpeer ptr");
 		p->relatedpeer = ref_peer(authpeer, "setting dialog's relatedpeer pointer");	/* already refcounted...Link from pvt to peer UH- should this be dialog_ref()? */
 		/* Do not release authpeer here */
+	} else if (!strcmp(event, "call-completion")) {
+		handle_cc_subscribe(p, req);
 	} else { /* At this point, Asterisk does not understand the specified event */
 		transmit_response(p, "489 Bad Event", req);
 		ast_debug(2, "Received SIP subscribe for unknown event package: %s\n", event);
@@ -23654,7 +23662,7 @@
 	}
 
 	/* Add subscription for extension state from the PBX core */
-	if (p->subscribed != MWI_NOTIFICATION && !resubscribe) {
+	if (p->subscribed != MWI_NOTIFICATION  && p->subscribed != CALL_COMPLETION && !resubscribe) {
 		if (p->stateid > -1) {
 			ast_extension_state_del(p->stateid, cb_extensionstate);
 			/* we need to dec the refcount, now that the extensionstate is removed */
@@ -23675,10 +23683,13 @@
 			p->expiry = min_expiry;
 
 		if (sipdebug) {
-			if (p->subscribed == MWI_NOTIFICATION && p->relatedpeer)
+			if (p->subscribed == MWI_NOTIFICATION && p->relatedpeer) {
 				ast_debug(2, "Adding subscription for mailbox notification - peer %s\n", p->relatedpeer->name);
-			else
+			} else if (p->subscribed == CALL_COMPLETION) {
+				ast_debug(2, "Adding CC subscription for peer %s\n", p->username);
+			} else {
 				ast_debug(2, "Adding subscription for extension %s context %s for peer %s\n", p->exten, p->context, p->username);
+			}
 		}
 		if (p->autokillid > -1 && sip_cancel_destroy(p))	/* Remove subscription expiry for renewals */
 			ast_log(LOG_WARNING, "Unable to cancel SIP destruction.  Expect bad things.\n");
@@ -23693,7 +23704,7 @@
 				sip_send_mwi_to_peer(p->relatedpeer, NULL, 0);
 				ao2_unlock(p->relatedpeer);
 			}
-		} else {
+		} else if (p->subscribed != CALL_COMPLETION) {
 			struct sip_pvt *p_old;
 
 			if ((firststate = ast_extension_state(NULL, p->context, p->exten)) < 0) {




More information about the svn-commits mailing list