From ca3528c6e2db555d5d763ec836472b63ff607e6e Mon Sep 17 00:00:00 2001 From: oana Date: Fri, 17 Aug 2012 13:29:31 +0000 Subject: [PATCH] Set allowed number of simultaneous calls from configuration files. If not set, default to the maxchans setting in yate.conf. git-svn-id: http://yate.null.ro/svn/yate/trunk@5227 acf43c95-373e-0410-b603-e72c3f656dc1 --- conf.d/h323chan.conf.sample | 2 +- conf.d/yiaxchan.conf.sample | 5 +++++ conf.d/yjinglechan.conf.sample | 5 +++++ conf.d/ysipchan.conf.sample | 5 +++++ modules/h323chan.cpp | 2 +- modules/yiaxchan.cpp | 3 +++ modules/yjinglechan.cpp | 2 ++ modules/ysipchan.cpp | 2 ++ 8 files changed, 24 insertions(+), 2 deletions(-) diff --git a/conf.d/h323chan.conf.sample b/conf.d/h323chan.conf.sample index c55d84cc..f7e63836 100644 --- a/conf.d/h323chan.conf.sample +++ b/conf.d/h323chan.conf.sample @@ -151,7 +151,7 @@ alias = yate ident = yate ; maxconns: int: Maximum number of simultaneous connections (0 = no limit). -;maxconns = 0 +;maxconns= ; faststart: bool: Enable Fast Start mode (offer media channels early) ; This setting is required when doing direct RTP forwarding between endpoints diff --git a/conf.d/yiaxchan.conf.sample b/conf.d/yiaxchan.conf.sample index d9646288..3fe40d32 100644 --- a/conf.d/yiaxchan.conf.sample +++ b/conf.d/yiaxchan.conf.sample @@ -48,6 +48,11 @@ ; It is a bad idea to set a low priority for anything but testing ;thread=normal +; maxchans: int: Maximum number of channels running at once +; A value of 0 specifies that there is no limit enforced. +; Defaults to the value set by the maxchans setting from yate.conf +;maxchans= + ; printmsg: boolean: Print sent/received frames to output if the module's debug ; level is at least 9 ; This parameter is applied on reload diff --git a/conf.d/yjinglechan.conf.sample b/conf.d/yjinglechan.conf.sample index 8fdf7e39..0449bead 100644 --- a/conf.d/yjinglechan.conf.sample +++ b/conf.d/yjinglechan.conf.sample @@ -37,6 +37,11 @@ ; outgoing calls or "jingle_flags" for incoming calls ;jingle_flags= +; maxchans: int: Maximum number of channels running at once +; A value of 0 specifies that there is no limit enforced. +; Defaults to the value set by the maxchans setting from yate.conf +;maxchans= + ; accept_relay: bool: Accept a "relay" transport type even if we had another type before ; This works only with Jingle version 0 (Google Talk, libjingle) ;accept_relay=disable in server mode, enable in client mode diff --git a/conf.d/ysipchan.conf.sample b/conf.d/ysipchan.conf.sample index b901b444..0602b6a8 100644 --- a/conf.d/ysipchan.conf.sample +++ b/conf.d/ysipchan.conf.sample @@ -156,6 +156,11 @@ ; Defaults to 5 if missing, invalid or out of bounds ;sip_rsp_trans_count=5 +; maxchans: int: Maximum number of channels running at once +; A value of 0 specifies that there is no limit enforced. +; Defaults to the value set by the maxchans setting from yate.conf +;maxchans= + ; printmsg: boolean: Print SIP messages to output ; This parameter is applied on reload ; Defaults to yes diff --git a/modules/h323chan.cpp b/modules/h323chan.cpp index 4e7762fa..83f69296 100644 --- a/modules/h323chan.cpp +++ b/modules/h323chan.cpp @@ -3028,7 +3028,7 @@ void H323Driver::initialize() s_maxCleaning = s_cfg.getIntValue("general","maxcleaning",100); s_pwlibThread = s_cfg.getBoolValue("general","pwlibthread"); maxRoute(s_cfg.getIntValue("incoming","maxqueue",5)); - maxChans(s_cfg.getIntValue("ep","maxconns",0)); + maxChans(s_cfg.getIntValue("ep","maxconns",maxChans())); if (!s_process) { setup(); installRelay(Halt); diff --git a/modules/yiaxchan.cpp b/modules/yiaxchan.cpp index 8c51b933..5a3274c3 100644 --- a/modules/yiaxchan.cpp +++ b/modules/yiaxchan.cpp @@ -1365,6 +1365,7 @@ void YIAXDriver::initialize() if (m_iaxEngine) { m_iaxEngine->initialize(*gen); m_iaxEngine->initFormats(cfg.getSection("formats")); + maxChans(gen->getIntValue("maxchans",maxChans())); return; } setup(); @@ -1383,6 +1384,8 @@ void YIAXDriver::initialize() u_int32_t trunkSendInterval = 10; m_port = gen->getIntValue("port",4569); String iface = gen->getValue("addr","0.0.0.0"); + // set max chans + maxChans(gen->getIntValue("maxchans",maxChans())); bool authReq = cfg.getBoolValue("registrar","auth_required",true); m_iaxEngine = new YIAXEngine(iface,m_port,transListCount,retransCount,retransInterval,authTimeout, transTimeout,maxFullFrameDataLen,trunkSendInterval,authReq,gen); diff --git a/modules/yjinglechan.cpp b/modules/yjinglechan.cpp index 3d5cedfd..3201a720 100644 --- a/modules/yjinglechan.cpp +++ b/modules/yjinglechan.cpp @@ -3867,6 +3867,8 @@ void YJGDriver::initialize() int redir = sect->getIntValue("redirectcount"); s_redirectCount = (redir >= 0) ? redir : 0; s_dtmfMeth = sect->getIntValue("dtmfmethod",s_dictDtmfMeth,DtmfJingle); + // set max chans + maxChans(sect->getIntValue("maxchans",maxChans())); int prio = sect->getIntValue("resource_priority"); if (prio < -128) diff --git a/modules/ysipchan.cpp b/modules/ysipchan.cpp index 7a04b139..1af24927 100644 --- a/modules/ysipchan.cpp +++ b/modules/ysipchan.cpp @@ -7719,6 +7719,8 @@ void SIPDriver::initialize() s_sslCertFile = s_cfg.getValue("general","ssl_certificate_file"); s_sslKeyFile = s_cfg.getValue("general","ssl_key_file"); s_globalMutex.unlock(); + // set max chans + maxChans(s_cfg.getIntValue("general","maxchans",maxChans())); // Adjust here the TCP idle interval: it uses the SIP engine s_tcpIdle = tcpIdleInterval(s_cfg.getIntValue("general","tcp_idle",TCP_IDLE_DEF)); // Mark listeners