From 0b05cf6843d0ce09858c788bcbca5cc1faee69cc Mon Sep 17 00:00:00 2001 From: Nathan Neulinger Date: Wed, 22 May 2013 09:12:46 -0500 Subject: [PATCH 1/6] FS-5267: --resolve avoid null deref if sessions missing --- src/mod/endpoints/mod_skinny/skinny_server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index 48963a5be2..9d3def60ea 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -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, 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 *remchannel = switch_core_session_get_channel(helper->remote_session); switch_channel_set_state(channel, CS_ROUTING); From 337976e4699aec6f4472dd8d25bf2b9d771a56c5 Mon Sep 17 00:00:00 2001 From: Nathan Neulinger Date: Wed, 22 May 2013 09:17:41 -0500 Subject: [PATCH 2/6] FS-5225: --resolve add ability to dial by pressing line button --- src/mod/endpoints/mod_skinny/skinny_server.c | 35 ++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index 9d3def60ea..acce21bb71 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -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); + if ( !session ) + { + line_instance = 0; + session = skinny_profile_find_session(listener->profile, listener, &line_instance, 0); + } if(session) { 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; struct speed_dial_stat_res_message *button_speed_dial = 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)); @@ -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 && 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; @@ -1276,6 +1304,7 @@ switch_status_t skinny_handle_off_hook_message(listener_t *listener, skinny_mess uint32_t call_id = 0; switch_core_session_t *session = NULL; private_t *tech_pvt = NULL; + uint32_t line_state; if(skinny_check_data_length_soft(request, sizeof(request->data.off_hook))) { 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); - 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); } else { /* start a new call */ skinny_create_incoming_session(listener, &line_instance, &session); From 8afaf28a09bc07ccb2b31cfc5db635c9d068600a Mon Sep 17 00:00:00 2001 From: Nathan Neulinger Date: Wed, 22 May 2013 09:27:09 -0500 Subject: [PATCH 3/6] FS-5379: --resolve fix skinny phone codec agreement issues due to incorrect hardwired ptime, update field names for future coding to be more descriptive --- src/mod/endpoints/mod_skinny/skinny_protocol.c | 4 ++-- src/mod/endpoints/mod_skinny/skinny_protocol.h | 4 ++-- src/mod/endpoints/mod_skinny/skinny_server.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.c b/src/mod/endpoints/mod_skinny/skinny_protocol.c index 9c103c6121..1dab0f1c60 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.c +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.c @@ -726,7 +726,7 @@ switch_status_t send_register_reject(listener_t *listener, switch_status_t send_open_receive_channel(listener_t *listener, uint32_t conference_id, uint32_t pass_thru_party_id, - uint32_t packets, + uint32_t ms_per_packet, uint32_t payload_capacity, uint32_t echo_cancel_type, 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->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.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.echo_cancel_type = echo_cancel_type; message->data.open_receive_channel.g723_bitrate = g723_bitrate; diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.h b/src/mod/endpoints/mod_skinny/skinny_protocol.h index a04f8bc236..da79df8b7e 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.h +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.h @@ -456,7 +456,7 @@ struct PACKED reset_message { struct PACKED open_receive_channel_message { uint32_t conference_id; uint32_t pass_thru_party_id; - uint32_t packets; + uint32_t ms_per_packet; uint32_t payload_capacity; uint32_t echo_cancel_type; 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, uint32_t conference_id, uint32_t pass_thru_party_id, - uint32_t packets, + uint32_t ms_per_packet, uint32_t payload_capacity, uint32_t echo_cancel_type, uint32_t g723_bitrate, diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index acce21bb71..1a9545b1b9 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -704,7 +704,7 @@ switch_status_t skinny_session_start_media(switch_core_session_t *session, liste send_open_receive_channel(listener, tech_pvt->call_id, /* uint32_t conference_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, */ 0, /* uint32_t echo_cancel_type, */ 0, /* uint32_t g723_bitrate, */ @@ -1707,7 +1707,7 @@ switch_status_t skinny_handle_open_receive_channel_ack_message(listener_t *liste /* Codec */ 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_fmtp = NULL; /* TODO */ tech_pvt->agreed_pt = (switch_payload_t) 0; /* TODO */ From 23bd06881d08f148f53b01587693f67f9a79bcf6 Mon Sep 17 00:00:00 2001 From: Nathan Neulinger Date: Wed, 22 May 2013 09:58:28 -0500 Subject: [PATCH 4/6] FS-5429: --resolve add minimal idivert support for skinny --- src/mod/endpoints/mod_skinny/skinny_server.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index 1a9545b1b9..901fae87f7 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -1872,6 +1872,17 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn status = skinny_session_answer(session, listener, line_instance); } 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: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unknown SoftKeyEvent type: %d.\n", request->data.soft_key_event.event); From 66a94a2c4590f31d1ae4daf4a33ce00cdd6c0c96 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Wed, 22 May 2013 10:38:04 -0500 Subject: [PATCH 5/6] windows fix trivial compiler warning --- src/switch_utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_utils.c b/src/switch_utils.c index 3efe68d456..bc97f19120 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -677,7 +677,7 @@ SWITCH_DECLARE(switch_status_t) switch_b64_encode(unsigned char *in, switch_size while (l >= 6) { out[bytes++] = switch_b64_table[(b >> (l -= 6)) % 64]; - if (bytes >= olen - 1) { + if (bytes >= (int)olen - 1) { goto end; } 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]; } if (l != 0) { - while (l < 6 && bytes < olen - 1) { + while (l < 6 && bytes < (int)olen - 1) { out[bytes++] = '=', l += 2; } } From 699bd795f679934f0f3e46fd9c7b8d3ffafff16d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 22 May 2013 08:11:24 -0500 Subject: [PATCH 6/6] FS-5455 try this --- src/switch_core_media.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index cb8c8202b5..f2ae36b9c7 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -5874,7 +5874,7 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) 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) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s I/O Error\n", switch_channel_get_name(session->channel));