]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
update
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 30 Dec 2008 18:23:42 +0000 (18:23 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 30 Dec 2008 18:23:42 +0000 (18:23 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11005 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_iax/mod_iax.c

index 249179f3ba7db172ca65cfbc522cdab151013a66..04f26dadf2938f43bc8d0a5218d24fca6eb5aa29 100644 (file)
@@ -496,6 +496,7 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session)
 
        switch_clear_flag_locked(tech_pvt, TFLAG_IO);
        switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
+       switch_clear_flag_locked(tech_pvt, TFLAG_CODEC);
 
        if (tech_pvt->read_codec.implementation) {
                switch_core_codec_destroy(&tech_pvt->read_codec);
@@ -1079,17 +1080,16 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_iax_runtime)
                        case IAX_EVENT_VOICE:
                                if (tech_pvt && (tech_pvt->read_frame.datalen = iaxevent->datalen) != 0) {
                                        if (channel && switch_channel_get_state(channel) <= CS_HANGUP) {
-                                               int bytes, frames;
+                                               int bytes = 0, frames = 1;
 
-                                               if (!switch_test_flag(tech_pvt, TFLAG_CODEC)) {
+                                               if (!switch_test_flag(tech_pvt, TFLAG_CODEC) || !tech_pvt->read_codec.implementation) {
+                                                       switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
                                                        break;
                                                }
-
+                                               
                                                if (tech_pvt->read_codec.implementation->encoded_bytes_per_packet) {
                                                        bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_packet;
                                                        frames = (int) (tech_pvt->read_frame.datalen / bytes);
-                                               } else {
-                                                       frames = 1;
                                                }
 
                                                tech_pvt->read_frame.samples = frames * tech_pvt->read_codec.implementation->samples_per_packet;