[Freeswitch-svn] [commit] r4467 - in freeswitch/trunk/src: . mod/codecs/mod_g729 mod/endpoints/mod_sofia

Freeswitch SVN anthm at freeswitch.org
Wed Mar 7 15:06:16 EST 2007


Author: anthm
Date: Wed Mar  7 15:06:15 2007
New Revision: 4467

Modified:
   freeswitch/trunk/src/mod/codecs/mod_g729/mod_g729.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
   freeswitch/trunk/src/switch_rtp.c

Log:
sigh

Modified: freeswitch/trunk/src/mod/codecs/mod_g729/mod_g729.c
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_g729/mod_g729.c	(original)
+++ freeswitch/trunk/src/mod/codecs/mod_g729/mod_g729.c	Wed Mar  7 15:06:15 2007
@@ -214,10 +214,10 @@
 
 			}
 		} 
-	} //else {
-	//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "yo this frame is an odd size [%d]\n", encoded_data_len);
-		//return SWITCH_STATUS_FALSE;
-	//}
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "yo this frame is an odd size [%d]\n", encoded_data_len);
+		return SWITCH_STATUS_FALSE;
+	}
 	return SWITCH_STATUS_SUCCESS;
 #endif
 }

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	Wed Mar  7 15:06:15 2007
@@ -750,10 +750,6 @@
 		snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->te);
 	}
 
-	if (tech_pvt->read_codec.implementation->samples_per_second == 8000) {
-		tech_pvt->cng_pt = SWITCH_RTP_CNG_PAYLOAD;
-	}
-
 	if (tech_pvt->cng_pt) {
 		snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->cng_pt);
 	}
@@ -880,13 +876,13 @@
 	tech_pvt->profile = profile;
 	if (tech_pvt->bte) {
 		tech_pvt->te = tech_pvt->bte;
-	} else {
+	} else if (!tech_pvt->te) {
 		tech_pvt->te = profile->te;
 	}
 
 	if (tech_pvt->bcng_pt) {
 		tech_pvt->cng_pt = tech_pvt->bcng_pt;
-	} else {
+	} else if (!tech_pvt->cng_pt) {
 		tech_pvt->cng_pt = profile->cng_pt;
 	}
 
@@ -1629,6 +1625,7 @@
 
 		switch_rtp_set_telephony_event(tech_pvt->rtp_session, tech_pvt->te);
 		if (tech_pvt->cng_pt) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "WTF %d", tech_pvt->cng_pt);
 			switch_rtp_set_cng_pt(tech_pvt->rtp_session, tech_pvt->cng_pt);
 		}
 		
@@ -1829,7 +1826,7 @@
 			if (tech_pvt->read_frame.datalen > 0) {
                 size_t bytes = 0;
                 int frames = 1;
-				//tech_pvt->last_read = switch_time_now();
+
                 if (!switch_test_flag((&tech_pvt->read_frame), SFF_CNG)) {
                     if ((bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame)) {
                         frames = (tech_pvt->read_frame.datalen / bytes);
@@ -2390,7 +2387,7 @@
 static uint8_t negotiate_sdp(switch_core_session_t *session, sdp_session_t *sdp)
 {
 	uint8_t match = 0;
-	switch_payload_t te = 0;
+	switch_payload_t te = 0, cng_pt = 0;
 	private_object_t *tech_pvt;
 	sdp_media_t *m;
 	sdp_attribute_t *a;
@@ -2449,10 +2446,16 @@
 
 				if (!te && !strcasecmp(map->rm_encoding, "telephone-event")) {
 					te = tech_pvt->te = (switch_payload_t)map->rm_pt;
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set 2833 dtmf payload to %u\n", te);
 				}
 
+				if (!cng_pt && !strcasecmp(map->rm_encoding, "CN")) {
+					cng_pt = tech_pvt->cng_pt = (switch_payload_t)map->rm_pt;
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set comfort noise payload to %u\n", cng_pt);
+				}
+				
 				if (match) {
-					if (te) {
+					if (te && cng_pt) {
 						break;
 					}
 					continue;
@@ -5305,7 +5308,7 @@
 				}
 
                 if (!profile->cng_pt) {
-					profile->cng_pt = 127;
+					profile->cng_pt = SWITCH_RTP_CNG_PAYLOAD;
 				}
 
                 if (!profile->sipip) {

Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c	(original)
+++ freeswitch/trunk/src/switch_rtp.c	Wed Mar  7 15:06:15 2007
@@ -779,6 +779,10 @@
 			switch_core_timer_step(&rtp_session->timer);
 		}
 		
+		if (rtp_session->recv_msg.header.pt == rtp_session->cng_pt) {
+			*flags |= SFF_CNG;
+		}
+
 		if (!bytes && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_BREAK)) {
 			switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_BREAK);
 



More information about the Freeswitch-svn mailing list