]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
cleanup some stuff
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 9 Mar 2007 23:51:52 +0000 (23:51 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 9 Mar 2007 23:51:52 +0000 (23:51 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4498 d0543943-73ff-0310-b7d9-9358b9ac24b2

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

index 0a4284659ed890c148af91d54424498590216496..f9d7e2acc3cb4528638902681276d756df290c52 100644 (file)
@@ -1618,7 +1618,7 @@ void *ldl_handle_get_private(ldl_handle_t *handle)
        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;
 }
index 340d7924c5ae69afc8ef6b0c00909000759b1536..47dc8b989d58ee6361484e2899a63282632dc574 100644 (file)
@@ -372,7 +372,7 @@ void *ldl_handle_get_private(ldl_handle_t *handle);
   \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
index 1efe285fa8d762f941d54133404e9ca482c68b8b..0ad18ed7afbef2d90527be2c018cdeea069f7f71 100644 (file)
@@ -247,7 +247,7 @@ typedef struct switch_directories switch_directories;
 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
index a01ae1b879988b52205736e1e45bcab45bf0e0e3..57ea39e724eba09d96523aad79b1948f3c32e9fc 100644 (file)
@@ -1442,7 +1442,7 @@ static void conference_loop_output(conference_member_t *member)
 {
        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 conference_loop_output(conference_member_t *member)
 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;
index 7b0b8e693e126e820682866fb3d11d534e28df74..040ea020299150b88f63752db92f788b65c8ff3c 100644 (file)
@@ -2739,7 +2739,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
        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;
index 299db5c3efcc0858d0467e9e755c62894f2a107e..c225838d4c3f85f90af97900c8fc28d0a53bced4 100644 (file)
@@ -86,7 +86,7 @@ struct private_object {
        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;
index bd997de4691b3184d6ca13f2d133cda5c8b325ca..73b8c56d6190196d0cec2405aaa99f08e4de01ff 100644 (file)
@@ -82,7 +82,7 @@ struct private_object {
     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 @@ static struct {
        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;
index 1e5dc97cc2483a86d0b8252ee9b426a5677c2908..c9de237a48bcabcd13af61cea9677c15180ec149 100644 (file)
@@ -206,7 +206,6 @@ PaError OpenAudioStream( PABLIO_Stream **rwblPtr,
     long   bytesPerSample;
     PaError err;
     PABLIO_Stream *aStream;
-    long   minNumBuffers;
     long   numFrames;
        long numBytes;
        int channels = 1;
index 8cdcded86a5f031d4e691e8c8b0c30051feef66a..71d5ad353398877d53e572ccb883000f5b0f3061 100644 (file)
@@ -608,7 +608,7 @@ static int del_callback(void *pArg, int argc, char **argv, char **columnNames){
                        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 @@ static switch_status_t tech_set_codec(private_object_t *tech_pvt, int force)
                        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 @@ static switch_status_t config_sofia(int reload)
        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;
index b060365ae9a4a10c2cff9610909155fed52fe261..8cefb95b4a830b321f3e9ddac4a8bd26c529ce03 100644 (file)
@@ -146,8 +146,8 @@ struct private_object {
        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;
index a02021037808c48b8b3f96fe212ac42856e9809f..071dc7e320dfbe8d76eddbab544b7eeb5157bd51 100644 (file)
@@ -137,7 +137,7 @@ struct private_object {
        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;
index 2544d50ae6411bb9e315ddc5c8967b6f42f62911..5634d0c644258c1d392e292e9ac99a747328715b 100644 (file)
@@ -115,14 +115,14 @@ struct switch_core_session {
        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(void *) switch_core_media_bug_get_user_data(switch_media_bug_t *b
 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;
index 053d1267958c10604e8beee680c351cd0d50b865..7dbf35d57e3f6a6c2894168ba0abd102455b0b57 100644 (file)
@@ -554,11 +554,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
 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 @@ typedef struct {
 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 *SWITCH_THREAD_FUNC speech_thread(switch_thread_t *thread, void *obj
 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 @@ static switch_status_t signal_bridge_on_hangup(switch_core_session_t *session)
                }
        }
 
-
-       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 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t *
        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_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t *
        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_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_
        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 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_
                        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);
                        
index bed0dbd857ac2f04e02d68f379531c3701f898ca..5b3465408308baa085bf8b9afdf751a9e4e26bef 100644 (file)
@@ -1186,7 +1186,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session, void *data, uint32_t data
                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);