Merge branch 'master' of ssh://git.freeswitch.org:222/freeswitch

This commit is contained in:
Chris Rienzo 2013-05-22 13:22:19 -04:00
commit 02cf105840
5 changed files with 54 additions and 12 deletions

View File

@ -726,7 +726,7 @@ switch_status_t send_register_reject(listener_t *listener,
switch_status_t send_open_receive_channel(listener_t *listener, switch_status_t send_open_receive_channel(listener_t *listener,
uint32_t conference_id, uint32_t conference_id,
uint32_t pass_thru_party_id, uint32_t pass_thru_party_id,
uint32_t packets, uint32_t ms_per_packet,
uint32_t payload_capacity, uint32_t payload_capacity,
uint32_t echo_cancel_type, uint32_t echo_cancel_type,
uint32_t g723_bitrate, uint32_t g723_bitrate,
@ -739,7 +739,7 @@ switch_status_t send_open_receive_channel(listener_t *listener,
message->length = 4 + sizeof(message->data.open_receive_channel); message->length = 4 + sizeof(message->data.open_receive_channel);
message->data.open_receive_channel.conference_id = conference_id; message->data.open_receive_channel.conference_id = conference_id;
message->data.open_receive_channel.pass_thru_party_id = pass_thru_party_id; message->data.open_receive_channel.pass_thru_party_id = pass_thru_party_id;
message->data.open_receive_channel.packets = packets; message->data.open_receive_channel.ms_per_packet = ms_per_packet;
message->data.open_receive_channel.payload_capacity = payload_capacity; message->data.open_receive_channel.payload_capacity = payload_capacity;
message->data.open_receive_channel.echo_cancel_type = echo_cancel_type; message->data.open_receive_channel.echo_cancel_type = echo_cancel_type;
message->data.open_receive_channel.g723_bitrate = g723_bitrate; message->data.open_receive_channel.g723_bitrate = g723_bitrate;

View File

@ -456,7 +456,7 @@ struct PACKED reset_message {
struct PACKED open_receive_channel_message { struct PACKED open_receive_channel_message {
uint32_t conference_id; uint32_t conference_id;
uint32_t pass_thru_party_id; uint32_t pass_thru_party_id;
uint32_t packets; uint32_t ms_per_packet;
uint32_t payload_capacity; uint32_t payload_capacity;
uint32_t echo_cancel_type; uint32_t echo_cancel_type;
uint32_t g723_bitrate; uint32_t g723_bitrate;
@ -874,7 +874,7 @@ switch_status_t send_register_reject(listener_t *listener,
switch_status_t send_open_receive_channel(listener_t *listener, switch_status_t send_open_receive_channel(listener_t *listener,
uint32_t conference_id, uint32_t conference_id,
uint32_t pass_thru_party_id, uint32_t pass_thru_party_id,
uint32_t packets, uint32_t ms_per_packet,
uint32_t payload_capacity, uint32_t payload_capacity,
uint32_t echo_cancel_type, uint32_t echo_cancel_type,
uint32_t g723_bitrate, uint32_t g723_bitrate,

View File

@ -522,7 +522,7 @@ int skinny_ring_lines_callback(void *pArg, int argc, char **argv, char **columnN
skinny_profile_find_listener_by_device_name_and_instance(helper->tech_pvt->profile, skinny_profile_find_listener_by_device_name_and_instance(helper->tech_pvt->profile,
device_name, device_instance, &listener); device_name, device_instance, &listener);
if(listener) { if(listener && helper->tech_pvt->session && helper->remote_session) {
switch_channel_t *channel = switch_core_session_get_channel(helper->tech_pvt->session); switch_channel_t *channel = switch_core_session_get_channel(helper->tech_pvt->session);
switch_channel_t *remchannel = switch_core_session_get_channel(helper->remote_session); switch_channel_t *remchannel = switch_core_session_get_channel(helper->remote_session);
switch_channel_set_state(channel, CS_ROUTING); switch_channel_set_state(channel, CS_ROUTING);
@ -704,7 +704,7 @@ switch_status_t skinny_session_start_media(switch_core_session_t *session, liste
send_open_receive_channel(listener, send_open_receive_channel(listener,
tech_pvt->call_id, /* uint32_t conference_id, */ tech_pvt->call_id, /* uint32_t conference_id, */
tech_pvt->call_id, /* uint32_t pass_thru_party_id, */ tech_pvt->call_id, /* uint32_t pass_thru_party_id, */
20, /* uint32_t packets, */ 20, /* uint32_t ms_per_packet, */
SKINNY_CODEC_ULAW_64K, /* uint32_t payload_capacity, */ SKINNY_CODEC_ULAW_64K, /* uint32_t payload_capacity, */
0, /* uint32_t echo_cancel_type, */ 0, /* uint32_t echo_cancel_type, */
0, /* uint32_t g723_bitrate, */ 0, /* uint32_t g723_bitrate, */
@ -1132,6 +1132,11 @@ switch_status_t skinny_handle_keypad_button_message(listener_t *listener, skinny
} }
session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id); session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id);
if ( !session )
{
line_instance = 0;
session = skinny_profile_find_session(listener->profile, listener, &line_instance, 0);
}
if(session) { if(session) {
switch_channel_t *channel = NULL; switch_channel_t *channel = NULL;
@ -1205,6 +1210,9 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess
switch_core_session_t *session = NULL; switch_core_session_t *session = NULL;
struct speed_dial_stat_res_message *button_speed_dial = NULL; struct speed_dial_stat_res_message *button_speed_dial = NULL;
struct line_stat_res_message *button_line = NULL; struct line_stat_res_message *button_line = NULL;
uint32_t line_state;
switch_channel_t *channel = NULL;
skinny_check_data_length(request, sizeof(request->data.stimulus)-sizeof(request->data.stimulus.call_id)); skinny_check_data_length(request, sizeof(request->data.stimulus)-sizeof(request->data.stimulus.call_id));
@ -1255,7 +1263,27 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess
// If session and line match, answer the call // If session and line match, answer the call
if ( session && line_instance == button_line->number ) { if ( session && line_instance == button_line->number ) {
status = skinny_session_answer(session, listener, line_instance); line_state = skinny_line_get_state(listener, line_instance, call_id);
if(line_state == SKINNY_OFF_HOOK) {
channel = switch_core_session_get_channel(session);
if (switch_channel_test_flag(channel, CF_HOLD)) {
switch_ivr_unhold(session);
}
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
}
else {
status = skinny_session_answer(session, listener, line_instance);
}
}
else {
if(skinny_check_data_length_soft(request, sizeof(request->data.soft_key_event))) {
line_instance = request->data.soft_key_event.line_instance;
}
skinny_create_incoming_session(listener, &line_instance, &session);
skinny_session_process_dest(session, listener, line_instance, NULL, '\0', 0);
} }
break; break;
@ -1276,6 +1304,7 @@ switch_status_t skinny_handle_off_hook_message(listener_t *listener, skinny_mess
uint32_t call_id = 0; uint32_t call_id = 0;
switch_core_session_t *session = NULL; switch_core_session_t *session = NULL;
private_t *tech_pvt = NULL; private_t *tech_pvt = NULL;
uint32_t line_state;
if(skinny_check_data_length_soft(request, sizeof(request->data.off_hook))) { if(skinny_check_data_length_soft(request, sizeof(request->data.off_hook))) {
if (request->data.off_hook.line_instance > 0) { if (request->data.off_hook.line_instance > 0) {
@ -1286,7 +1315,9 @@ switch_status_t skinny_handle_off_hook_message(listener_t *listener, skinny_mess
session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id); session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id);
if(session) { /*answering a call */ line_state = skinny_line_get_state(listener, line_instance, call_id);
if(session && line_state != SKINNY_OFF_HOOK ) { /*answering a call */
skinny_session_answer(session, listener, line_instance); skinny_session_answer(session, listener, line_instance);
} else { /* start a new call */ } else { /* start a new call */
skinny_create_incoming_session(listener, &line_instance, &session); skinny_create_incoming_session(listener, &line_instance, &session);
@ -1676,7 +1707,7 @@ switch_status_t skinny_handle_open_receive_channel_ack_message(listener_t *liste
/* Codec */ /* Codec */
tech_pvt->iananame = "PCMU"; /* TODO */ tech_pvt->iananame = "PCMU"; /* TODO */
tech_pvt->codec_ms = 10; /* TODO */ tech_pvt->codec_ms = 20; /* TODO */
tech_pvt->rm_rate = 8000; /* TODO */ tech_pvt->rm_rate = 8000; /* TODO */
tech_pvt->rm_fmtp = NULL; /* TODO */ tech_pvt->rm_fmtp = NULL; /* TODO */
tech_pvt->agreed_pt = (switch_payload_t) 0; /* TODO */ tech_pvt->agreed_pt = (switch_payload_t) 0; /* TODO */
@ -1841,6 +1872,17 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn
status = skinny_session_answer(session, listener, line_instance); status = skinny_session_answer(session, listener, line_instance);
} }
break; break;
case SOFTKEY_IDIVERT:
session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id);
if(session) {
switch_channel_t *channel = NULL;
channel = switch_core_session_get_channel(session);
if (channel) {
switch_channel_hangup(channel, SWITCH_CAUSE_NO_ANSWER);
}
}
break;
default: default:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"Unknown SoftKeyEvent type: %d.\n", request->data.soft_key_event.event); "Unknown SoftKeyEvent type: %d.\n", request->data.soft_key_event.event);

View File

@ -5874,7 +5874,7 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session)
return; return;
} }
if (zstr(a_engine->codec_params.local_sdp_ip) || !a_engine->codec_params.local_sdp_port || switch_channel_test_flag(session->channel, CF_PROXY_MEDIA)) { if (zstr(a_engine->codec_params.local_sdp_ip) || !a_engine->codec_params.local_sdp_port) {// || switch_channel_test_flag(session->channel, CF_PROXY_MEDIA)) {
if (switch_core_media_choose_port(session, SWITCH_MEDIA_TYPE_AUDIO, 1) != SWITCH_STATUS_SUCCESS) { if (switch_core_media_choose_port(session, SWITCH_MEDIA_TYPE_AUDIO, 1) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s I/O Error\n", switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s I/O Error\n",
switch_channel_get_name(session->channel)); switch_channel_get_name(session->channel));

View File

@ -677,7 +677,7 @@ SWITCH_DECLARE(switch_status_t) switch_b64_encode(unsigned char *in, switch_size
while (l >= 6) { while (l >= 6) {
out[bytes++] = switch_b64_table[(b >> (l -= 6)) % 64]; out[bytes++] = switch_b64_table[(b >> (l -= 6)) % 64];
if (bytes >= olen - 1) { if (bytes >= (int)olen - 1) {
goto end; goto end;
} }
if (++y != 72) { if (++y != 72) {
@ -692,7 +692,7 @@ SWITCH_DECLARE(switch_status_t) switch_b64_encode(unsigned char *in, switch_size
out[bytes++] = switch_b64_table[((b % 16) << (6 - l)) % 64]; out[bytes++] = switch_b64_table[((b % 16) << (6 - l)) % 64];
} }
if (l != 0) { if (l != 0) {
while (l < 6 && bytes < olen - 1) { while (l < 6 && bytes < (int)olen - 1) {
out[bytes++] = '=', l += 2; out[bytes++] = '=', l += 2;
} }
} }