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;
}
\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
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
{
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;
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;
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;
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;
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;
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;
long bytesPerSample;
PaError err;
PABLIO_Stream *aStream;
- long minNumBuffers;
long numFrames;
long numBytes;
int channels = 1;
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);
}
}
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;
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;
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;
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;
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;
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;
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:
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:
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: {
}
}
-
- 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);
}
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);
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);
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);
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);
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);