make sure sip-hold works on webrtc

This commit is contained in:
Anthony Minessale 2013-06-21 00:41:25 -05:00
parent 76177e6196
commit 5a0f43d956
2 changed files with 60 additions and 3 deletions

View File

@ -1934,7 +1934,7 @@ static void check_ice(switch_media_handle_t *smh, switch_media_type_t type, sdp_
sdp_attribute_t *attr;
int i = 0, got_rtcp_mux = 0;
if (engine->ice_in.chosen[0] && engine->ice_in.chosen[1]) {
if (engine->ice_in.chosen[0] && engine->ice_in.chosen[1] && !switch_channel_test_flag(smh->session->channel, CF_REINVITE)) {
return;
}
@ -2175,6 +2175,62 @@ static void check_ice(switch_media_handle_t *smh, switch_media_type_t type, sdp_
engine->rtcp_mux = -1;
}
if (switch_channel_test_flag(smh->session->channel, CF_REINVITE)) {
if (switch_rtp_ready(engine->rtp_session) && engine->ice_in.cands[engine->ice_in.chosen[0]][0].ready) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_INFO, "RE-Activating %s ICE\n", type2str(type));
switch_rtp_activate_ice(engine->rtp_session,
engine->ice_in.ufrag,
engine->ice_out.ufrag,
engine->ice_out.pwd,
engine->ice_in.pwd,
IPR_RTP,
#ifdef GOOGLE_ICE
ICE_GOOGLE_JINGLE,
NULL
#else
switch_channel_direction(smh->session->channel) ==
SWITCH_CALL_DIRECTION_OUTBOUND ? ICE_VANILLA : (ICE_VANILLA | ICE_CONTROLLED),
&engine->ice_in
#endif
);
}
if (engine->ice_in.cands[engine->ice_in.chosen[1]][1].ready) {
if (!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));
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_INFO, "Activating %s RTCP ICE\n", type2str(type));
switch_rtp_activate_ice(engine->rtp_session,
engine->ice_in.ufrag,
engine->ice_out.ufrag,
engine->ice_out.pwd,
engine->ice_in.pwd,
IPR_RTCP,
#ifdef GOOGLE_ICE
ICE_GOOGLE_JINGLE,
NULL
#else
switch_channel_direction(smh->session->channel) ==
SWITCH_CALL_DIRECTION_OUTBOUND ? ICE_VANILLA : (ICE_VANILLA | ICE_CONTROLLED),
&engine->ice_in
#endif
);
}
}
}
}
#ifdef _MSC_VER
#pragma warning(pop)

View File

@ -876,7 +876,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
if (!zstr(username)) {
if (!strcmp(username, ice->user_ice)) {
ok = 1;
} else if(!strcmp(username, rtp_session->rtcp_ice.user_ice)) {
} else if(!zstr(rtp_session->rtcp_ice.user_ice) && !strcmp(username, rtp_session->rtcp_ice.user_ice)) {
ice = &rtp_session->rtcp_ice;
ok = 1;
}
@ -891,7 +891,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
char *host = NULL;
ice->missed_count++;
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_CRIT, "missed %d\n", ice->missed_count);
//switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_CRIT, "missed %d\n", ice->missed_count);
if (elapsed > 20000 && pri) {
int i, j;
@ -971,6 +971,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
if (ice->missed_count > 5) {
ice->rready = 0;
ok = 1;
}
if (ok) {