[Freeswitch-svn] [commit] r10447 - in freeswitch/trunk/src: . include mod/endpoints/mod_sofia

FreeSWITCH SVN anthm at freeswitch.org
Tue Nov 18 15:26:26 PST 2008


Author: anthm
Date: Tue Nov 18 18:26:25 2008
New Revision: 10447

Log:
update

Modified:
   freeswitch/trunk/src/include/switch_rtp.h
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
   freeswitch/trunk/src/switch_rtp.c

Modified: freeswitch/trunk/src/include/switch_rtp.h
==============================================================================
--- freeswitch/trunk/src/include/switch_rtp.h	(original)
+++ freeswitch/trunk/src/include/switch_rtp.h	Tue Nov 18 18:26:25 2008
@@ -111,7 +111,7 @@
 SWITCH_DECLARE(switch_port_t) switch_rtp_request_port(const char *ip);
 SWITCH_DECLARE(void) switch_rtp_release_port(const char *ip, switch_port_t port);
 
-SWITCH_DECLARE(void) switch_rtp_change_interval(switch_rtp_t *rtp_session, uint32_t ms_per_packet, uint32_t samples_per_interval);
+SWITCH_DECLARE(switch_status_t) switch_rtp_change_interval(switch_rtp_t *rtp_session, uint32_t ms_per_packet, uint32_t samples_per_interval);
 /*! 
   \brief create a new RTP session handle
   \param new_rtp_session a poiter to aim at the new session

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	Tue Nov 18 18:26:25 2008
@@ -757,9 +757,12 @@
 											tech_pvt->read_codec.implementation->samples_per_packet;
 									}
 									
-									switch_rtp_change_interval(tech_pvt->rtp_session, 
-															   tech_pvt->read_codec.implementation->samples_per_packet,
-															   tech_pvt->codec_ms * 1000);
+									if (switch_rtp_change_interval(tech_pvt->rtp_session, 
+																   tech_pvt->read_codec.implementation->samples_per_packet,
+																   tech_pvt->codec_ms * 1000) != SWITCH_STATUS_SUCCESS) {
+										switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+										
+									}
 
 									tech_pvt->check_frames = MAX_CODEC_CHECK_FRAMES;
 								}

Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c	(original)
+++ freeswitch/trunk/src/switch_rtp.c	Tue Nov 18 18:26:25 2008
@@ -754,7 +754,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(void) switch_rtp_change_interval(switch_rtp_t *rtp_session, uint32_t ms_per_packet, uint32_t samples_per_interval)
+SWITCH_DECLARE(switch_status_t) switch_rtp_change_interval(switch_rtp_t *rtp_session, uint32_t ms_per_packet, uint32_t samples_per_interval)
 {
 	rtp_session->ms_per_packet = ms_per_packet;
 	rtp_session->samples_per_interval = rtp_session->conf_samples_per_interval = samples_per_interval;
@@ -764,11 +764,19 @@
 		if (rtp_session->timer.timer_interface) {
 			switch_core_timer_destroy(&rtp_session->timer);
 		}
-		switch_core_timer_init(&rtp_session->timer, rtp_session->timer_name, ms_per_packet / 1000, samples_per_interval, rtp_session->pool);
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
-						  "RE-Starting timer [%s] %d bytes per %dms\n", rtp_session->timer_name, samples_per_interval, ms_per_packet);
+		if (switch_core_timer_init(&rtp_session->timer, 
+								   rtp_session->timer_name, ms_per_packet / 1000, samples_per_interval, rtp_session->pool) == SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
+							  "RE-Starting timer [%s] %d bytes per %dms\n", rtp_session->timer_name, samples_per_interval, ms_per_packet);
+		} else {
+			memset(&rtp_session->timer, 0, sizeof(rtp_session->timer));
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+							  "Problem RE-Starting timer [%s] %d bytes per %dms\n", rtp_session->timer_name, samples_per_interval, ms_per_packet);
+			return SWITCH_STATUS_FALSE;
+		}
 	}
 		
+	return SWITCH_STATUS_SUCCESS;
 }
 
 SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session,



More information about the Freeswitch-svn mailing list