]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
move codec destroy to destroy method like the other channels
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 14 Apr 2009 19:03:03 +0000 (19:03 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 14 Apr 2009 19:03:03 +0000 (19:03 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@716 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/openzap/mod_openzap/mod_openzap.c

index a64cea508a783f11689325caa368a9e7aed785ea..74339be232b386fe4c8ef201701d8517fb461697 100644 (file)
@@ -116,6 +116,7 @@ typedef struct private_object private_t;
 
 static switch_status_t channel_on_init(switch_core_session_t *session);
 static switch_status_t channel_on_hangup(switch_core_session_t *session);
+static switch_status_t channel_on_destroy(switch_core_session_t *session);
 static switch_status_t channel_on_routing(switch_core_session_t *session);
 static switch_status_t channel_on_exchange_media(switch_core_session_t *session);
 static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
@@ -409,6 +410,24 @@ static switch_status_t channel_on_execute(switch_core_session_t *session)
        return SWITCH_STATUS_SUCCESS;
 }
 
+static switch_status_t channel_on_destroy(switch_core_session_t *session)
+{
+       private_t *tech_pvt = NULL;
+       
+       if ((tech_pvt = switch_core_session_get_private(session))) {
+
+               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);
+               }
+       }
+
+       return SWITCH_STATUS_SUCCESS;
+}
+
 static switch_status_t channel_on_hangup(switch_core_session_t *session)
 {
        switch_channel_t *channel = NULL;
@@ -462,14 +481,6 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session)
        }
 
        switch_clear_flag_locked(tech_pvt, TFLAG_IO);
-
-       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);
-       }
        
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel));
        switch_mutex_lock(globals.mutex);
@@ -868,7 +879,14 @@ switch_state_handler_table_t openzap_state_handlers = {
        /*.on_execute */ channel_on_execute,
        /*.on_hangup */ channel_on_hangup,
        /*.on_exchange_media */ channel_on_exchange_media,
-       /*.on_soft_execute */ channel_on_soft_execute
+       /*.on_soft_execute */ channel_on_soft_execute,
+       /*.on_consume_media */ NULL,
+    /*.on_hibernate */ NULL,
+    /*.on_reset */ NULL,
+    /*.on_park*/ NULL,
+    /*.on_reporting*/ NULL,
+    /*.on_destroy*/ channel_on_destroy
+
 };
 
 switch_io_routines_t openzap_io_routines = {