[Freeswitch-svn] [commit] r12987 - in freeswitch/trunk/src/mod/endpoints: mod_alsa mod_dingaling mod_iax mod_loopback mod_opal mod_reference mod_skypiax mod_sofia mod_unicall

FreeSWITCH SVN anthm at freeswitch.org
Fri Apr 10 13:14:02 PDT 2009


Author: anthm
Date: Fri Apr 10 15:14:02 2009
New Revision: 12987

Log:
FSCORE-352

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c
   freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
   freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c
   freeswitch/trunk/src/mod/endpoints/mod_loopback/mod_loopback.c
   freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.cpp
   freeswitch/trunk/src/mod/endpoints/mod_reference/mod_reference.c
   freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
   freeswitch/trunk/src/mod/endpoints/mod_unicall/mod_unicall.c

Modified: freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c	Fri Apr 10 15:14:02 2009
@@ -428,14 +428,12 @@
 
 static switch_status_t channel_on_destroy(switch_core_session_t *session)
 {
-	switch_channel_t *channel = NULL;
-	private_t *tech_pvt = NULL;
+	//switch_channel_t *channel = NULL;
+	//private_t *tech_pvt = NULL;
 
-	channel = switch_core_session_get_channel(session);
-	assert(channel != NULL);
+	//channel = switch_core_session_get_channel(session);
+	//tech_pvt = switch_core_session_get_private(session);
 
-	tech_pvt = switch_core_session_get_private(session);
-	assert(tech_pvt != NULL);
 
 	return SWITCH_STATUS_SUCCESS;
 }

Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c	Fri Apr 10 15:14:02 2009
@@ -1214,23 +1214,23 @@
 	struct private_object *tech_pvt = NULL;
 
 	tech_pvt = switch_core_session_get_private(session);
-	switch_assert(tech_pvt != NULL);
 
-	if (tech_pvt->rtp_session) {
-		switch_rtp_destroy(&tech_pvt->rtp_session);
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NUKE RTP\n");
-		tech_pvt->rtp_session = NULL;
-	}
+	if (tech_pvt) {
+		if (tech_pvt->rtp_session) {
+			switch_rtp_destroy(&tech_pvt->rtp_session);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NUKE RTP\n");
+			tech_pvt->rtp_session = NULL;
+		}
 
-	if (switch_core_codec_ready(&tech_pvt->read_codec)) {
-		switch_core_codec_destroy(&tech_pvt->read_codec);
-	}
+		if (switch_core_codec_ready(&tech_pvt->read_codec)) {
+			switch_core_codec_destroy(&tech_pvt->read_codec);
+		}
 
-	if (switch_core_codec_ready(&tech_pvt->write_codec)) {
-		switch_core_codec_destroy(&tech_pvt->write_codec);
+		if (switch_core_codec_ready(&tech_pvt->write_codec)) {
+			switch_core_codec_destroy(&tech_pvt->write_codec);
+		}
 	}
 
-
 	return SWITCH_STATUS_SUCCESS;
 }
 

