[asterisk-commits] wedhorn: branch 11 r375660 - /branches/11/channels/chan_skinny.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Nov 2 15:56:48 CDT 2012


Author: wedhorn
Date: Fri Nov  2 15:56:43 2012
New Revision: 375660

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=375660
Log:
Fix for chan_skinny leaving RTP ports open

Skinny wasn't closing RTP sockets. This patch includes ast_rtp_instance_stop before 
ast_rtp_instance_destroy which fixes the problem. Also add destroy for VRTP (which 
I believe is unused, but exists).

Review: https://reviewboard.asterisk.org/r/2176/

Modified:
    branches/11/channels/chan_skinny.c

Modified: branches/11/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/chan_skinny.c?view=diff&rev=375660&r1=375659&r2=375660
==============================================================================
--- branches/11/channels/chan_skinny.c (original)
+++ branches/11/channels/chan_skinny.c Fri Nov  2 15:56:43 2012
@@ -4234,6 +4234,22 @@
 	ast_mutex_unlock(&sub->lock);
 }
 
+static void destroy_rtp(struct skinny_subchannel *sub)
+{
+	if (sub->rtp) {
+		SKINNY_DEBUG(DEBUG_AUDIO, 3, "Sub %d - Destroying RTP\n", sub->callid);
+		ast_rtp_instance_stop(sub->rtp);
+		ast_rtp_instance_destroy(sub->rtp);
+		sub->rtp = NULL;
+	}
+	if (sub->vrtp) {
+		SKINNY_DEBUG(DEBUG_AUDIO, 3, "Sub %d - Destroying VRTP\n", sub->callid);
+		ast_rtp_instance_stop(sub->vrtp);
+		ast_rtp_instance_destroy(sub->vrtp);
+		sub->vrtp = NULL;
+	}
+}
+
 static void *skinny_newcall(void *data)
 {
 	struct ast_channel *c = data;
@@ -4467,10 +4483,7 @@
 	ast_mutex_lock(&sub->lock);
 	sub->owner = NULL;
 	ast_channel_tech_pvt_set(ast, NULL);
-	if (sub->rtp) {
-		ast_rtp_instance_destroy(sub->rtp);
-		sub->rtp = NULL;
-	}
+	destroy_rtp(sub);
 	ast_mutex_unlock(&sub->lock);
 	ast_free(sub);
 	ast_module_unref(ast_module_info->self);
@@ -5082,20 +5095,17 @@
 				transmit_closereceivechannel(d, sub);
 				transmit_stopmediatransmission(d, sub);
 			}
-			
+
 			if (subline->callid) {
 				transmit_stop_tone(d, l->instance, sub->callid);
 				transmit_callstate(d, l->instance, subline->callid, SKINNY_CALLREMOTEMULTILINE);
 				transmit_selectsoftkeys(d, l->instance, subline->callid, KEYDEF_SLACONNECTEDNOTACTIVE);
 				transmit_displaypromptstatus(d, "In Use", 0, l->instance, subline->callid);
 			}
-			
-			sub->cxmode = SKINNY_CX_RECVONLY;	
+
+			sub->cxmode = SKINNY_CX_RECVONLY;
 			sub->substate = SUBSTATE_ONHOOK;
-			if (sub->rtp) {
-				ast_rtp_instance_destroy(sub->rtp);
-				sub->rtp = NULL;
-			}
+			destroy_rtp(sub);
 			sub->substate = SUBSTATE_ONHOOK;
 			if (sub->owner) {
 				ast_queue_hangup(sub->owner);
@@ -5203,12 +5213,9 @@
 			transmit_clearpromptmessage(d, l->instance, sub->callid);
 		}
 
-		sub->cxmode = SKINNY_CX_RECVONLY;	
+		sub->cxmode = SKINNY_CX_RECVONLY;
 		sub->substate = SUBSTATE_ONHOOK;
-		if (sub->rtp) {
-			ast_rtp_instance_destroy(sub->rtp);
-			sub->rtp = NULL;
-		}
+		destroy_rtp(sub);
 		if (sub->owner) {
 			ast_queue_hangup(sub->owner);
 		}




More information about the asterisk-commits mailing list