[Freeswitch-svn] [commit] r1822 - in freeswitch/branches/stkn: conf src src/include src/mod/applications/mod_conference src/mod/codecs/mod_g711 src/mod/codecs/mod_g729 src/mod/codecs/mod_gsm src/mod/codecs/mod_ilbc src/mod/codecs/mod_l16 src/mod/codecs/mod_speex src/mod/endpoints/mod_dingaling src/mod/endpoints/mod_exosip src/mod/endpoints/mod_iax src/mod/endpoints/mod_pjsip src/mod/endpoints/mod_pjsip/pjsdp/pjsdp/build

Freeswitch SVN stkn at freeswitch.org
Mon Jul 10 20:10:01 EDT 2006


Author: stkn
Date: Mon Jul 10 20:10:00 2006
New Revision: 1822

Modified:
   freeswitch/branches/stkn/conf/freeswitch.xml
   freeswitch/branches/stkn/src/include/switch_loadable_module.h
   freeswitch/branches/stkn/src/include/switch_module_interfaces.h
   freeswitch/branches/stkn/src/mod/applications/mod_conference/mod_conference.c
   freeswitch/branches/stkn/src/mod/codecs/mod_g711/mod_g711.c
   freeswitch/branches/stkn/src/mod/codecs/mod_g729/mod_g729.c
   freeswitch/branches/stkn/src/mod/codecs/mod_gsm/mod_gsm.c
   freeswitch/branches/stkn/src/mod/codecs/mod_ilbc/mod_ilbc.c
   freeswitch/branches/stkn/src/mod/codecs/mod_l16/mod_l16.c
   freeswitch/branches/stkn/src/mod/codecs/mod_speex/mod_speex.c
   freeswitch/branches/stkn/src/mod/endpoints/mod_dingaling/mod_dingaling.c
   freeswitch/branches/stkn/src/mod/endpoints/mod_exosip/mod_exosip.c
   freeswitch/branches/stkn/src/mod/endpoints/mod_iax/mod_iax.c
   freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/Makefile
   freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip.c
   freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip.h
   freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip_sdp.c
   freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/pjsdp/pjsdp/build/Makefile
   freeswitch/branches/stkn/src/switch_channel.c
   freeswitch/branches/stkn/src/switch_loadable_module.c

Log:
Update to trunk, fix mod_pjsip after api changes.

Modified: freeswitch/branches/stkn/conf/freeswitch.xml
==============================================================================
--- freeswitch/branches/stkn/conf/freeswitch.xml	(original)
+++ freeswitch/branches/stkn/conf/freeswitch.xml	Mon Jul 10 20:10:00 2006
@@ -78,7 +78,7 @@
         <!-- <param name="ip" value="1.2.3.4"> -->
         <param name="port" value="4569"/>
         <param name="dialplan" value="XML"/>
-        <param name="codec-prefs" value="PCMU,PCMA,speex,L16"/>
+        <param name="codec-prefs" value="PCMU at 20,PCMA,speex,L16"/>
         <param name="codec-master" value="us"/>
         <param name="codec-rates" value="8"/>
       </settings>
@@ -116,7 +116,9 @@
         <param name="port" value="5060"/>
         <param name="dialplan" value="XML"/>
         <param name="dtmf-duration" value="100"/>
-        <param name="codec-prefs" value="PCMU,PCMA"/>
+        <!-- the @20 is optional number of ms you want to use.  Use it only
+        if you know the codec supports it -->
+        <param name="codec-prefs" value="PCMU at 20,PCMA at 20"/>
         <!-- Payload number to bind DTMF to-->
         <param name="rfc2833-pt" value="101"/>
         <!-- disable to trade async for more calls -->

Modified: freeswitch/branches/stkn/src/include/switch_loadable_module.h
==============================================================================
--- freeswitch/branches/stkn/src/include/switch_loadable_module.h	(original)
+++ freeswitch/branches/stkn/src/include/switch_loadable_module.h	Mon Jul 10 20:10:00 2006
@@ -171,10 +171,10 @@
   \param arraylen the max size in elements of the array
   \return the number of elements added to the array
  */
