From e827183b56c23e035376873bf3e953085cc22731 Mon Sep 17 00:00:00 2001 From: paulc Date: Wed, 24 Oct 2012 08:54:56 +0000 Subject: [PATCH] Added settings for some H.323 timeouts, some may be too tight by OpenH323 default. git-svn-id: http://yate.null.ro/svn/yate/trunk@5303 acf43c95-373e-0410-b603-e72c3f656dc1 --- conf.d/h323chan.conf.sample | 12 ++++++++++++ modules/h323chan.cpp | 20 ++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/conf.d/h323chan.conf.sample b/conf.d/h323chan.conf.sample index 409b0c6c..9700b76e 100644 --- a/conf.d/h323chan.conf.sample +++ b/conf.d/h323chan.conf.sample @@ -171,6 +171,18 @@ gw = false ; Defaults to 65535 ;bind_maxport=65535 +; timeout_control: integer: Control channel start timeout in msec +; Valid range 5000 to 600000 (5s to 10m), library default 2m +;timeout_control=120000 + +; timeout_answer: integer: Answer timeout (maximum time until CONNECT) in msec +; Valid range 10000 to 600000 (10s to 10m), library default 1m +;timeout_answer=60000 + +; timeout_capabilities: integer: Capability exchange timeout in msec +; Valid range 1000 to 120000 (1s to 2m), library default 30s +;timeout_capabilities=30000 + ; alias: string: The alias used by h323 module to connect to gatekeeper alias = yate diff --git a/modules/h323chan.cpp b/modules/h323chan.cpp index f95a0ca9..7e7d6ec0 100644 --- a/modules/h323chan.cpp +++ b/modules/h323chan.cpp @@ -461,6 +461,8 @@ public: protected: virtual void OnRegistrationReject(); bool initInternal(bool reg, const NamedList* params); + void initTimeout(PTimeInterval& interval, const String& name, + const NamedList& params, long minVal, long maxVal = 600000); void setCodecs(); bool internalGkClient(YateGkRegThread* thread, int mode, const PString& name); void internalGkNotify(bool registered, const char* reason = 0, const char* error = 0); @@ -1105,6 +1107,19 @@ void YateH323EndPoint::OnRegistrationReject() internalGkNotify(false,"Registration failed","noauth"); } +void YateH323EndPoint::initTimeout(PTimeInterval& interval, const String& name, + const NamedList& params, long minVal, long maxVal) +{ + long int msec = params.getIntValue(name); + if (msec <= 0) + return; + if (msec < minVal) + msec = minVal; + else if (msec > maxVal) + msec = maxVal; + interval = msec; +} + bool YateH323EndPoint::initInternal(bool reg, const NamedList* params) { Lock lck(m_mutex); @@ -1117,6 +1132,11 @@ bool YateH323EndPoint::initInternal(bool reg, const NamedList* params) SetSilenceDetectionMode(static_cast (params ? params->getIntValue("silencedetect",dict_silence,H323AudioCodec::NoSilenceDetection) : H323AudioCodec::NoSilenceDetection)); + if (params) { + initTimeout(controlChannelStartTimeout,YSTRING("timeout_control"),*params,10000); + initTimeout(signallingChannelCallTimeout,YSTRING("timeout_answer"),*params,5000); + initTimeout(capabilityExchangeTimeout,YSTRING("timeout_capabilities"),*params,1000,120000); + } // Init authenticators m_authMethods.clear(); m_authUseAll = false;