From 502ddd312a4e2dfc27d0f6bd13b59f20c41ef5e4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 29 Jul 2014 22:16:56 +0500 Subject: [PATCH] FS-6702 #resolve --- html5/verto/demo/verto.js | 5 +++++ src/mod/endpoints/mod_verto/mod_verto.c | 13 +++++++++++++ src/switch_core_media.c | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/html5/verto/demo/verto.js b/html5/verto/demo/verto.js index 2099824f13..a7c39295df 100644 --- a/html5/verto/demo/verto.js +++ b/html5/verto/demo/verto.js @@ -456,6 +456,7 @@ function init() { $(document).ready(function() { var hash = window.location.hash.substring(1); + var a = []; if (hash && hash.indexOf("page-") == -1) { window.location.hash = ""; @@ -463,6 +464,10 @@ $(document).ready(function() { autocall = true; } + if (hash && (a = hash.split("&"))) { + window.location.hash = a[0]; + } + init(); }); diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index c7f4128690..d2a5b5fdad 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1083,6 +1083,11 @@ static void detach_calls(jsock_t *jsock) if (!switch_channel_up_nosig(tech_pvt->channel)) { continue; } + + if (!switch_channel_test_flag(tech_pvt->channel, CF_ANSWERED)) { + switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + continue; + } tech_pvt->detach_time = switch_epoch_time_now(NULL); globals.detached++; @@ -2478,6 +2483,14 @@ static switch_bool_t verto__attach_func(const char *method, cJSON *params, jsock tech_pvt = switch_core_session_get_private_class(session, SWITCH_PVT_SECONDARY); tech_pvt->r_sdp = switch_core_session_strdup(session, sdp); + + if (!switch_channel_test_flag(tech_pvt->channel, CF_ANSWERED)) { + switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + cJSON_AddItemToObject(obj, "message", cJSON_CreateString("Cannot attach to a call that has not been answered.")); + err = 1; goto cleanup; + } + + switch_channel_set_variable(tech_pvt->channel, SWITCH_R_SDP_VARIABLE, tech_pvt->r_sdp); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Remote SDP %s:\n%s\n", switch_channel_get_name(tech_pvt->channel), tech_pvt->r_sdp); diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 26987402df..b04df85757 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -2882,7 +2882,7 @@ static void check_ice(switch_media_handle_t *smh, switch_media_type_t type, sdp_ } } - if (engine->ice_in.cands[engine->ice_in.chosen[1]][1].ready) { + if (engine->rtp_session && engine->ice_in.cands[engine->ice_in.chosen[1]][1].ready) { if (engine->rtcp_mux > 0 && !strcmp(engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_addr, engine->ice_in.cands[engine->ice_in.chosen[0]][0].con_addr) && engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_port == engine->ice_in.cands[engine->ice_in.chosen[0]][0].con_port) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_INFO, "Skipping %s RTCP ICE (Same as RTP)\n", type2str(type));