Modified: freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c	Fri Apr 10 15:14:02 2009
@@ -493,14 +493,14 @@
 {
 	private_t *tech_pvt = switch_core_session_get_private(session);
 
-	switch_assert(tech_pvt != NULL);
-
-	if (switch_core_codec_ready(&tech_pvt->read_codec)) {
-		switch_core_codec_destroy(&tech_pvt->read_codec);
-	}
-
-	if (!switch_core_codec_ready(&tech_pvt->write_codec)) {
-		switch_core_codec_destroy(&tech_pvt->write_codec);
+	if (tech_pvt) {
+		if (switch_core_codec_ready(&tech_pvt->read_codec)) {
+			switch_core_codec_destroy(&tech_pvt->read_codec);
+		}
+		
+		if (!switch_core_codec_ready(&tech_pvt->write_codec)) {
+			switch_core_codec_destroy(&tech_pvt->write_codec);
+		}
 	}
 
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/trunk/src/mod/endpoints/mod_loopback/mod_loopback.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_loopback/mod_loopback.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_loopback/mod_loopback.c	Fri Apr 10 15:14:02 2009
@@ -353,16 +353,17 @@
 	switch_assert(channel != NULL);
 
 	tech_pvt = switch_core_session_get_private(session);
-	switch_assert(tech_pvt != NULL);
-
-	switch_core_timer_destroy(&tech_pvt->timer);
-
-	if (switch_core_codec_ready(&tech_pvt->read_codec)) {
-		switch_core_codec_destroy(&tech_pvt->read_codec);
-	}
 
-	if (switch_core_codec_ready(&tech_pvt->write_codec)) {
-		switch_core_codec_destroy(&tech_pvt->write_codec);
+	if (tech_pvt) {
+		switch_core_timer_destroy(&tech_pvt->timer);
+		
+		if (switch_core_codec_ready(&tech_pvt->read_codec)) {
+			switch_core_codec_destroy(&tech_pvt->read_codec);
+		}
+		
+		if (switch_core_codec_ready(&tech_pvt->write_codec)) {
+			switch_core_codec_destroy(&tech_pvt->write_codec);
+		}
 	}
 
 

Modified: freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.cpp
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.cpp	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.cpp	Fri Apr 10 15:14:02 2009
@@ -835,38 +835,36 @@
 
 static switch_status_t on_destroy(switch_core_session_t *session)
 {
-    switch_channel_t *channel = switch_core_session_get_channel(session);
+    //switch_channel_t *channel = switch_core_session_get_channel(session);
     opal_private_t *tech_pvt = (opal_private_t *) switch_core_session_get_private(session);
 
-    if (tech_pvt->read_codec.implementation) {
-        switch_core_codec_destroy(&tech_pvt->read_codec);
-    }
+    if (tech_pvt) {
+        if (tech_pvt->read_codec.implementation) {
+            switch_core_codec_destroy(&tech_pvt->read_codec);
+        }
 
-    if (tech_pvt->write_codec.implementation) {
-        switch_core_codec_destroy(&tech_pvt->write_codec);
-    }
+        if (tech_pvt->write_codec.implementation) {
+            switch_core_codec_destroy(&tech_pvt->write_codec);
+        }
 
-    if (tech_pvt->vid_read_codec.implementation) {
-        switch_core_codec_destroy(&tech_pvt->vid_read_codec);
-    }
+        if (tech_pvt->vid_read_codec.implementation) {
+            switch_core_codec_destroy(&tech_pvt->vid_read_codec);
+        }
 
-    if (tech_pvt->vid_write_codec.implementation) {
-        switch_core_codec_destroy(&tech_pvt->vid_write_codec);
-    }
+        if (tech_pvt->vid_write_codec.implementation) {
+            switch_core_codec_destroy(&tech_pvt->vid_write_codec);
+        }
 
-    if (tech_pvt->read_timer.timer_interface) {
-        switch_core_timer_destroy(&tech_pvt->read_timer);
-    }
+        if (tech_pvt->read_timer.timer_interface) {
+            switch_core_timer_destroy(&tech_pvt->read_timer);
+        }
 
-    if (tech_pvt->vid_read_timer.timer_interface) {
-        switch_core_timer_destroy(&tech_pvt->vid_read_timer);
+        if (tech_pvt->vid_read_timer.timer_interface) {
+            switch_core_timer_destroy(&tech_pvt->vid_read_timer);
+        }
     }
 
-    switch_core_session_unset_read_codec(session);
-    switch_core_session_unset_write_codec(session);
-    
 	return SWITCH_STATUS_SUCCESS;
-
 }
 
 /* this function has to be called with the original session beause the FSConnection might already be destroyed and we 

Modified: freeswitch/trunk/src/mod/endpoints/mod_reference/mod_reference.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_reference/mod_reference.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_reference/mod_reference.c	Fri Apr 10 15:14:02 2009
@@ -195,15 +195,15 @@
 	assert(channel != NULL);
 
 	tech_pvt = switch_core_session_get_private(session);
-	assert(tech_pvt != NULL);
-
-
-	if (switch_core_codec_ready(&tech_pvt->read_codec)) {
-		switch_core_codec_destroy(&tech_pvt->read_codec);
-	}
 
-	if (switch_core_codec_ready(&tech_pvt->write_codec)) {
-		switch_core_codec_destroy(&tech_pvt->write_codec);
+	if (tech_pvt) {
+		if (switch_core_codec_ready(&tech_pvt->read_codec)) {
+			switch_core_codec_destroy(&tech_pvt->read_codec);
+		}
+		
+		if (switch_core_codec_ready(&tech_pvt->write_codec)) {
+			switch_core_codec_destroy(&tech_pvt->write_codec);
+		}
 	}
 
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c	Fri Apr 10 15:14:02 2009
@@ -183,23 +183,24 @@
   return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t channel_on_hangup(switch_core_session_t * session)
+static switch_status_t channel_on_destroy(switch_core_session_t * session)
 {
-  switch_channel_t *channel = NULL;
+	//switch_channel_t *channel = NULL;
   private_t *tech_pvt = NULL;
 
-  channel = switch_core_session_get_channel(session);
-  switch_assert(channel != NULL);
+  //channel = switch_core_session_get_channel(session);
+  //switch_assert(channel != NULL);
 
   tech_pvt = switch_core_session_get_private(session);
-  switch_assert(tech_pvt != NULL);
-
-  if (switch_core_codec_ready(&tech_pvt->read_codec)) {
-	  switch_core_codec_destroy(&tech_pvt->read_codec);
-  }
 
-  if (switch_core_codec_ready(&tech_pvt->write_codec)) {
-	  switch_core_codec_destroy(&tech_pvt->write_codec);
+  if (tech_pvt) {
+	  if (switch_core_codec_ready(&tech_pvt->read_codec)) {
+		  switch_core_codec_destroy(&tech_pvt->read_codec);
+	  }
+	  
+	  if (switch_core_codec_ready(&tech_pvt->write_codec)) {
+		  switch_core_codec_destroy(&tech_pvt->write_codec);
+	  }
   }
 
   return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	Fri Apr 10 15:14:02 2009
@@ -239,22 +239,24 @@
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA DESTROY\n", switch_channel_get_name(channel));
 
-	if (switch_core_codec_ready(&tech_pvt->read_codec)) {
-		switch_core_codec_destroy(&tech_pvt->read_codec);
-	}
-
-	if (switch_core_codec_ready(&tech_pvt->write_codec)) {
-		switch_core_codec_destroy(&tech_pvt->write_codec);
-	}
+	if (tech_pvt) {
+		if (switch_core_codec_ready(&tech_pvt->read_codec)) {
+			switch_core_codec_destroy(&tech_pvt->read_codec);
+		}
+		
+		if (switch_core_codec_ready(&tech_pvt->write_codec)) {
+			switch_core_codec_destroy(&tech_pvt->write_codec);
+		}
 
-	switch_core_session_unset_read_codec(session);
-	switch_core_session_unset_write_codec(session);
+		switch_core_session_unset_read_codec(session);
+		switch_core_session_unset_write_codec(session);
 
-	switch_mutex_lock(tech_pvt->profile->flag_mutex);
-	tech_pvt->profile->inuse--;
-	switch_mutex_unlock(tech_pvt->profile->flag_mutex);
+		switch_mutex_lock(tech_pvt->profile->flag_mutex);
+		tech_pvt->profile->inuse--;
+		switch_mutex_unlock(tech_pvt->profile->flag_mutex);
 
-	sofia_glue_deactivate_rtp(tech_pvt);
+		sofia_glue_deactivate_rtp(tech_pvt);
+	}
 
 	return SWITCH_STATUS_SUCCESS;
 

Modified: freeswitch/trunk/src/mod/endpoints/mod_unicall/mod_unicall.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_unicall/mod_unicall.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_unicall/mod_unicall.c	Fri Apr 10 15:14:02 2009
@@ -934,18 +934,20 @@
 
 static switch_status_t unicall_on_destroy(switch_core_session_t *session)
 {
-    switch_channel_t *channel;
+    //switch_channel_t *channel;
     private_t *tech_pvt;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
+    //channel = switch_core_session_get_channel(session);
+    //assert(channel != NULL);
+
     tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
 
-    if (switch_core_codec_ready(&tech_pvt->read_codec))
-        switch_core_codec_destroy(&tech_pvt->read_codec);
-    if (switch_core_codec_ready(&tech_pvt->write_codec))
-        switch_core_codec_destroy(&tech_pvt->write_codec);
+	if (tech_pvt) {
+		if (switch_core_codec_ready(&tech_pvt->read_codec))
+			switch_core_codec_destroy(&tech_pvt->read_codec);
+		if (switch_core_codec_ready(&tech_pvt->write_codec))
+			switch_core_codec_destroy(&tech_pvt->write_codec);
+	}
 	
 	return SWITCH_STATUS_SUCCESS;
 		



More information about the Freeswitch-svn mailing list