From 6f7581edc9a9982e694f07ba30c45ac3efc72799 Mon Sep 17 00:00:00 2001 From: paulc Date: Thu, 28 May 2009 17:18:50 +0000 Subject: [PATCH] Moved all point code settings to SS7ISUP so the type of point code is known and numeric (packed) values can be used. Changed channellock to milliseconds to improve resolution. Documented channellock and userparttest parameters. git-svn-id: http://voip.null.ro/svn/yate@2660 acf43c95-373e-0410-b603-e72c3f656dc1 --- conf.d/ysigchan.conf.sample | 24 +++++++++++++---- libs/ysig/isup.cpp | 38 ++++++++++++++++++++++++-- libs/ysig/yatesig.h | 8 ++++++ modules/server/ysigchan.cpp | 54 +++++-------------------------------- 4 files changed, 70 insertions(+), 54 deletions(-) diff --git a/conf.d/ysigchan.conf.sample b/conf.d/ysigchan.conf.sample index 7476b596..b0375fc5 100644 --- a/conf.d/ysigchan.conf.sample +++ b/conf.d/ysigchan.conf.sample @@ -95,13 +95,22 @@ ; odd-fallback Allocate odd channels, fall back to even channels ;strategy-restrict= +; userparttest: integer: Remote user part test interval in seconds +; Set to 0 to always assume the remote user part is available +; Invalid values default to minimum (10s) +;userparttest=60 + ; channelsync: integer: The interval (in seconds) at which the call controller ; will try to re-sync idle channels ; The call controller will notify the other side of the link of idle channels ; Set to 0 to disable -; Defaults to minimum value (500s) if missing or invalid +; Invalid values default to minimum (60s) ;channelsync=1000 +; channellock: integer: Maximum time (in ms) spent trying to lock a remote channel +; Invalid values default to minimum (2500ms) +;channellock=10000 + ; numplan: string: Default numbering plan for outgoing calls ; Values: unknown, isdn, data, telex, national, private ; Defaults to unknown if missing or incorrect @@ -221,17 +230,22 @@ ; Japan5 5-bit SLS ;pointcodetype= -; defaultpointcode: string: Default originating point code used for outgoing calls -; If missing or invalid the first point code added to MTP3 is used +; pointcode: string: Local point code to accept as destination ; If no point codes are added no calls can be made (incoming or outgoing) ; through this trunk -; The format is network-cluster-member +; The format is network-cluster-member or number +;pointcode= + +; defaultpointcode: string: Default originating point code used for outgoing calls +; It also acts as accepted point code (see pointcode) +; Only one point code can be default +; The format is network-cluster-member or number ;defaultpointcode= ; remotepointcode: string: Default destination point code used for outgoing ; calls and maintenance messages ; If missing or invalid, no maintenance message will be sent -; The format is network-cluster-member +; The format is network-cluster-member or number ;remotepointcode= ; earlyacm: boolean: Convert received early ACM user state into progress or ringing diff --git a/libs/ysig/isup.cpp b/libs/ysig/isup.cpp index 6a3b0629..2cf8744c 100644 --- a/libs/ysig/isup.cpp +++ b/libs/ysig/isup.cpp @@ -2053,7 +2053,7 @@ SS7ISUP::SS7ISUP(const NamedList& params) const char* rpc = params.getValue("remotepointcode"); m_remotePoint = new SS7PointCode(0,0,0); - if (!(m_remotePoint->assign(rpc) && m_remotePoint->pack(m_type))) { + if (!(m_remotePoint->assign(rpc,m_type) && m_remotePoint->pack(m_type))) { Debug(this,DebugMild,"Invalid remotepointcode='%s'",rpc); TelEngine::destruct(m_remotePoint); } @@ -2080,7 +2080,7 @@ SS7ISUP::SS7ISUP(const NamedList& params) m_callerCat = "ordinary"; m_rscTimer.interval(params,"channelsync",60,1000,true,true); - m_lockTimer.interval(params,"channellock",5,10,false,true); + m_lockTimer.interval(params,"channellock",2500,10000,false,false); // Remote user part test m_uptTimer.interval(params,"userparttest",10,60,true,true); @@ -2170,6 +2170,40 @@ bool SS7ISUP::setPointCode(SS7PointCode* pc, bool def) return true; } +// Add all point codes described in a parameter list +unsigned int SS7ISUP::setPointCode(const NamedList& params) +{ + unsigned int count = 0; + unsigned int n = params.length(); + bool hadDef = false; + for (unsigned int i= 0; i < n; i++) { + NamedString* ns = params.getParam(i); + if (!ns) + continue; + bool defPc = false; + if (ns->name() == "defaultpointcode") + defPc = true; + else if (ns->name() != "pointcode") + continue; + SS7PointCode* pc = new SS7PointCode(0,0,0); + if (pc->assign(*ns,m_type) && setPointCode(pc,defPc && !hadDef)) { + count++; + if (defPc) { + if (hadDef) + Debug(this,DebugMild,"Added point code '%s' as non-default",ns->safe()); + else + hadDef = true; + } + } + else { + Debug(this,DebugWarn,"Invalid '%s'='%s' in parameters '%s'", + ns->name().c_str(),ns->safe(),params.safe()); + TelEngine::destruct(pc); + } + } + return count; +} + // Check if the given point code is serviced by this controller SS7PointCode* SS7ISUP::hasPointCode(const SS7PointCode& pc) { diff --git a/libs/ysig/yatesig.h b/libs/ysig/yatesig.h index 5c45a51a..d8cfea97 100644 --- a/libs/ysig/yatesig.h +++ b/libs/ysig/yatesig.h @@ -5632,6 +5632,14 @@ public: */ bool setPointCode(SS7PointCode* pc, bool def); + /** + * Append all point codes from a parameter list, use "pointcode" and + * "defaultpointcode" parameters + * @param params List of parameters to take point codes from + * @return Count of point codes added + */ + unsigned int setPointCode(const NamedList& params); + /** * Check if the given point code is serviced by this controller * @param pc The point code to check diff --git a/modules/server/ysigchan.cpp b/modules/server/ysigchan.cpp index 9f389457..c923a0ec 100644 --- a/modules/server/ysigchan.cpp +++ b/modules/server/ysigchan.cpp @@ -318,9 +318,6 @@ protected: // Save circuits state // Return true if changed bool verifyController(const NamedList* params, bool save = true); - // Add point codes from a given configuration section - // @return The number of point codes added - unsigned int setPointCode(const NamedList& sect); inline SS7ISUP* isup() { return static_cast(m_controller); } bool m_bicc; @@ -2104,10 +2101,10 @@ bool SigSS7Isup::create(NamedList& params, String& error) if (isup()) { plugin.engine()->insert(isup()); isup()->initialize(¶ms); - } - if (!setPointCode(params)) { - error = "No point codes"; - return false; + if (!isup()->setPointCode(params)) { + error = "No point codes"; + return false; + } } // Start thread @@ -2119,9 +2116,10 @@ bool SigSS7Isup::create(NamedList& params, String& error) bool SigSS7Isup::reload(NamedList& params) { - if (isup()) + if (isup()) { isup()->initialize(¶ms); - setPointCode(params); + isup()->setPointCode(params); + } return true; } @@ -2239,44 +2237,6 @@ bool SigSS7Isup::verifyController(const NamedList* params, bool save) return changed; } -unsigned int SigSS7Isup::setPointCode(const NamedList& sect) -{ - if (!isup()) - return 0; - unsigned int count = 0; - unsigned int n = sect.length(); - NamedString* defPc = 0; - for (unsigned int i= 0; i < n; i++) { - NamedString* ns = sect.getParam(i); - if (!ns) - continue; - if (ns->name() == "defaultpointcode") { - defPc = ns; - continue; - } - if (ns->name() != "pointcode") - continue; - SS7PointCode* pc = new SS7PointCode(0,0,0); - if (pc->assign(*ns) && isup()->setPointCode(pc,false)) - count++; - else { - Debug(&plugin,DebugNote,"Invalid %s=%s in section '%s'", - ns->name().c_str(),ns->safe(),sect.safe()); - TelEngine::destruct(pc); - } - } - if (defPc) { - SS7PointCode* pc = new SS7PointCode(0,0,0); - if (!(pc->assign(*defPc) && isup()->hasPointCode(*pc) && - isup()->setPointCode(pc,true))) { - Debug(&plugin,DebugNote,"Invalid %s=%s in section '%s'", - defPc->name().c_str(),defPc->safe(),sect.safe()); - TelEngine::destruct(pc); - } - } - return count; -} - /** * SigIsdn