Session Timer support for DSM

configurable in dsm.conf, by default off
sayer/1.4-spce2.6
Stefan Sayer 16 years ago
parent dd841fbf75
commit 6acd834aa6

@ -80,7 +80,8 @@ string DSMFactory::MonSelectFallback;
DSMFactory::DSMFactory(const string& _app_name)
: AmSessionFactory(_app_name),AmDynInvokeFactory(_app_name),
loaded(false)
loaded(false),
session_timer_f(NULL)
{
AmEventDispatcher::instance()->addEventQueue("dsm", this);
@ -118,7 +119,6 @@ int DSMFactory::onLoad()
return 0;
loaded = true;
AmConfigReader cfg;
if(cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf")))
return -1;
@ -260,6 +260,16 @@ int DSMFactory::onLoad()
closedir(dir);
}
}
if(cfg.hasParameter("enable_session_timer") &&
(cfg.getParameter("enable_session_timer") == string("yes")) ){
DBG("enabling session timers\n");
session_timer_f = AmPlugIn::instance()->getFactory4Seh("session_timer");
if(session_timer_f == NULL){
ERROR("Could not load the session_timer module: disabling session timers.\n");
}
}
return 0;
}
@ -488,6 +498,23 @@ bool DSMFactory::loadConfig(const string& conf_file_name, const string& conf_nam
void DSMFactory::prepareSession(DSMCall* s) {
s->setPromptSets(prompt_sets);
setupSessionTimer(s);
}
void DSMFactory::setupSessionTimer(AmSession* s) {
if (NULL != session_timer_f) {
AmSessionEventHandler* h = session_timer_f->getHandler(s);
if (NULL == h)
return;
if(h->configure(cfg)){
ERROR("Could not configure the session timer: disabling session timers.\n");
delete h;
} else {
s->addHandler(h);
}
}
}
void DSMFactory::addVariables(DSMCall* s, const string& prefix,

@ -91,6 +91,7 @@ class DSMFactory
DSMFactory(const string& _app_name);
~DSMFactory();
bool loaded;
AmConfigReader cfg;
int preloadModules(AmConfigReader& cfg, string& res, const string& ModPath);
bool loadConfig(const string& conf_file_name, const string& conf_name,
@ -122,6 +123,9 @@ class DSMFactory
void registerApplication(const AmArg& args, AmArg& ret);
void loadConfig(const AmArg& args, AmArg& ret);
AmSessionEventHandlerFactory* session_timer_f;
void setupSessionTimer(AmSession* s);
public:
static DSMFactory* instance();

@ -142,3 +142,38 @@ load_prompts=/usr/local/etc/sems/dsm_in_prompts.conf,/usr/local/etc/sems/dsm_out
# and additional configuration variables (as script variables)
#
# conf_dir=/usr/local/etc/sems/dsm/
###############################################################
# RFC4028 Session Timer
#
# - enables the session timer ([yes,no]; default: no)
#
# enable_session_timer=yes
# - set the "Session-Expires" parameter for the session timer.
#
# session_expires=240
# - set the "Min-SE" parameter for the session timer.
#
# minimum_timer=90
# session refresh (Session Timer, RFC4028) method
#
# INVITE - use re-INVITE
# UPDATE - use UPDATE
# UPDATE_FALLBACK_INVITE - use UPDATE if indicated in Allow, re-INVITE otherwise
#
# Default: UPDATE_FALLBACK_INVITE
#
# Note: Session Timers are only supported in some applications
#
#session_refresh_method=UPDATE
# accept_501_reply - accept 501 reply as successful refresh? [yes|no]
#
# Default: yes
#
#accept_501_reply=no

Loading…
Cancel
Save