[asterisk-commits] rizzo: branch rizzo/astobj2 r47500 - /team/rizzo/astobj2/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Nov 12 07:16:09 MST 2006


Author: rizzo
Date: Sun Nov 12 08:16:08 2006
New Revision: 47500

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47500
Log:
following an observation from olle, note that refer_pvt
is not owned by the sip_refer object, so it should not be
destroyed but just unreferred when the sip_refer goes away.


Modified:
    team/rizzo/astobj2/channels/chan_sip.c

Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?view=diff&rev=47500&r1=47499&r2=47500
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Sun Nov 12 08:16:08 2006
@@ -862,7 +862,10 @@
 	char replaces_callid[BUFSIZ];			/*!< Replace info: callid */
 	char replaces_callid_totag[BUFSIZ/2];		/*!< Replace info: to-tag */
 	char replaces_callid_fromtag[BUFSIZ/2];		/*!< Replace info: from-tag */
-	struct sip_pvt *refer_pvt;			/*!< Call we are referring */
+	struct sip_pvt *refer_pvt;			/*!< Call we are referring. This is just a reference to a
+							 * dialog owned by someone else, so we should not destroy
+							 * it when the sip_refer object goes.
+							 */
 	int attendedtransfer;				/*!< Attended or blind transfer? */
 	int localtransfer;				/*!< Transfer to local domain? */
 	enum referstatus status;			/*!< REFER status */
@@ -7505,7 +7508,7 @@
 	if (!p->refer)
 		return;
 	if (p->refer->refer_pvt)
-		p->refer->refer_pvt = sip_destroy(p->refer->refer_pvt);
+		p->refer->refer_pvt = pvt_unref(p->refer->refer_pvt);
 	free(p->refer);
 	p->refer = NULL;
 }
@@ -8988,8 +8991,8 @@
 		ast_copy_string(referdata->refer_to, c, sizeof(referdata->refer_to));
 		ast_copy_string(referdata->referred_by, "", sizeof(referdata->referred_by));
 		ast_copy_string(referdata->refer_contact, "", sizeof(referdata->refer_contact));
-		if (referdata->refer_pvt)	/* XXX or sip_destroy() ? */
-			referdata->refer_pvt = sip_destroy(referdata->refer_pvt);
+		if (referdata->refer_pvt)
+			referdata->refer_pvt = pvt_unref(referdata->refer_pvt);
 		/* Set new context */
 		ast_string_field_set(p, context, transfer_context);
 		return 0;
@@ -13480,6 +13483,11 @@
 			If we have a Replaces  header, we need to cancel that call if we succeed with this call 
 		*/
 		/* XXX do we have a previous refer_pvt ? */
+		if (p->refer->refer_pvt) {
+			ast_log(LOG_DEBUG, "-- note, refer_pvt %p for %p is going to be replaced\n",
+				p->refer->refer_pvt, p);
+			p->refer->refer_pvt = pvt_unref(p->refer->refer_pvt);
+		}
 		if ((p->refer->refer_pvt = get_sip_pvt_byid_locked(replace_id, totag, fromtag)) == NULL) {
 			ast_log(LOG_NOTICE, "Supervised transfer attempted to replace non-existent call id (%s)!\n", replace_id);
 			transmit_response(p, "481 Call Leg Does Not Exist (Replaces)", req);



More information about the asterisk-commits mailing list