[Freeswitch-svn] [commit] r10391 - in freeswitch/trunk/src: . mod/endpoints/mod_sofia
FreeSWITCH SVN
anthm at freeswitch.org
Thu Nov 13 15:25:38 PST 2008
Author: anthm
Date: Thu Nov 13 18:25:38 2008
New Revision: 10391
Log:
It's time to play the music, It's time to light the lights
Modified:
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
freeswitch/trunk/src/switch_ivr.c
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Thu Nov 13 18:25:38 2008
@@ -2986,6 +2986,7 @@
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);
Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c (original)
+++ freeswitch/trunk/src/switch_ivr.c Thu Nov 13 18:25:38 2008
@@ -494,6 +494,9 @@
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 @@
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 @@
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"))) {
More information about the Freeswitch-svn
mailing list