[asterisk-commits] mmichelson: branch group/ccss_failure_response r296866 - /team/group/ccss_fai...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Nov 30 18:17:20 CST 2010


Author: mmichelson
Date: Tue Nov 30 18:17:16 2010
New Revision: 296866

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=296866
Log:
Add a special case to the SIP CC agent respond() callback.


Modified:
    team/group/ccss_failure_response/channels/chan_sip.c

Modified: team/group/ccss_failure_response/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/ccss_failure_response/channels/chan_sip.c?view=diff&rev=296866&r1=296865&r2=296866
==============================================================================
--- team/group/ccss_failure_response/channels/chan_sip.c (original)
+++ team/group/ccss_failure_response/channels/chan_sip.c Tue Nov 30 18:17:16 2010
@@ -1719,7 +1719,19 @@
 
 	sip_pvt_lock(agent_pvt->subscribe_pvt);
 	ast_set_flag(&agent_pvt->subscribe_pvt->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED);
-	if (reason == AST_CC_AGENT_RESPONSE_SUCCESS) {
+	if (reason == AST_CC_AGENT_RESPONSE_SUCCESS || !ast_strlen_zero(agent_pvt->notify_uri)) {
+		/* The second half of this if statement may be a bit hard to grasp,
+		 * so here's an explanation. When a subscription comes into
+		 * chan_sip, as long as it is not malformed, it will be passed
+		 * to the CC core. If the core senses an out-of-order state transition,
+		 * then the core will call this callback with the "reason" set to a
+		 * failure condition.
+		 * However, an out-of-order state transition will occur during a resubscription
+		 * for CC. In such a case, we can see that we have already generated a notify_uri
+		 * and so we can detect that this isn't a *real* failure. Rather, it is just
+		 * something the core doesn't recognize as a legitimate SIP state transition.
+		 * Thus we respond with happiness and flowers.
+		 */
 		transmit_response(agent_pvt->subscribe_pvt, "200 OK", &agent_pvt->subscribe_pvt->initreq);
 		transmit_cc_notify(agent, agent_pvt->subscribe_pvt, CC_QUEUED);
 	} else {




More information about the asterisk-commits mailing list