From a3c88fe612585979b2ae149dab1da7d34d01d797 Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Fri, 23 Nov 2007 09:32:35 +0000 Subject: [PATCH] * Introduced max_participants conference.conf variable. git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@561 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- apps/conference/Conference.cpp | 18 +++++++++++++++++- apps/conference/Conference.h | 1 + apps/conference/etc/conference.conf | 4 ++++ doc/Readme.conference | 3 +++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/apps/conference/Conference.cpp b/apps/conference/Conference.cpp index e32a84d7..ea83b2bb 100644 --- a/apps/conference/Conference.cpp +++ b/apps/conference/Conference.cpp @@ -63,6 +63,7 @@ string ConferenceFactory::JoinSound; string ConferenceFactory::DropSound; string ConferenceFactory::DialoutSuffix; PlayoutType ConferenceFactory::m_PlayoutType = ADAPTIVE_PLAYOUT; +unsigned int ConferenceFactory::MaxParticipants; #ifdef USE_MYSQL mysqlpp::Connection ConferenceFactory::Connection(mysqlpp::use_exceptions); @@ -258,11 +259,23 @@ int ConferenceFactory::onLoad() DBG("Using adaptive playout buffer as playout technique.\n"); } + MaxParticipants = 0; + string max_participants = cfg.getParameter("max_participants"); + if (max_participants.length() && str2i(max_participants, MaxParticipants)) { + ERROR("while parsing max_participants parameter\n"); + } + return 0; } AmSession* ConferenceFactory::onInvite(const AmSipRequest& req) { + if ((ConferenceFactory::MaxParticipants > 0) && + (AmConferenceStatus::getConferenceSize(req.user) >= + ConferenceFactory::MaxParticipants)) { + DBG("Conference is full.\n"); + throw AmSession::Exception(486, "Busy Here"); + } return new ConferenceDialog(req.user); } @@ -582,7 +595,10 @@ string dtmf2str(int event) void ConferenceDialog::onDtmf(int event, int duration) { DBG("ConferenceDialog::onDtmf\n"); - if(dialedout || !allow_dialout) + if (dialedout || !allow_dialout || + ((ConferenceFactory::MaxParticipants > 0) && + (AmConferenceStatus::getConferenceSize(dlg.user) >= + ConferenceFactory::MaxParticipants))) return; switch(state){ diff --git a/apps/conference/Conference.h b/apps/conference/Conference.h index 8628c0c1..09efee7e 100644 --- a/apps/conference/Conference.h +++ b/apps/conference/Conference.h @@ -81,6 +81,7 @@ public: static string DropSound; static string DialoutSuffix; static PlayoutType m_PlayoutType; + static unsigned int MaxParticipants; #ifdef USE_MYSQL static mysqlpp::Connection Connection; diff --git a/apps/conference/etc/conference.conf b/apps/conference/etc/conference.conf index 6cccfd22..02cbea38 100644 --- a/apps/conference/etc/conference.conf +++ b/apps/conference/etc/conference.conf @@ -18,3 +18,7 @@ dialout_suffix=@iptel.org # simple : simple (fifo) playout buffer # playout_type=adaptive_playout + +# Maximum number of participants in a conference +# default = 0 (unlimited) +#max_participants=10 diff --git a/doc/Readme.conference b/doc/Readme.conference index ac74456f..6af67f4d 100644 --- a/doc/Readme.conference +++ b/doc/Readme.conference @@ -112,6 +112,9 @@ playout_type: adaptive_playout, adaptive_jb, or simple: See sems core documentation for an explanation of the methods. +max_participants: Maximum number of participants in a conference. + Default = 0 (unlimited) + Adding participants with "Transfer" REFER: ------------------------------------------ The "Transfer REFER" is a proprietary REFER call flow which transfers a