-SWITCH_DECLARE(int) switch_loadable_module_get_codecs(switch_memory_pool_t *pool, 
-													  switch_codec_interface_t **array, 
+SWITCH_DECLARE(int) switch_loadable_module_get_codecs(switch_memory_pool_t *pool, const switch_codec_implementation_t **array,
 													  int arraylen);
 
+
 /*!
   \brief Retrieve the list of loaded codecs into an array based on another array showing the sorted order
   \param array the array to populate
@@ -184,10 +184,8 @@
   \return the number of elements added to the array
   \note this function only considers codecs that are listed in the "prefs" array and ignores the rest.
 */
-SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(switch_codec_interface_t **array,
-															 int arraylen, 
-															 char **prefs, 
-															 int preflen);
+SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_implementation_t **array,
+															 int arraylen, char **prefs, int preflen);
 
 /*!
   \brief Execute a registered API command

Modified: freeswitch/branches/stkn/src/include/switch_module_interfaces.h
==============================================================================
--- freeswitch/branches/stkn/src/include/switch_module_interfaces.h	(original)
+++ freeswitch/branches/stkn/src/include/switch_module_interfaces.h	Mon Jul 10 20:10:00 2006
@@ -444,6 +444,8 @@
 
 /*! \brief A table of settings and callbacks that define a paticular implementation of a codec */
 struct switch_codec_implementation {
+	/*! enumeration defining the type of the codec */
+	const switch_codec_type_t codec_type;
 	/*! the IANA code number */
 	switch_payload_t ianacode;
 	/*! the IANA code name */
@@ -497,8 +499,6 @@
 struct switch_codec_interface {
 	/*! the name of the interface */
 	const char *interface_name;
-	/*! enumeration defining the type of the codec */
-	const switch_codec_type_t codec_type;
 	/*! a list of codec implementations related to the codec */
 	const switch_codec_implementation_t *implementations;
 	const struct switch_codec_interface *next;

Modified: freeswitch/branches/stkn/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/applications/mod_conference/mod_conference.c	(original)
+++ freeswitch/branches/stkn/src/mod/applications/mod_conference/mod_conference.c	Mon Jul 10 20:10:00 2006
@@ -676,8 +676,6 @@
 		char *digit;
 		char msg[512];
 
-		switch_core_timer_next(&timer);
-
         if (switch_channel_has_dtmf(channel)) {
             switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
         }
@@ -863,28 +861,33 @@
 						switch_buffer_zero(member->mux_buffer);
 						switch_mutex_unlock(member->audio_out_mutex);
 					}
+					switch_core_timer_next(&timer);
 				}
 			}
 		} else {
-			/* Flush the output buffer and write all the data (presumably muxed) back to the channel */
-			switch_mutex_lock(member->audio_out_mutex);
-			write_frame.data = data;
-			while ((write_frame.datalen = (uint32_t)switch_buffer_read(member->mux_buffer, write_frame.data, bytes))) {
-				if (write_frame.datalen && switch_test_flag(member, MFLAG_CAN_HEAR)) {
-					write_frame.samples = write_frame.datalen / 2;
+			if (switch_buffer_inuse(member->mux_buffer)) {
+				/* Flush the output buffer and write all the data (presumably muxed) back to the channel */
+				switch_mutex_lock(member->audio_out_mutex);
+				write_frame.data = data;
+				while ((write_frame.datalen = (uint32_t)switch_buffer_read(member->mux_buffer, write_frame.data, bytes))) {
+					if (write_frame.datalen && switch_test_flag(member, MFLAG_CAN_HEAR)) {
+						write_frame.samples = write_frame.datalen / 2;
+						
+						/* Check for output volume adjustments */
+						if (member->volume_out_level) {
+							switch_change_sln_volume(write_frame.data, write_frame.samples, member->volume_out_level);
+						}
 
-					/* Check for output volume adjustments */
-					if (member->volume_out_level) {
-						switch_change_sln_volume(write_frame.data, write_frame.samples, member->volume_out_level);
+						switch_core_session_write_frame(member->session, &write_frame, -1, 0);
 					}
-
-					switch_core_session_write_frame(member->session, &write_frame, -1, 0);
 				}
+				switch_mutex_unlock(member->audio_out_mutex);
+			} else {
+				switch_core_timer_next(&timer);
 			}
-			switch_mutex_unlock(member->audio_out_mutex);
 		}
 	} /* Rinse ... Repeat */
-
+	
 	switch_clear_flag_locked(member, MFLAG_RUNNING);
 	switch_core_timer_destroy(&timer);
 
@@ -2076,10 +2079,13 @@
 	char *mydata = switch_core_session_strdup(session, data);
 	char *conf_name = NULL;
 	char *bridge_prefix = "bridge:";
+	char *flags_prefix = "+flags{";
 	char *bridgeto = NULL;
 	char *profile_name = NULL;
 	switch_xml_t cxml = NULL, cfg = NULL, profile = NULL, profiles = NULL;
-
+	char *flags_str;
+	member_flag_t uflags = MFLAG_CAN_SPEAK | MFLAG_CAN_HEAR;
+	
 	channel = switch_core_session_get_channel(session);
     assert(channel != NULL);
 
@@ -2094,6 +2100,23 @@
 		return;
 	}
 
+
+	if ((flags_str=strstr(mydata, flags_prefix))) {
+		char *p;
+
+		*flags_str = '\0';
+		flags_str += strlen(flags_prefix);
+		if ((p = strchr(flags_str, '}'))) {
+			*p = '\0';
+		}
+
+		if (strstr(flags_str, "mute")) {
+			uflags &= ~MFLAG_CAN_SPEAK;
+		} else if (strstr(flags_str, "deaf")) {
+			uflags &= ~MFLAG_CAN_HEAR;
+		}
+	}
+
 	if (!strncasecmp(mydata, bridge_prefix, strlen(bridge_prefix))) {
 		char *uuid = switch_core_session_get_uuid(session);
 		
@@ -2210,7 +2233,7 @@
 	if (switch_core_codec_init(&member.read_codec,
 							   "L16",
 							   read_codec->implementation->samples_per_second,
-							   conference->interval,
+							   read_codec->implementation->microseconds_per_frame / 1000,
 							   1,
 							   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
 							   NULL,
@@ -2228,7 +2251,7 @@
 	if (switch_core_codec_init(&member.write_codec,
 							   "L16",
 							   read_codec->implementation->samples_per_second,
-							   conference->interval,
+							   read_codec->implementation->microseconds_per_frame / 1000,
 							   1,
 							   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
 							   NULL,
@@ -2269,7 +2292,7 @@
 	if (conference_add_member(conference, &member) != SWITCH_STATUS_SUCCESS) {
 		goto codec_done1;
 	}
-	switch_set_flag_locked((&member), MFLAG_RUNNING | MFLAG_CAN_SPEAK | MFLAG_CAN_HEAR);
+	switch_set_flag_locked((&member), MFLAG_RUNNING | uflags);
 
 	/* Run the confernece loop */
 	conference_loop(&member);

Modified: freeswitch/branches/stkn/src/mod/codecs/mod_g711/mod_g711.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/codecs/mod_g711/mod_g711.c	(original)
+++ freeswitch/branches/stkn/src/mod/codecs/mod_g711/mod_g711.c	Mon Jul 10 20:10:00 2006
@@ -190,6 +190,7 @@
 #if 0
 
 static const switch_codec_implementation_t g711u_8k_60ms_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 0,
 	/*.iananame */ "PCMU",
 	/*.samples_per_second */ 8000,
@@ -206,9 +207,10 @@
 	/*.decode */ switch_g711u_decode,
 	/*.destroy */ switch_g711u_destroy
 };
+#endif
 
-
 static const switch_codec_implementation_t g711u_8k_30ms_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 0,
 	/*.iananame */ "PCMU",
 	/*.samples_per_second */ 8000,
@@ -224,11 +226,11 @@
 	/*.encode */ switch_g711u_encode,
 	/*.decode */ switch_g711u_decode,
 	/*.destroy */ switch_g711u_destroy,
-	/*.next */ &g711u_8k_60ms_implementation
+	/*.next */ NULL
 };
-#endif
 
 static const switch_codec_implementation_t g711u_16k_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 0,
 	/*.iananame */ "PCMU",
 	/*.samples_per_second */ 16000,
@@ -244,9 +246,11 @@
 	/*.encode */ switch_g711u_encode,
 	/*.decode */ switch_g711u_decode,
 	/*.destroy */ switch_g711u_destroy,
+	/*.next */ &g711u_8k_30ms_implementation
 };
 
 static const switch_codec_implementation_t g711u_8k_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 0,
 	/*.iananame */ "PCMU",
 	/*.samples_per_second */ 8000,
@@ -267,6 +271,7 @@
 
 
 static const switch_codec_implementation_t g711a_8k_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 8,
 	/*.iananame */ "PCMA",
 	/*.samples_per_second */ 8000,
@@ -287,13 +292,11 @@
 
 static const switch_codec_interface_t g711a_codec_interface = {
 	/*.interface_name */ "g711 alaw",
-	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.implementations */ &g711a_8k_implementation
 };
 
 static const switch_codec_interface_t g711u_codec_interface = {
 	/*.interface_name */ "g711 ulaw",
-	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.implementations */ &g711u_8k_implementation,
 	/*.next */ &g711a_codec_interface
 };

Modified: freeswitch/branches/stkn/src/mod/codecs/mod_g729/mod_g729.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/codecs/mod_g729/mod_g729.c	(original)
+++ freeswitch/branches/stkn/src/mod/codecs/mod_g729/mod_g729.c	Mon Jul 10 20:10:00 2006
@@ -219,6 +219,7 @@
 /* Registration */ 
 
 static const switch_codec_implementation_t g729_10ms_8k_implementation = { 
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 	/*.ianacode */ 18, 
 	/*.iananame */ "G729", 
 	/*.samples_per_second */ 8000, 
@@ -237,6 +238,7 @@
 };
 
 static const switch_codec_implementation_t g729_8k_implementation = { 
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 	/*.ianacode */ 18, 
 	/*.iananame */ "G729", 
 	/*.samples_per_second */ 8000, 
@@ -258,7 +260,6 @@
 
 static const switch_codec_interface_t g729_codec_interface = { 
 	/*.interface_name */ "g729", 
-	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 	/*.implementations */ &g729_8k_implementation, 
 };
 

Modified: freeswitch/branches/stkn/src/mod/codecs/mod_gsm/mod_gsm.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/codecs/mod_gsm/mod_gsm.c	(original)
+++ freeswitch/branches/stkn/src/mod/codecs/mod_gsm/mod_gsm.c	Mon Jul 10 20:10:00 2006
@@ -133,6 +133,7 @@
 
 /* Registration */ 
 static const switch_codec_implementation_t gsm_8k_implementation = { 
+		/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 		/*.ianacode */ 3, 
 		/*.iananame */ "gsm", 
 		/*.samples_per_second */ 8000, 
@@ -151,7 +152,6 @@
 };
 static const switch_codec_interface_t gsm_codec_interface = { 
 		/*.interface_name */ "gsm", 
-		/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 		/*.implementations */ &gsm_8k_implementation, 
 };
 static switch_loadable_module_interface_t gsm_module_interface = { 

Modified: freeswitch/branches/stkn/src/mod/codecs/mod_ilbc/mod_ilbc.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/codecs/mod_ilbc/mod_ilbc.c	(original)
+++ freeswitch/branches/stkn/src/mod/codecs/mod_ilbc/mod_ilbc.c	Mon Jul 10 20:10:00 2006
@@ -186,6 +186,7 @@
 /* Registration */ 
 
 static const switch_codec_implementation_t ilbc_8k_30ms_implementation = { 
+		/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 		/*.ianacode */ 97, 
 		/*.iananame */ "iLBC", 
 		/*.samples_per_second */ 8000, 
@@ -204,6 +205,7 @@
 };
 
 static const switch_codec_implementation_t ilbc_8k_20ms_implementation = { 
+		/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 		/*.ianacode */ 97, 
 		/*.iananame */ "iLBC", 
 		/*.samples_per_second */ 8000, 
@@ -225,6 +227,7 @@
 
 
 static const switch_codec_implementation_t ilbc_102_8k_30ms_implementation = { 
+		/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 		/*.ianacode */ 102, 
 		/*.iananame */ "iLBC", 
 		/*.samples_per_second */ 8000, 
@@ -243,6 +246,7 @@
 };
 
 static const switch_codec_implementation_t ilbc_102_8k_20ms_implementation = { 
+		/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 		/*.ianacode */ 102, 
 		/*.iananame */ "iLBC102", 
 		/*.samples_per_second */ 8000, 
@@ -263,6 +267,7 @@
 
 
 static const switch_codec_implementation_t ilbc_8k_20ms_nonext_implementation = { 
+		/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 		/*.ianacode */ 97, 
 		/*.iananame */ "iLBC20ms",
 		/*.samples_per_second */ 8000, 
@@ -283,20 +288,17 @@
 
 static const switch_codec_interface_t ilbc_20ms_codec_interface = { 
 		/*.interface_name */ "ilbc", 
-		/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 		/*.implementations */ &ilbc_8k_20ms_nonext_implementation
 };
 
 static const switch_codec_interface_t ilbc_102_codec_interface = { 
 		/*.interface_name */ "ilbc", 
-		/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 		/*.implementations */ &ilbc_102_8k_20ms_implementation, 
 		/*.next*/ &ilbc_20ms_codec_interface
 };
 
 static const switch_codec_interface_t ilbc_codec_interface = { 
 		/*.interface_name */ "ilbc", 
-		/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 		/*.implementations */ &ilbc_8k_20ms_implementation, 
 		/*.next*/ &ilbc_102_codec_interface
 };

Modified: freeswitch/branches/stkn/src/mod/codecs/mod_l16/mod_l16.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/codecs/mod_l16/mod_l16.c	(original)
+++ freeswitch/branches/stkn/src/mod/codecs/mod_l16/mod_l16.c	Mon Jul 10 20:10:00 2006
@@ -90,6 +90,7 @@
 }
 
 static const switch_codec_implementation_t raw_32k_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 10,
 	/*.iananame */ "L16",
 	/*.samples_per_second = */ 32000,
@@ -108,6 +109,7 @@
 };
 
 static const switch_codec_implementation_t raw_22k_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 10,
 	/*.iananame */ "L16",
 	/*.samples_per_second = */ 22050,
@@ -127,6 +129,7 @@
 };
 
 static const switch_codec_implementation_t raw_16k_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 10,
 	/*.iananame */ "L16",
 	/*.samples_per_second = */ 16000,
@@ -146,6 +149,7 @@
 };
 
 static const switch_codec_implementation_t raw_8k_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 10,
 	/*.iananame */ "L16",
 	/*.samples_per_second = */ 8000,
@@ -166,6 +170,7 @@
 
 
 static const switch_codec_implementation_t raw_8k_30ms_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 10,
 	/*.iananame */ "L16",
 	/*.samples_per_second */ 8000,
@@ -186,6 +191,7 @@
 
 
 static const switch_codec_implementation_t raw_8k_60ms_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 10,
 	/*.iananame */ "L16",
 	/*.samples_per_second */ 8000,
@@ -205,6 +211,7 @@
 };
 
 static const switch_codec_implementation_t raw_8k_120ms_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 10,
 	/*.iananame */ "L16",
 	/*.samples_per_second */ 8000,
@@ -226,7 +233,6 @@
 
 static const switch_codec_interface_t raw_codec_interface = {
 	/*.interface_name */ "raw signed linear (16 bit)",
-	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.implementations */ &raw_8k_120ms_implementation
 };
 

Modified: freeswitch/branches/stkn/src/mod/codecs/mod_speex/mod_speex.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/codecs/mod_speex/mod_speex.c	(original)
+++ freeswitch/branches/stkn/src/mod/codecs/mod_speex/mod_speex.c	Mon Jul 10 20:10:00 2006
@@ -268,6 +268,7 @@
 
 /* Registration */
 static const switch_codec_implementation_t speex_32k_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 98,
 	/*.iananame */ "speex",
 	/*.samples_per_second */ 32000,
@@ -286,6 +287,7 @@
 };
 
 static const switch_codec_implementation_t speex_16k_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 98,
 	/*.iananame */ "speex",
 	/*.samples_per_second */ 16000,
@@ -305,6 +307,7 @@
 };
 
 static const switch_codec_implementation_t speex_8k_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 98,
 	/*.iananame */ "speex",
 	/*.samples_per_second */ 8000,
@@ -325,7 +328,6 @@
 
 static const switch_codec_interface_t speex_codec_interface = {
 	/*.interface_name */ "speex",
-	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.implementations */ &speex_8k_implementation
 };
 

Modified: freeswitch/branches/stkn/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/endpoints/mod_dingaling/mod_dingaling.c	(original)
+++ freeswitch/branches/stkn/src/mod/endpoints/mod_dingaling/mod_dingaling.c	Mon Jul 10 20:10:00 2006
@@ -113,7 +113,7 @@
 	switch_caller_profile_t *caller_profile;
 	unsigned short samprate;
 	switch_mutex_t *mutex;
-	switch_codec_interface_t *codecs[SWITCH_MAX_CODECS];
+	const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS];
 	unsigned int num_codecs;
 	int codec_index;
 	switch_rtp_t *rtp_session;
