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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Dec 30 13:48:12 CST 2009


Author: mmichelson
Date: Wed Dec 30 13:48:10 2009
New Revision: 236889

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=236889
Log:
Be sure to have the correct event and accept headers on 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=236889&r1=236888&r2=236889
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Wed Dec 30 13:48:10 2009
@@ -3710,6 +3710,7 @@
 	}
 	
 	create_addr(monitor_instance->subscription_pvt, monitor_instance->peername, 0, 1);
+	monitor_instance->subscription_pvt->subscribed = CALL_COMPLETION;
 
 	transmit_invite(monitor_instance->subscription_pvt, SIP_SUBSCRIBE, FALSE, 2, monitor_instance->subscribe_uri);
 
@@ -12581,13 +12582,26 @@
 				add_header(&req, "Referred-By", buf);
 			}
 		}
-	} else if (sipmethod == SIP_SUBSCRIBE) { /* We only support sending MWI subscriptions right now */
-		char buf[SIPBUFSIZE];
-
-		add_header(&req, "Event", "message-summary");
-		add_header(&req, "Accept", "application/simple-message-summary");
-		snprintf(buf, sizeof(buf), "%d", mwi_expiry);
-		add_header(&req, "Expires", buf);
+	} else if (sipmethod == SIP_SUBSCRIBE) {
+		if (p->subscribed == MWI_NOTIFICATION) {
+			char buf[SIPBUFSIZE];
+
+			add_header(&req, "Event", "message-summary");
+			add_header(&req, "Accept", "application/simple-message-summary");
+			snprintf(buf, sizeof(buf), "%d", mwi_expiry);
+			add_header(&req, "Expires", buf);
+		} else if (p->subscribed == CALL_COMPLETION) {
+			char buf[SIPBUFSIZE];
+
+			add_header(&req, "Event", "call-completion");
+			add_header(&req, "Accept", "application/call-completion");
+			/* XXX The Expires header should have the CCBS or CCNR available timer
+			 * instead of the mwi_expiry. For the sake of just making sure basic stuff
+			 * works, I'll leave this as-is for now and come back later.
+			 */
+			snprintf(buf, sizeof(buf), "%d", mwi_expiry);
+			add_header(&req, "Expires", buf);
+		}
 	}
 
 	/* This new INVITE is part of an attended transfer. Make sure that the
@@ -24141,6 +24155,7 @@
 	agent_pvt = agent->private_data;
 	agent_pvt->subscribe_pvt = dialog_ref(p, "SIP CC agent gains reference to subscription dialog");
 	ast_cc_agent_accept_request(agent->core_id, "SIP caller has requested CC via SUBSCRIBE");
+	p->subscribed = CALL_COMPLETION;
 
 	/* We don't send a response here. That is done in the agent's ack callback or in the
 	 * agent destructor, should a failure occur before we have responded




More information about the asterisk-commits mailing list