cleanup some stuff

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4498 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-03-09 23:51:52 +00:00
parent 15002fda35
commit 2df583650f
14 changed files with 61 additions and 37 deletions

View 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;
}

View 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

View 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

View 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;

View 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;

View 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;

View 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;

View 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;

View 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;

View 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;

View 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;

View 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;

View 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);

View 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);