@@ -440,16 +440,16 @@
 	if (force || !switch_test_flag(tech_pvt, TFLAG_CODEC_READY)) {
 		if (tech_pvt->codec_index < 0) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Don't have my codec yet here's one\n");
-			tech_pvt->codec_name = lame(tech_pvt->codecs[0]->implementations->iananame);
-			tech_pvt->codec_num = tech_pvt->codecs[0]->implementations->ianacode;
+			tech_pvt->codec_name = lame(tech_pvt->codecs[0]->iananame);
+			tech_pvt->codec_num = tech_pvt->codecs[0]->ianacode;
 			tech_pvt->codec_index = 0;
 					
-			payloads[0].name = lame(tech_pvt->codecs[0]->implementations->iananame);
-			payloads[0].id = tech_pvt->codecs[0]->implementations->ianacode;
+			payloads[0].name = lame(tech_pvt->codecs[0]->iananame);
+			payloads[0].id = tech_pvt->codecs[0]->ianacode;
 			
 		} else {
-			payloads[0].name = lame(tech_pvt->codecs[tech_pvt->codec_index]->implementations->iananame);
-			payloads[0].id = tech_pvt->codecs[tech_pvt->codec_index]->implementations->ianacode;
+			payloads[0].name = lame(tech_pvt->codecs[tech_pvt->codec_index]->iananame);
+			payloads[0].id = tech_pvt->codecs[tech_pvt->codec_index]->ianacode;
 		}
 
 				
