]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FSCORE-352
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 10 Apr 2009 20:14:02 +0000 (20:14 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 10 Apr 2009 20:14:02 +0000 (20:14 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12987 d0543943-73ff-0310-b7d9-9358b9ac24b2

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

index 7e215f3426dc6f8e2288b85eca44bf6d30c53435..4fc3008bd17052637109b37fa8350d07c6299fb8 100644 (file)
@@ -428,14 +428,12 @@ static void remove_pvt(private_t *tech_pvt)
 
 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;
 }
index 998a829a9d2ca33446778f12854f537c50cb0b8a..ef14b8d74e39ad3c48d89ed29ef3f70cebafc9fd 100644 (file)
@@ -1214,23 +1214,23 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session)
        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;
 }
 
index 78368e12a4c25658e126e1e79d20a7cfb53846d1..eeb4370958397201e736635ef6f7eec541386408 100644 (file)
@@ -493,14 +493,14 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session)
 {
        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;
index ebb890aabd5bdd66b76b2f8e6f1933eb856b6978..a943a5460c8c34c3774a90c30f1d741f82b096ea 100644 (file)
@@ -353,16 +353,17 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session)
        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);
+               }
        }
 
 
index 38c93ab929990f1189e2affc330332130b6e9a4a..ac3a9fd74b0cffecc1e615279bd1f5833aefd521 100644 (file)
@@ -835,38 +835,36 @@ switch_status_t FSConnection::on_execute()
 \r
 static switch_status_t on_destroy(switch_core_session_t *session)\r
 {\r
-    switch_channel_t *channel = switch_core_session_get_channel(session);\r
+    //switch_channel_t *channel = switch_core_session_get_channel(session);\r
     opal_private_t *tech_pvt = (opal_private_t *) switch_core_session_get_private(session);\r
 \r
-    if (tech_pvt->read_codec.implementation) {\r
-        switch_core_codec_destroy(&tech_pvt->read_codec);\r
-    }\r
+    if (tech_pvt) {\r
+        if (tech_pvt->read_codec.implementation) {\r
+            switch_core_codec_destroy(&tech_pvt->read_codec);\r
+        }\r
 \r
-    if (tech_pvt->write_codec.implementation) {\r
-        switch_core_codec_destroy(&tech_pvt->write_codec);\r
-    }\r
+        if (tech_pvt->write_codec.implementation) {\r
+            switch_core_codec_destroy(&tech_pvt->write_codec);\r
+        }\r
 \r
-    if (tech_pvt->vid_read_codec.implementation) {\r
-        switch_core_codec_destroy(&tech_pvt->vid_read_codec);\r
-    }\r
+        if (tech_pvt->vid_read_codec.implementation) {\r
+            switch_core_codec_destroy(&tech_pvt->vid_read_codec);\r
+        }\r
 \r
-    if (tech_pvt->vid_write_codec.implementation) {\r
-        switch_core_codec_destroy(&tech_pvt->vid_write_codec);\r
-    }\r
+        if (tech_pvt->vid_write_codec.implementation) {\r
+            switch_core_codec_destroy(&tech_pvt->vid_write_codec);\r
+        }\r
 \r
-    if (tech_pvt->read_timer.timer_interface) {\r
-        switch_core_timer_destroy(&tech_pvt->read_timer);\r
-    }\r
+        if (tech_pvt->read_timer.timer_interface) {\r
+            switch_core_timer_destroy(&tech_pvt->read_timer);\r
+        }\r
 \r
-    if (tech_pvt->vid_read_timer.timer_interface) {\r
-        switch_core_timer_destroy(&tech_pvt->vid_read_timer);\r
+        if (tech_pvt->vid_read_timer.timer_interface) {\r
+            switch_core_timer_destroy(&tech_pvt->vid_read_timer);\r
+        }\r
     }\r
 \r
-    switch_core_session_unset_read_codec(session);\r
-    switch_core_session_unset_write_codec(session);\r
-    \r
        return SWITCH_STATUS_SUCCESS;\r
-\r
 }\r
 \r
 /* this function has to be called with the original session beause the FSConnection might already be destroyed and we \r
index c6bcb1755671223d0d8c7d1b046e3d3511fa20ee..b7011eb61cb1528ba900da177ab7a0c7266b6388 100644 (file)
@@ -195,15 +195,15 @@ static switch_status_t channel_on_destroy(switch_core_session_t *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;
index 33f10e88b20b4e539b3a045c63841f087342b122..67624e9187d01326750f1a8891bb5e607969cc71 100644 (file)
@@ -183,23 +183,24 @@ static switch_status_t channel_on_init(switch_core_session_t * session)
   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;
index 2053e1f6ad69fcf6d85f15fb20b25b2660d96ee5..4e51a241c671c68b5e0b04e58abc50f79f4a91b0 100644 (file)
@@ -239,22 +239,24 @@ switch_status_t sofia_on_destroy(switch_core_session_t *session)
 
        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;
 
index da9907dc5a139b6942f06ca5a88477805d9c72c4..4d9491be3aa50cf7b061cada039f066429cfc9b8 100644 (file)
@@ -934,18 +934,20 @@ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_on_execute(%p)\n
 
 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;