[asterisk-commits] mmichelson: branch group/CCSS r232018 - /team/group/CCSS/channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Dec 1 18:11:51 CST 2009
Author: mmichelson
Date: Tue Dec 1 18:11:48 2009
New Revision: 232018
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=232018
Log:
Fix some behavior for the SIP CC agent destructor.
It's possible to have the function called before we have
received a SUBSCRIBE. In such a case, we need to be sure that
the subscribe_pvt is non-NULL before trying to act on it.
Also, if failure occurs before we have sent a response to the
SUBSCRIBE, we need to send a 500 back.
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=232018&r1=232017&r2=232018
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Tue Dec 1 18:11:48 2009
@@ -3514,12 +3514,16 @@
if (agent_pvt->offer_timer_id != -1) {
AST_SCHED_DEL(sched, agent_pvt->offer_timer_id);
}
- /* As the agent, we don't need to send any sort of messages
- * on the sip_pvts for which we have references. We just need
- * to unref.
- */
agent_pvt->original_call = dialog_unref(agent_pvt->original_call, "SIP CC agent destructor: Remove ref to original call");
- agent_pvt->subscribe_pvt = dialog_unref(agent_pvt->subscribe_pvt, "SIP CC agent destructor: Remove ref to subscription");
+ if (agent_pvt->subscribe_pvt) {
+ if (!ast_test_flag(&agent_pvt->subscribe_pvt->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED)) {
+ /* If we haven't sent a 200 OK for the SUBSCRIBE dialog yet, then we need to send a response letting
+ * the subscriber know something went wrong
+ */
+ transmit_response(agent_pvt->subscribe_pvt, "500 Internal Server Error", &agent_pvt->subscribe_pvt->initreq);
+ }
+ agent_pvt->subscribe_pvt = dialog_unref(agent_pvt->subscribe_pvt, "SIP CC agent destructor: Remove ref to subscription");
+ }
ast_free(agent_pvt);
}
More information about the asterisk-commits
mailing list