@@ -1546,22 +1546,22 @@
 				for(x = 0; x < len; x++) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Available Payload %s %u\n", payloads[x].name, payloads[x].id);
 					for(y = 0; y < tech_pvt->num_codecs; y++) {
-						char *name = tech_pvt->codecs[y]->implementations->iananame;
+						char *name = tech_pvt->codecs[y]->iananame;
 
 						if (!strncasecmp(name, "ilbc", 4)) {
 							name = "ilbc";
 						}
-						if (tech_pvt->codecs[y]->implementations->ianacode > 96) {
+						if (tech_pvt->codecs[y]->ianacode > 96) {
 							match = strcasecmp(name, payloads[x].name) ? 0 : 1;
 						} else {
-							match = (payloads[x].id == tech_pvt->codecs[y]->implementations->ianacode) ? 1 : 0;
+							match = (payloads[x].id == tech_pvt->codecs[y]->ianacode) ? 1 : 0;
 						}
 						
 						if (match) {
 							tech_pvt->codec_index = y;
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Choosing Payload index %u %s %u\n", y, payloads[x].name, payloads[x].id);
-							tech_pvt->codec_name = tech_pvt->codecs[y]->implementations->iananame;
-							tech_pvt->codec_num = tech_pvt->codecs[y]->implementations->ianacode;
+							tech_pvt->codec_name = tech_pvt->codecs[y]->iananame;
+							tech_pvt->codec_num = tech_pvt->codecs[y]->ianacode;
 							if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
 								do_describe(tech_pvt, 0);
 							}

Modified: freeswitch/branches/stkn/src/mod/endpoints/mod_exosip/mod_exosip.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/endpoints/mod_exosip/mod_exosip.c	(original)
+++ freeswitch/branches/stkn/src/mod/endpoints/mod_exosip/mod_exosip.c	Mon Jul 10 20:10:00 2006
@@ -138,7 +138,7 @@
 	int ssrc;
 	switch_time_t last_read;
 	char *realm;
-	switch_codec_interface_t *codecs[SWITCH_MAX_CODECS];
+	const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS];
 	int num_codecs;
 	switch_payload_t te;
 	switch_mutex_t *flag_mutex;
@@ -173,7 +173,13 @@
 static switch_status_t exosip_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout,
 										switch_io_flag_t flags, int stream_id);
 static int config_exosip(int reload);
