SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session, int sendonly)
{
int changed = 0;
- switch_rtp_engine_t *a_engine;//, *v_engine;
+ switch_rtp_engine_t *a_engine, *v_engine;
switch_media_handle_t *smh;
switch_core_session_t *b_session = NULL;
switch_channel_t *b_channel = NULL;
}
a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO];
- //v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
+ v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
if (switch_core_session_get_partner(session, &b_session) == SWITCH_STATUS_SUCCESS) {
msg = "hold-private";
}
}
+
+ switch_rtp_set_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_PAUSE);
+ if (v_engine->rtp_session) {
+ switch_rtp_set_flag(v_engine->rtp_session, SWITCH_RTP_FLAG_PAUSE);
+ }
switch_channel_set_flag(session->channel, CF_PROTO_HOLD);
switch_channel_mark_hold(session->channel, SWITCH_TRUE);
if (switch_channel_test_flag(session->channel, CF_HOLD_LOCK)) {
switch_channel_set_flag(session->channel, CF_PROTO_HOLD);
switch_channel_mark_hold(session->channel, SWITCH_TRUE);
+
+ switch_rtp_set_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_PAUSE);
+ if (v_engine->rtp_session) {
+ switch_rtp_set_flag(v_engine->rtp_session, SWITCH_RTP_FLAG_PAUSE);
+ }
+
changed = 1;
}
switch_channel_clear_flag(session->channel, CF_PROTO_HOLD);
switch_channel_mark_hold(session->channel, SWITCH_FALSE);
switch_channel_presence(session->channel, "unknown", "unhold", NULL);
+
+ switch_rtp_clear_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_PAUSE);
+ if (v_engine->rtp_session) {
+ switch_rtp_clear_flag(v_engine->rtp_session, SWITCH_RTP_FLAG_PAUSE);
+ }
+
changed = 1;
}
}
if (ok) {
switch_rtp_clear_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
- switch_rtp_clear_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
+ //switch_rtp_clear_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
switch_channel_set_flag(session->channel, CF_NOTIMER_DURING_BRIDGE);
}
if (!switch_rtp_test_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_UDPTL) &&
!switch_rtp_test_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA)) {
switch_rtp_set_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
- switch_rtp_set_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
+ //switch_rtp_set_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
}
switch_channel_clear_flag(session->channel, CF_NOTIMER_DURING_BRIDGE);
}
return status;
}
+static int using_ice(switch_rtp_t *rtp_session)
+{
+ if (rtp_session->ice.ice_user || rtp_session->rtcp_ice.ice_user) {
+ return 1;
+ }
+ return 0;
+}
static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_type, switch_frame_flag_t *flags, switch_io_flag_t io_flags)
{
pt = 100000;
}
-
+ if (using_ice(rtp_session)) {
+ pt = 20000;
+ }
+
poll_status = switch_poll(rtp_session->read_pollfd, 1, &fdr, pt);
}
}
- if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) {
+ if (using_ice(rtp_session)) {
if (check_rtcp_and_ice(rtp_session) == -1) {
ret = -1;
goto end;
}
- goto recvfrom;
- }
+ }
if ((!(io_flags & SWITCH_IO_FLAG_NOBLOCK)) &&
(rtp_session->dtmf_data.out_digit_dur == 0)) {
return_cng_frame();
}
}
-
+
rtcp:
if (rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP]) {
send = 0;
}
-
+ if (rtp_session->flags[SWITCH_RTP_FLAG_PAUSE]) {
+ send = 0;
+ }
if (send) {
send_msg->header.seq = htons(++rtp_session->seq);