SIP Session Timer support for conference app

sayer/1.4-spce2.6
Stefan Sayer 16 years ago
parent 90cccb3383
commit a217168a64

@ -73,6 +73,8 @@ PlayoutType ConferenceFactory::m_PlayoutType = ADAPTIVE_PLAYOUT;
unsigned int ConferenceFactory::MaxParticipants;
bool ConferenceFactory::UseRFC4240Rooms;
AmConfigReader ConferenceFactory::cfg;
AmSessionEventHandlerFactory* ConferenceFactory::session_timer_f = NULL;
#ifdef USE_MYSQL
mysqlpp::Connection ConferenceFactory::Connection(mysqlpp::use_exceptions);
@ -155,7 +157,6 @@ int get_audio_file(const string& message, const string& domain, const string& la
int ConferenceFactory::onLoad()
{
AmConfigReader cfg;
if(cfg.loadFile(AmConfig::ModConfigPath + string(APP_NAME)+ ".conf"))
return -1;
@ -297,6 +298,15 @@ int ConferenceFactory::onLoad()
UseRFC4240Rooms = cfg.getParameter("use_rfc4240_rooms")=="yes";
DBG("%ssing RFC4240 room naming.\n", UseRFC4240Rooms?"U":"Not u");
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;
}
@ -322,7 +332,27 @@ AmSession* ConferenceFactory::onInvite(const AmSipRequest& req)
conf_id = req.user.substr(5);
}
return new ConferenceDialog(conf_id);
ConferenceDialog* s = new ConferenceDialog(conf_id);
setupSessionTimer(s);
return s;
}
void ConferenceFactory::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);
}
}
}
AmSession* ConferenceFactory::onRefer(const AmSipRequest& req)
@ -332,7 +362,8 @@ AmSession* ConferenceFactory::onRefer(const AmSipRequest& req)
AmSession* s = new ConferenceDialog(req.user);
s->dlg.local_tag = req.from_tag;
setupSessionTimer(s);
DBG("ConferenceFactory::onRefer: local_tag = %s\n",s->dlg.local_tag.c_str());
@ -749,6 +780,8 @@ void ConferenceDialog::createDialoutParticipant(const string& uri_user)
AmConferenceStatus::getChannel(getLocalTag(),
dialout_id));
ConferenceFactory::setupSessionTimer(dialout_session);
AmSipDialog& dialout_dlg = dialout_session->dlg;
dialout_dlg.local_tag = dialout_id;

@ -75,6 +75,9 @@ struct DialoutConfEvent : public AmEvent {
/** \brief Factory for conference sessions */
class ConferenceFactory : public AmSessionFactory
{
static AmSessionEventHandlerFactory* session_timer_f;
static AmConfigReader cfg;
public:
static string AudioPath;
static string LonelyUserFile;
@ -85,6 +88,7 @@ public:
static unsigned int MaxParticipants;
static bool UseRFC4240Rooms;
static void setupSessionTimer(AmSession* s);
#ifdef USE_MYSQL
static mysqlpp::Connection Connection;

@ -33,3 +33,37 @@ playout_type=adaptive_playout
#default:
# use_rfc4240_rooms=no
#
###############################################################
# 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