[Freeswitch-svn] [commit] r4498 - in freeswitch/trunk: libs/libdingaling/src src src/include src/mod/applications/mod_conference src/mod/endpoints/mod_dingaling src/mod/endpoints/mod_iax src/mod/endpoints/mod_portaudio src/mod/endpoints/mod_sofia src/mod/endpoints/mod_wanpipe src/mod/endpoints/mod_woomera

Freeswitch SVN anthm at freeswitch.org
Fri Mar 9 18:51:53 EST 2007


Author: anthm
Date: Fri Mar  9 18:51:52 2007
New Revision: 4498

Modified:
   freeswitch/trunk/libs/libdingaling/src/libdingaling.c
   freeswitch/trunk/libs/libdingaling/src/libdingaling.h
   freeswitch/trunk/src/include/switch_types.h
   freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
   freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
   freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c
   freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
   freeswitch/trunk/src/mod/endpoints/mod_portaudio/pablio.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
   freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
   freeswitch/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c
   freeswitch/trunk/src/switch_core.c
   freeswitch/trunk/src/switch_ivr.c
   freeswitch/trunk/src/switch_rtp.c

Log:
cleanup some stuff

Modified: freeswitch/trunk/libs/libdingaling/src/libdingaling.c
==============================================================================
--- freeswitch/trunk/libs/libdingaling/src/libdingaling.c	(original)
+++ freeswitch/trunk/libs/libdingaling/src/libdingaling.c	Fri Mar  9 18:51:52 2007
@@ -1618,7 +1618,7 @@
 	return handle->private_info;
 }
 
-void *ldl_handle_get_login(ldl_handle_t *handle)
+char *ldl_handle_get_login(ldl_handle_t *handle)
 {
 	return handle->login;
 }

Modified: freeswitch/trunk/libs/libdingaling/src/libdingaling.h
==============================================================================
--- freeswitch/trunk/libs/libdingaling/src/libdingaling.h	(original)
+++ freeswitch/trunk/libs/libdingaling/src/libdingaling.h	Fri Mar  9 18:51:52 2007
@@ -372,7 +372,7 @@
   \param handle the conection handle
   \return the requested data
 */
