It's time to play the music, It's time to light the lights

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10391 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-11-13 23:25:38 +00:00
parent 2990ef8cd4
commit cc36e27286
2 changed files with 17 additions and 0 deletions

View File

@ -2986,6 +2986,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
switch_clear_flag_locked(b_tech_pvt, TFLAG_SIP_HOLD);
switch_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
switch_channel_set_variable(switch_core_session_get_channel(b_session), "park_timeout", "2");
switch_channel_set_state(switch_core_session_get_channel(b_session), CS_PARK);
new_b_session = switch_core_session_locate(br_b);

View File

@ -494,6 +494,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session,
switch_codec_t *read_codec;
uint32_t rate;
uint32_t bpf;
const char *to;
int timeout = 0;
time_t expires = 0;
if (switch_channel_test_flag(channel, CF_CONTROLLED)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot park channels that are under control already.\n");
@ -522,6 +525,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session,
rate = read_codec->implementation->actual_samples_per_second;
bpf = read_codec->implementation->decoded_bytes_per_packet;
if ((to = switch_channel_get_variable(channel, "park_timeout"))) {
if ((timeout = atoi(to)) < 0) {
timeout = 0;
} else {
expires = switch_timestamp(NULL) + timeout;
}
}
switch_channel_set_flag(channel, CF_CONTROLLED);
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_PARK) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(channel, event);
@ -535,6 +546,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session,
break;
}
if (expires && switch_timestamp(NULL) >= expires) {
switch_channel_hangup(channel, SWITCH_CAUSE_RECOVERY_ON_TIMER_EXPIRE);
break;
}
if (switch_channel_test_flag(channel, CF_UNICAST)) {
if (!conninfo) {
if (!(conninfo = switch_channel_get_private(channel, "unicast"))) {