[Freeswitch-svn] [commit] r11005 - freeswitch/trunk/src/mod/endpoints/mod_iax

FreeSWITCH SVN anthm at freeswitch.org
Tue Dec 30 10:23:42 PST 2008


Author: anthm
Date: Tue Dec 30 13:23:42 2008
New Revision: 11005

Log:
update

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c

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	Tue Dec 30 13:23:42 2008
@@ -496,6 +496,7 @@
 
 	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 @@
 			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;



More information about the Freeswitch-svn mailing list