-static switch_status_t parse_sdp_media(struct private_object *tech_pvt, sdp_media_t * media, char **dname, char **drate, char **dpayload);
+static switch_status_t parse_sdp_media(struct private_object *tech_pvt,
+									   sdp_media_t * media,
+									   char **dname,
+									   char **drate,
+									   char **dpayload,
+									   const switch_codec_implementation_t **impp);
+
 static switch_status_t exosip_kill_channel(switch_core_session_t *session, int sig);
 static switch_status_t activate_rtp(struct private_object *tech_pvt);
 static void deactivate_rtp(struct private_object *tech_pvt);
@@ -356,7 +362,7 @@
 			static const switch_codec_implementation_t *imp;
 
 			for (i = 0; i < tech_pvt->num_codecs; i++) {
-				imp = tech_pvt->codecs[i]->implementations;
+				imp = tech_pvt->codecs[i];
 
 				while(NULL != imp) {
 					uint32_t sps = imp->samples_per_second;
@@ -1178,6 +1184,7 @@
 		char *displayname, *username;
 		osip_header_t *tedious;
 		char *val;
+		const switch_codec_implementation_t *imp = NULL;
 
 		switch_core_session_add_stream(session, NULL);
 		if ((tech_pvt = (struct private_object *) switch_core_session_alloc(session, sizeof(struct private_object))) != 0) {
@@ -1310,10 +1317,10 @@
 
 		if (tech_pvt->num_codecs > 0) {
 			int i;
-			static const switch_codec_implementation_t *imp;
+			static const switch_codec_implementation_t *imp = NULL;
 
 			for (i = 0; i < tech_pvt->num_codecs; i++) {
-				for (imp = tech_pvt->codecs[i]->implementations; imp; imp = imp->next) {
+				for (imp = tech_pvt->codecs[i]; imp; imp = imp->next) {
 					sdp_add_codec(tech_pvt->sdp_config, tech_pvt->codecs[i]->codec_type, imp->ianacode, imp->iananame,
 								  imp->samples_per_second, 0);
 
@@ -1336,18 +1343,20 @@
 			if (audio_tab[0] == NULL && video_tab[0] == NULL && t38_tab[0] == NULL && app_tab[0] == NULL) {
 
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Got no compatible codecs!\n");
-				break;
+				goto done;
 			}
 			for (pos = 0; audio_tab[pos] != NULL; pos++) {
 				osip_rfc3264_complete_answer(tech_pvt->sdp_config, remote_sdp, tech_pvt->local_sdp, audio_tab[pos],
 											 mline);
-				if (parse_sdp_media(tech_pvt, audio_tab[pos], &dname, &drate, &dpayload) == SWITCH_STATUS_SUCCESS) {
-					tech_pvt->payload_num = atoi(dpayload);
-					break;
+				if (parse_sdp_media(tech_pvt, audio_tab[pos], &dname, &drate, &dpayload, &imp) == SWITCH_STATUS_SUCCESS) {
+					tech_pvt->payload_num = atoi(dpayload);					
+					goto done;
 				}
 			}
 			mline++;
 		}
+	done:
+
 		free(remote_sdp_str);
 		sdp_message_o_origin_set(tech_pvt->local_sdp, "FreeSWITCH", "0", "0", "IN", "IP4", ip);
 								 
@@ -1379,6 +1388,12 @@
 		{
 			int rate = atoi(drate);
 			int ms = globals.codec_ms;
+
+
+			if (imp) {
+				ms = imp->microseconds_per_frame / 1000;
+			}
+
 			if (!strcasecmp(dname, "ilbc")) {
 				ms = 30;
 			}
@@ -1485,13 +1500,19 @@
 
 }
 
-static switch_status_t parse_sdp_media(struct private_object *tech_pvt, sdp_media_t * media, char **dname, char **drate, char **dpayload)
+static switch_status_t parse_sdp_media(struct private_object *tech_pvt,
+									   sdp_media_t * media,
+									   char **dname,
+									   char **drate,
+									   char **dpayload,
+									   const switch_codec_implementation_t **impp)
 {
 	int pos = 0;
 	sdp_attribute_t *attr = NULL;
 	char *name, *payload, *rate;
 	switch_status_t status = SWITCH_STATUS_GENERR;
 	char workspace[512];
+	const switch_codec_implementation_t *imp = NULL;
 
 	while (osip_list_eol(media->a_attributes, pos) == 0) {
 		attr = (sdp_attribute_t *) osip_list_get(media->a_attributes, pos);
@@ -1521,11 +1542,9 @@
 			}
 
 			for(i = 0; !match && i < tech_pvt->num_codecs; i++) {
-				const switch_codec_implementation_t *imp;
-				
-				
-				for (imp = tech_pvt->codecs[i]->implementations; imp; imp = imp->next) {
 
+				for (imp = tech_pvt->codecs[i]; imp; imp = imp->next) {
+
 					if (pt < 97) {
 						match = (pt == imp->ianacode) ? 1 : 0;
 					} else {
@@ -1543,9 +1562,10 @@
 				*dname = strdup(name);
 				*drate = strdup(rate);
 				*dpayload = strdup(payload);
+				*impp = imp;
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Found negotiated codec Payload: %s Name: %s Rate: %s\n",
 								  *dpayload, *dname, *drate);	
-				break;
+				return SWITCH_STATUS_SUCCESS;
 			}
 
 		}
@@ -1652,8 +1672,8 @@
 	struct private_object *tech_pvt;
 	char *dpayload = NULL, *dname = NULL, *drate = NULL;
 	switch_channel_t *channel;
+	const switch_codec_implementation_t *imp = NULL;
 
-
 	if ((tech_pvt = get_pvt_by_call_id(event->cid)) == 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "cannot answer nonexistant call [%d]!\n", event->cid);
 		return;
@@ -1684,20 +1704,23 @@
 	snprintf(tech_pvt->remote_sdp_audio_ip, 50, conn->c_addr);
 
 	/* Grab codec elements */
-	if (parse_sdp_media(tech_pvt, remote_med, &dname, &drate, &dpayload) == SWITCH_STATUS_SUCCESS) {
+	if (parse_sdp_media(tech_pvt, remote_med, &dname, &drate, &dpayload, &imp) == SWITCH_STATUS_SUCCESS) {
 		tech_pvt->payload_num = atoi(dpayload);
 	}
 
 	/* Assign them thar IDs */
 	tech_pvt->did = event->did;
 	tech_pvt->tid = event->tid;
-
-
 	{
 		int rate = atoi(drate);
 		int ms = globals.codec_ms;
+
 		if (!strcasecmp(dname, "ilbc")) {
 			ms = 30;
+		}
+
+		if (imp) {
+			ms = imp->microseconds_per_frame / 1000;
 		}
 
 		if (switch_core_codec_init(&tech_pvt->read_codec,

Modified: freeswitch/branches/stkn/src/mod/endpoints/mod_iax/mod_iax.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/endpoints/mod_iax/mod_iax.c	(original)
+++ freeswitch/branches/stkn/src/mod/endpoints/mod_iax/mod_iax.c	Mon Jul 10 20:10:00 2006
@@ -213,10 +213,11 @@
 	//int rate = 8000;
 	//int codec_ms = 20;
 	switch_channel_t *channel;
-	switch_codec_interface_t *codecs[SWITCH_MAX_CODECS];
+	const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS];
 	int num_codecs = 0;
 	unsigned int local_cap = 0, mixed_cap = 0, chosen = 0, leading = 0;
 	int x, srate = 8000;
+	uint32_t interval = 0;
 
 	if (globals.codec_string) {
 		if ((num_codecs = switch_loadable_module_get_codecs_sorted(codecs,
@@ -235,7 +236,7 @@
 
 	for (x = 0; x < num_codecs; x++) {
 		static const switch_codec_implementation_t *imp;
-		for (imp = codecs[x]->implementations; imp; imp = imp->next) {
+		for (imp = codecs[x]; imp; imp = imp->next) {
 			unsigned int codec = iana2ast(imp->ianacode);
 		
 			if (io == IAX_QUERY) {
@@ -251,7 +252,7 @@
 		mixed_cap = local_cap;
 	}
 
-	leading = iana2ast(codecs[0]->implementations->ianacode);
+	leading = iana2ast(codecs[0]->ianacode);
 	if (io == IAX_QUERY) {
 		chosen = leading;
 		*format = chosen;
@@ -263,7 +264,7 @@
 		return SWITCH_STATUS_SUCCESS;
 	} else if (switch_test_flag(&globals, GFLAG_MY_CODEC_PREFS) && (leading & mixed_cap)) {
 		chosen = leading;
-		dname = codecs[0]->implementations->iananame;
+		dname = codecs[0]->iananame;
 	} else {
 		unsigned int prefs[32];
 		int len = 0;
@@ -288,9 +289,10 @@
 					chosen = prefs[x];
 					for (z = 0; z < num_codecs; z++) {
 						static const switch_codec_implementation_t *imp;
-						for (imp = codecs[z]->implementations; imp; imp = imp->next) {
+						for (imp = codecs[z]; imp; imp = imp->next) {
 							if (prefs[x] == iana2ast(imp->ianacode)) {
 								dname = imp->iananame;
+								interval = imp->microseconds_per_frame / 1000;
 								break;
 							}
 						}
@@ -303,10 +305,11 @@
 				chosen = *format;
 				for (x = 0; x < num_codecs; x++) {
 					static const switch_codec_implementation_t *imp;
-					for (imp = codecs[x]->implementations; imp; imp = imp->next) {
+					for (imp = codecs[x]; imp; imp = imp->next) {
 						unsigned int cap = iana2ast(imp->ianacode);
 						if (cap == chosen) {
 							dname = imp->iananame;
+							interval = imp->microseconds_per_frame / 1000;
 							break;
 						}
 					}
@@ -314,11 +317,12 @@
 			} else {			/* c'mon there has to be SOMETHING... */
 				for (x = 0; x < num_codecs; x++) {
 					static const switch_codec_implementation_t *imp;
-					for (imp = codecs[x]->implementations; imp; imp = imp->next) {
+					for (imp = codecs[x]; imp; imp = imp->next) {
 						unsigned int cap = iana2ast(imp->ianacode);
 						if (cap & mixed_cap) {
 							chosen = cap;
 							dname = imp->iananame;
+							interval = imp->microseconds_per_frame / 1000;
 							break;
 						}
 					}
@@ -366,7 +370,7 @@
 	if (switch_core_codec_init(&tech_pvt->read_codec,
 							   dname,
 							   srate,
-							   0,
+							   interval,
 							   1,
 							   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
 							   NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
@@ -376,7 +380,7 @@
 		if (switch_core_codec_init(&tech_pvt->write_codec,
 								   dname,
 								   srate,
-								   0,
+								   interval,
 								   1,
 								   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
 								   NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {

Modified: freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/Makefile
==============================================================================
--- freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/Makefile	(original)
+++ freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/Makefile	Mon Jul 10 20:10:00 2006
@@ -50,7 +50,7 @@
 
 clean:
 	rm -fr *.$(DYNAMIC_LIB_EXTEN) *.o *~
-	$(MAKE) -C pjsdp clean
+	$(MAKE) -C pjsdp realclean
 
 install:
 	cp -f $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(DESTDIR)$(PREFIX)/mod

Modified: freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip.c	(original)
+++ freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip.c	Mon Jul 10 20:10:00 2006
@@ -864,7 +864,6 @@
 	struct pjsip_tech_pvt *pvt;
 	const pjmedia_sdp_session *remote_sdp, *local_sdp;
 	pj_pool_t *pool;
-	const switch_codec_interface_t *codec;
 	const switch_codec_implementation_t *imp;
 	switch_channel_t *channel;
 	switch_core_session_t *session;
@@ -936,7 +935,7 @@
 	}
 
 	/* retrieve stream (= codec) information */
-	status = mod_pjsip_codec_from_sdp( pvt, pool, local_sdp, remote_sdp, 0, &codec, &imp );
+	status = mod_pjsip_codec_from_sdp( pvt, pool, local_sdp, remote_sdp, 0, &imp );
 	if( status != PJ_SUCCESS ) {
 		/* No valid codec found */
 		switch_log_printf( SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SDP negotation failed, codec unknown\n" );
@@ -950,10 +949,10 @@
 	rate = imp->bits_per_second / 8;
 	  ms = imp->microseconds_per_frame / 1000;
 
-	switch_log_printf( SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Codec %s, rate: %d, ms per frame: %d\n", codec->implementations->iananame, rate, ms );
+	switch_log_printf( SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Codec %s, rate: %d, ms per frame: %d\n", imp->iananame, rate, ms );
 
 	/* initialize codecs */
-	ret = switch_core_codec_init(&pvt->read_codec, codec->implementations->iananame, rate, ms, 1,
+	ret = switch_core_codec_init(&pvt->read_codec, imp->iananame, rate, ms, 1,
 				SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
 				NULL, switch_core_session_get_pool( session ));
 
@@ -963,7 +962,7 @@
 		return;
 	}
 
-	ret = switch_core_codec_init(&pvt->write_codec, codec->implementations->iananame, rate, ms, 1,
+	ret = switch_core_codec_init(&pvt->write_codec, imp->iananame, rate, ms, 1,
 				SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
 				NULL, switch_core_session_get_pool( session ));
 
@@ -992,7 +991,7 @@
 		strncpy( pvt->remote_sdp_audio_addr, pj_inet_ntoa( tmp_addr ), 
 				sizeof(pvt->remote_sdp_audio_addr) );
 	}
-	switch_log_printf( SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Codec %s, %s:%d\n", codec->implementations->iananame, pvt->remote_sdp_audio_addr, pvt->remote_sdp_audio_port );
+	switch_log_printf( SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Codec %s, %s:%d\n", imp->iananame, pvt->remote_sdp_audio_addr, pvt->remote_sdp_audio_port );
 
 	/* start rtp */
 	start_rtp( pvt );
@@ -1113,20 +1112,20 @@
 		for( i = 0; i < pvt->num_codecs; i++ ) {
 			const switch_codec_implementation_t *imp = NULL;
 
-			imp = pvt->codecs[i]->implementations;
+			imp = pvt->codecs[i];
 
 			/* add all incarnations of this codec... */
 			while( imp != NULL ) {
 				char tmp[10];
 
 				/* copy codec id */
-				sprintf( tmp, "%d", pvt->codecs[i]->implementations->ianacode );
+				sprintf( tmp, "%d", pvt->codecs[i]->ianacode );
 				pj_strdup2( pool, &media->desc.fmt[media->desc.fmt_count], tmp );
 
 				/* other codec parameters */
 				rtpmap.pt = media->desc.fmt[media->desc.fmt_count];
 				rtpmap.clock_rate = imp->samples_per_second;
-				rtpmap.enc_name = pj_str( pvt->codecs[i]->implementations->iananame );
+				rtpmap.enc_name = pj_str( pvt->codecs[i]->iananame );
 				rtpmap.param.slen = 0;
 
 				/* add codec implementation to attr list */

Modified: freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip.h
==============================================================================
--- freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip.h	(original)
+++ freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip.h	Mon Jul 10 20:10:00 2006
@@ -28,7 +28,7 @@
 	/* codec information */
 	switch_codec_t read_codec;
 	switch_codec_t write_codec;
-	switch_codec_interface_t *codecs[SWITCH_MAX_CODECS];
+	const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS];
 	int num_codecs;
 
 	switch_frame_t read_frame;
@@ -42,8 +42,7 @@
 					const pjmedia_sdp_session *local,
 					const pjmedia_sdp_session *remote,
 					const unsigned int stream_idx,
-					const switch_codec_interface_t **codec,
-					const switch_codec_implementation_t **imp );
+					const switch_codec_implementation_t **codec_imp );
 
 /*
  * Get address from sdp

Modified: freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip_sdp.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip_sdp.c	(original)
+++ freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip_sdp.c	Mon Jul 10 20:10:00 2006
@@ -46,26 +46,23 @@
 				struct pjsip_tech_pvt *pvt,
 				unsigned int pt,
 				unsigned int clock_rate,
-				const switch_codec_interface_t **codec,
-				const switch_codec_implementation_t **imp )
+				const switch_codec_implementation_t **codec_imp )
 {
 	const switch_codec_implementation_t *tmp_imp;
 	int i;
 
-	assert( codec != NULL );
 	assert( pvt != NULL );
-	assert( imp != NULL );
+	assert( codec_imp != NULL );
 
 	tmp_imp = NULL;
 	for( i = 0; i < pvt->num_codecs; i++ ) {
-		if( pvt->codecs[i]->implementations->ianacode == pt ) {
+		if( pvt->codecs[i]->ianacode == pt ) {
 			/* codec found, find implementation too */
-			tmp_imp = pvt->codecs[i]->implementations;
+			tmp_imp = pvt->codecs[i];
 
 			while( tmp_imp != NULL ) {
 				if ( tmp_imp->samples_per_second == clock_rate ) {
-					*codec = pvt->codecs[i];
-					*imp = tmp_imp;
+					*codec_imp = tmp_imp;
 					return PJ_SUCCESS;
 				}
 
@@ -83,8 +80,7 @@
 						const pjmedia_sdp_session *local,
 						const pjmedia_sdp_session *remote,
 						const unsigned int stream_idx,
-						const switch_codec_interface_t **codec,
-						const switch_codec_implementation_t **imp )
+						const switch_codec_implementation_t **codec_imp )
 {
 	const pjmedia_sdp_attr *attr;
 	const pjmedia_sdp_media *local_m;
@@ -92,14 +88,12 @@
 	pjmedia_sdp_rtpmap *rtpmap;
 	unsigned int pt;
 	pj_status_t status;
-//	const switch_codec_implementation_t *tmp_imp;
 
 	assert( pvt != NULL );
 	assert( pool != NULL );
 	assert( local != NULL );
 	assert( remote != NULL );
-	assert( codec != NULL );
-	assert( imp != NULL );
+	assert( codec_imp != NULL );
 
 	assert( stream_idx < local->media_count );
 	assert( stream_idx < remote->media_count );
@@ -140,14 +134,14 @@
 
 		/* Build codec format info: */
 		if (has_rtpmap) {
-			status = find_codec( pvt, pt, rtpmap->clock_rate, codec, imp );
+			status = find_codec( pvt, pt, rtpmap->clock_rate, codec_imp );
 			if( status != PJ_SUCCESS )
 				return PJ_ENOTFOUND;
 		} else {
 			/*
 			 * No rtpmap, use default clock_rate (8000 Hz)
 			 */
-			status = find_codec( pvt, pt, 8000, codec, imp );
+			status = find_codec( pvt, pt, 8000, codec_imp );
 			if( status != PJ_SUCCESS )
 				return PJ_ENOTFOUND;
 		}
@@ -165,7 +159,6 @@
 					pj_sockaddr *addr )
 {
 	const pjmedia_sdp_media *m;
-//	const pjmedia_sdp_attr *attr;
 	const pjmedia_sdp_conn *conn;
 	pj_sockaddr_in *ip4addr;
 
@@ -202,7 +195,6 @@
 					int *dir )
 {
 	const pjmedia_sdp_media *m;
-//	const pjmedia_sdp_attr *attr;
 	const pjmedia_sdp_conn *conn;
 
 	assert( sdp != NULL );
@@ -247,7 +239,6 @@
 					int *type )
 {
 	const pjmedia_sdp_media *m;
-//	const pjmedia_sdp_attr *attr;
 
 	assert( sdp != NULL );
 	assert( type != NULL );

Modified: freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/pjsdp/pjsdp/build/Makefile
==============================================================================
--- freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/pjsdp/pjsdp/build/Makefile	(original)
+++ freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/pjsdp/pjsdp/build/Makefile	Mon Jul 10 20:10:00 2006
@@ -64,7 +64,6 @@
 
 realclean:
 	$(subst @@,$(subst /,$(HOST_PSEP),.pjsdp-$(TARGET_NAME).depend),$(HOST_RMR))
-	
 	$(MAKE) -f $(RULES_MAK) APP=PJSDP app=pjsdp $@
 
 depend:

Modified: freeswitch/branches/stkn/src/switch_channel.c
==============================================================================
--- freeswitch/branches/stkn/src/switch_channel.c	(original)
+++ freeswitch/branches/stkn/src/switch_channel.c	Mon Jul 10 20:10:00 2006
@@ -849,6 +849,10 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
+	if (switch_channel_test_flag(channel, CF_ANSWERED)) {
+		return SWITCH_STATUS_SUCCESS;
+	}
+
 	msg.message_id = SWITCH_MESSAGE_INDICATE_PROGRESS;
 	msg.from = channel->name;
 	status = switch_core_session_message_send(uuid, &msg);

Modified: freeswitch/branches/stkn/src/switch_loadable_module.c
==============================================================================
--- freeswitch/branches/stkn/src/switch_loadable_module.c	(original)
+++ freeswitch/branches/stkn/src/switch_loadable_module.c	Mon Jul 10 20:10:00 2006
@@ -633,16 +633,18 @@
 	return switch_core_hash_find(loadable_modules.directory_hash, name);
 }
 
-SWITCH_DECLARE(int) switch_loadable_module_get_codecs(switch_memory_pool_t *pool, switch_codec_interface_t **array,
+SWITCH_DECLARE(int) switch_loadable_module_get_codecs(switch_memory_pool_t *pool, const switch_codec_implementation_t **array,
 													  int arraylen)
 {
 	switch_hash_index_t *hi;
 	void *val;
+	switch_codec_interface_t *codec_interface;
 	int i = 0;
 
 	for (hi = switch_hash_first(pool, loadable_modules.codec_hash); hi; hi = switch_hash_next(hi)) {
 		switch_hash_this(hi, NULL, NULL, &val);
-		array[i++] = val;
+		codec_interface = (switch_codec_interface_t *) val;
+		array[i++] = codec_interface->implementations;
 		if (i > arraylen) {
 			break;
 		}
@@ -652,20 +654,44 @@
 
 }
 
-SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(switch_codec_interface_t **array,
+SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_implementation_t **array,
 															 int arraylen, char **prefs, int preflen)
 {
 	int x, i = 0;
 	switch_codec_interface_t *codec_interface;
+	const switch_codec_implementation_t *imp;
 
-	for (x = 0; x < preflen; x++) {
-		if ((codec_interface = switch_loadable_module_get_codec_interface(prefs[x])) != 0 ) {
-			array[i++] = codec_interface;
-			if (i > arraylen) {
-				break;
+    for (x = 0; x < preflen; x++) {
+        char *name, *p, buf[128];
+        uint32_t interval = 0, len = 0;
+
+        name = prefs[x];
+        if ((p = strchr(name, '@'))) {
+            p++;
+            len = p-name;
+
+            if (len > sizeof(buf)) {
+                len = sizeof(buf);
+            }
+            switch_copy_string(buf, name, len);
+            *(buf + len) = '\0';
+            interval = atoi(p);
+            name = buf;
+        }
+
+        if ((codec_interface = switch_loadable_module_get_codec_interface(name)) != 0 ) {
+			for (imp = codec_interface->implementations; imp; imp = imp->next) {
+				if (!interval) {
+					array[i++] = imp;
+				} else if ((imp->microseconds_per_frame / 1000) == interval) {
+					array[i++] = imp;
+				}
 			}
-		}
-	}
+            if (i > arraylen) {
+                break;
+            }
+        }
+    }
 
 	return i;
 }



More information about the Freeswitch-svn mailing list