-void *ldl_handle_get_login(ldl_handle_t *handle);
+char *ldl_handle_get_login(ldl_handle_t *handle);
 
 /*!
   \brief Send a message to a session

Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h	(original)
+++ freeswitch/trunk/src/include/switch_types.h	Fri Mar  9 18:51:52 2007
@@ -247,7 +247,7 @@
 SWITCH_DECLARE_DATA extern switch_directories SWITCH_GLOBAL_dirs;
 
 #define SWITCH_THREAD_STACKSIZE 240 * 1024
-#define SWITCH_RECCOMMENDED_BUFFER_SIZE 3968
+#define SWITCH_RECOMMENDED_BUFFER_SIZE 3968
 #define SWITCH_MAX_CODECS 30
 #define SWITCH_MAX_STATE_HANDLERS 30
 #define SWITCH_TRUE 1

Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	Fri Mar  9 18:51:52 2007
@@ -1442,7 +1442,7 @@
 {
 	switch_channel_t *channel;
 	switch_frame_t write_frame = {0};
-	uint8_t data[SWITCH_RECCOMMENDED_BUFFER_SIZE];
+	uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
 	switch_timer_t timer = {0};
 	switch_codec_t *read_codec = switch_core_session_get_read_codec(member->session);
 	uint32_t interval = read_codec->implementation->microseconds_per_frame / 1000;
@@ -1725,7 +1725,7 @@
 static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *thread, void *obj)
 {
 	switch_frame_t write_frame = {0};
-	uint8_t data[SWITCH_RECCOMMENDED_BUFFER_SIZE];
+	uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
 	switch_file_handle_t fh = {0};
 	conference_member_t smember = {0}, *member;
 	conference_record_t *rec = (conference_record_t *) obj;

Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c	Fri Mar  9 18:51:52 2007
@@ -2739,7 +2739,7 @@
 	case LDL_SIGNAL_ERROR:
 	case LDL_SIGNAL_TERMINATE:
 		if (channel) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "hungup %s %u %d\n", switch_channel_get_name(channel));
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "hungup %s\n", switch_channel_get_name(channel));
 			terminate_session(&session,  __LINE__, SWITCH_CAUSE_NORMAL_CLEARING);
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "End Call\n");
 			goto done;

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	Fri Mar  9 18:51:52 2007
@@ -86,7 +86,7 @@
 	switch_codec_t read_codec;
 	switch_codec_t write_codec;
 	switch_frame_t read_frame;
-	unsigned char databuf[SWITCH_RECCOMMENDED_BUFFER_SIZE];
+	unsigned char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
 	switch_core_session_t *session;
 	struct iax_session *iax_session;
 	switch_caller_profile_t *caller_profile;

Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c	Fri Mar  9 18:51:52 2007
@@ -82,7 +82,7 @@
     switch_file_handle_t fh;
     switch_file_handle_t *hfh;
 	switch_frame_t hold_frame;
-    unsigned char holdbuf[SWITCH_RECCOMMENDED_BUFFER_SIZE];
+    unsigned char holdbuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
 	switch_codec_t write_codec;
     switch_timer_t timer;
     struct private_object *next;
@@ -115,8 +115,8 @@
 	switch_codec_t write_codec;
 	switch_frame_t read_frame;
     switch_frame_t cng_frame;
-	unsigned char databuf[SWITCH_RECCOMMENDED_BUFFER_SIZE];
-	unsigned char cngbuf[SWITCH_RECCOMMENDED_BUFFER_SIZE];
+	unsigned char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
+	unsigned char cngbuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
     private_t *call_list;
     int ring_interval;
     GFLAGS flags;

Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/pablio.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_portaudio/pablio.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/pablio.c	Fri Mar  9 18:51:52 2007
@@ -206,7 +206,6 @@
     long   bytesPerSample;
     PaError err;
     PABLIO_Stream *aStream;
-    long   minNumBuffers;
     long   numFrames;
 	long numBytes;
 	int channels = 1;

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	Fri Mar  9 18:51:52 2007
@@ -608,7 +608,7 @@
 			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "user", "%s", argv[1]);
 			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "host", "%s", argv[2]);
 			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "contact", "%s", argv[3]);
-			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "expires", "%d", argv[4]);
+			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "expires", "%s", argv[4]);
 			switch_event_fire(&s_event);
 		}
 	}
@@ -1530,7 +1530,7 @@
 			int ms;
 			tech_pvt->read_frame.rate = tech_pvt->rm_rate;
 			ms = tech_pvt->write_codec.implementation->microseconds_per_frame / 1000;
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Set Codec %s %s/%d %d ms\n",
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Set Codec %s %s/%ld %d ms\n",
 							  switch_channel_get_name(channel),
 							  tech_pvt->rm_encoding, tech_pvt->rm_rate, tech_pvt->codec_ms);
 			tech_pvt->read_frame.codec = &tech_pvt->read_codec;
@@ -5205,7 +5205,7 @@
 	if ((profiles = switch_xml_child(cfg, "profiles"))) {
 		for (xprofile = switch_xml_child(profiles, "profile"); xprofile; xprofile = xprofile->next) {
 			if (!(settings = switch_xml_child(xprofile, "settings"))) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Settings, check the new config!\n", cf);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Settings, check the new config!\n");
 			} else {
 				char *xprofilename = (char *) switch_xml_attr_soft(xprofile, "name");
 				switch_memory_pool_t *pool = NULL;

Modified: freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c	Fri Mar  9 18:51:52 2007
@@ -146,8 +146,8 @@
 	switch_core_session_t *session;
 	switch_codec_t read_codec;
 	switch_codec_t write_codec;
-	unsigned char databuf[SWITCH_RECCOMMENDED_BUFFER_SIZE];
-	unsigned char auxbuf[SWITCH_RECCOMMENDED_BUFFER_SIZE];
+	unsigned char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
+	unsigned char auxbuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
 	struct sangoma_pri *spri;
 	sangoma_api_hdr_t hdrframe;
 	switch_caller_profile_t *caller_profile;

Modified: freeswitch/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c	Fri Mar  9 18:51:52 2007
@@ -137,7 +137,7 @@
 	switch_pollfd_t *read_poll;
 	switch_pollfd_t *write_poll;
 	switch_pollfd_t *command_poll;
-	char databuf[SWITCH_RECCOMMENDED_BUFFER_SIZE];
+	char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
 	switch_mutex_t *iolock;
 	switch_sockaddr_t *udpread;
 	switch_sockaddr_t *udpwrite;

Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c	(original)
+++ freeswitch/trunk/src/switch_core.c	Fri Mar  9 18:51:52 2007
@@ -115,14 +115,14 @@
 	switch_buffer_t *raw_write_buffer;
 	switch_frame_t raw_write_frame;
 	switch_frame_t enc_write_frame;
-	uint8_t raw_write_buf[SWITCH_RECCOMMENDED_BUFFER_SIZE];
-	uint8_t enc_write_buf[SWITCH_RECCOMMENDED_BUFFER_SIZE];
+	uint8_t raw_write_buf[SWITCH_RECOMMENDED_BUFFER_SIZE];
+	uint8_t enc_write_buf[SWITCH_RECOMMENDED_BUFFER_SIZE];
 
 	switch_buffer_t *raw_read_buffer;
 	switch_frame_t raw_read_frame;
 	switch_frame_t enc_read_frame;
-	uint8_t raw_read_buf[SWITCH_RECCOMMENDED_BUFFER_SIZE];
-	uint8_t enc_read_buf[SWITCH_RECCOMMENDED_BUFFER_SIZE];
+	uint8_t raw_read_buf[SWITCH_RECOMMENDED_BUFFER_SIZE];
+	uint8_t enc_read_buf[SWITCH_RECOMMENDED_BUFFER_SIZE];
 
 
 	switch_audio_resampler_t *read_resampler;
@@ -222,7 +222,7 @@
 SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *bug, switch_frame_t *frame)
 {
 	uint32_t bytes = 0;
-	uint8_t data[SWITCH_RECCOMMENDED_BUFFER_SIZE] = {0};
+	uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0};
 	uint32_t datalen = 0;
 	int16_t *dp, *fp;
 	uint32_t x;

Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c	(original)
+++ freeswitch/trunk/src/switch_ivr.c	Fri Mar  9 18:51:52 2007
@@ -554,11 +554,11 @@
 static void record_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
 {
 	switch_file_handle_t *fh = (switch_file_handle_t *) user_data;
-	uint8_t data[SWITCH_RECCOMMENDED_BUFFER_SIZE];
+	uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
 	switch_frame_t frame = {0};
 
 	frame.data = data;
-	frame.buflen = SWITCH_RECCOMMENDED_BUFFER_SIZE;
+	frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
 	
 	switch(type) {
 	case SWITCH_ABC_TYPE_INIT:
@@ -696,14 +696,14 @@
 static void inband_dtmf_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
 {
 	switch_inband_dtmf_t *pvt = (switch_inband_dtmf_t *) user_data;
-	uint8_t data[SWITCH_RECCOMMENDED_BUFFER_SIZE];
+	uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
 	switch_frame_t frame = {0};
 	char digit_str[80];
 	switch_channel_t *channel = switch_core_session_get_channel(pvt->session);
 
 	assert(channel != NULL);
 	frame.data = data;
-	frame.buflen = SWITCH_RECCOMMENDED_BUFFER_SIZE;
+	frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
 
 	switch(type) {
 		case SWITCH_ABC_TYPE_INIT:
@@ -854,12 +854,12 @@
 static void speech_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
 {
 	struct speech_thread_handle *sth = (struct speech_thread_handle *) user_data;
-	uint8_t data[SWITCH_RECCOMMENDED_BUFFER_SIZE];
+	uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
 	switch_frame_t frame = {0};
 	switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE;
 
 	frame.data = data;
-	frame.buflen = SWITCH_RECCOMMENDED_BUFFER_SIZE;
+	frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
 	
 	switch(type) {
 	case SWITCH_ABC_TYPE_INIT: {
@@ -3375,13 +3375,19 @@
 		}
 	}
 
-
-	if ((uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
+	
+	if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
 		switch_channel_t *other_channel = NULL;
 
 		other_channel = switch_core_session_get_channel(other_session);
 		assert(other_channel != NULL);
 
+		switch_channel_set_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
+		switch_channel_set_variable(other_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
+
+		switch_channel_set_variable(channel, SWITCH_BRIDGE_VARIABLE, NULL);
+		switch_channel_set_variable(other_channel, SWITCH_BRIDGE_VARIABLE, NULL);
+
 		switch_channel_hangup(other_channel, switch_channel_get_cause(channel));
 		switch_core_session_rwunlock(other_session);
 	}
@@ -3412,8 +3418,21 @@
 	peer_channel = switch_core_session_get_channel(peer_session);
 	assert(peer_channel != NULL);
 
-	switch_channel_set_flag(caller_channel, CF_ORIGINATOR);
+	if (!switch_channel_ready(peer_channel)) {
+		switch_channel_hangup(caller_channel, switch_channel_get_cause(peer_channel));
+		return SWITCH_STATUS_FALSE;
+	}
+
+	if (!switch_channel_ready(caller_channel)) {
+		switch_channel_hangup(peer_channel, SWITCH_CAUSE_ORIGINATOR_CANCEL);
+		return SWITCH_STATUS_FALSE;
+	}
+
+	switch_channel_set_variable(caller_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, switch_core_session_get_uuid(peer_session));
+	switch_channel_set_variable(peer_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, switch_core_session_get_uuid(session));
 
+	switch_channel_set_flag(caller_channel, CF_ORIGINATOR);
+	
 	switch_channel_clear_state_handler(caller_channel, NULL);
 	switch_channel_clear_state_handler(peer_channel, NULL);
 
@@ -3445,9 +3464,6 @@
 	switch_channel_set_state_flag(peer_channel, CF_TRANSFER);
 
 
-	switch_channel_set_variable(caller_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, switch_core_session_get_uuid(peer_session));
-	switch_channel_set_variable(peer_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, switch_core_session_get_uuid(session));
-
 	switch_channel_set_state(caller_channel, CS_HIBERNATE);
 	switch_channel_set_state(peer_channel, CS_HIBERNATE);
 
@@ -3660,6 +3676,7 @@
 	switch_caller_profile_t *profile, *new_profile;
 	switch_core_session_message_t msg = {0};
 	switch_core_session_t *other_session;
+	switch_channel_t *other_channel = NULL;
 	char *uuid = NULL;
 
 	assert(session != NULL);
@@ -3690,15 +3707,23 @@
 			context = new_profile->context;
 		}
 
-		if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
-			switch_channel_t *other_channel = NULL;
+		
+		switch_channel_set_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE, NULL);
+		if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
+			switch_channel_set_variable(other_channel, SWITCH_SIGNAL_BOND_VARIABLE, NULL);
+			switch_core_session_rwunlock(other_session);
+		}
 
+		if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
 			other_channel = switch_core_session_get_channel(other_session);
 			assert(other_channel != NULL);
 			
 			switch_channel_set_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
 			switch_channel_set_variable(other_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
 
+			switch_channel_set_variable(channel, SWITCH_BRIDGE_VARIABLE, NULL);
+			switch_channel_set_variable(other_channel, SWITCH_BRIDGE_VARIABLE, NULL);
+
 			switch_channel_hangup(other_channel, SWITCH_CAUSE_BLIND_TRANSFER);
 			switch_ivr_media(uuid, SMF_NONE);
 			

Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c	(original)
+++ freeswitch/trunk/src/switch_rtp.c	Fri Mar  9 18:51:52 2007
@@ -1186,7 +1186,7 @@
 		rtp_session->recv_msg.header.pt == rtp_session->vad_data.read_codec->implementation->ianacode &&
 		((datalen == rtp_session->vad_data.read_codec->implementation->encoded_bytes_per_frame) || 
 		 (datalen > SWITCH_RTP_CNG_PAYLOAD && rtp_session->vad_data.read_codec->implementation->encoded_bytes_per_frame == 0))) {
-		int16_t decoded[SWITCH_RECCOMMENDED_BUFFER_SIZE/sizeof(int16_t)];
+		int16_t decoded[SWITCH_RECOMMENDED_BUFFER_SIZE/sizeof(int16_t)];
 		uint32_t rate;
 		uint32_t flags;
 		uint32_t len = sizeof(decoded);



More information about the Freeswitch-svn mailing list