add session heartbeat feature

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9882 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2008-10-07 21:03:37 +00:00
parent 1d9f205098
commit fc0c89c642
7 changed files with 76 additions and 0 deletions

View File

@@ -1627,6 +1627,24 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan
switch_core_session_rwunlock(other_session);
}
if ((var = switch_channel_get_variable(channel, SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE))) {
uint32_t seconds = 60;
int tmp;
if (switch_is_number(var)) {
tmp = atoi(var);
if (tmp > 10) {
seconds = tmp;
}
} else if (!switch_true(var)) {
seconds = 0;
}
if (seconds) {
switch_core_session_enable_heartbeat(channel->session, seconds);
}
}
switch_channel_set_variable(channel, "endpoint_disposition", "ANSWER");
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Channel [%s] has been answered\n", channel->name);
if ((var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE)) && !switch_strlen_zero(var)) {