From 3a6bb559102bb22e08381ef0b66f948cc5dfa3cc Mon Sep 17 00:00:00 2001 From: paulc Date: Mon, 28 Mar 2011 11:19:22 +0000 Subject: [PATCH] Added "netindicator" setting for linksets so it's no longer required to restrict types using netind2pctype. git-svn-id: http://voip.null.ro/svn/yate@4220 acf43c95-373e-0410-b603-e72c3f656dc1 --- conf.d/ysigchan.conf.sample | 12 ++++++++++++ libs/ysig/layer3.cpp | 11 ++++++++++- libs/ysig/router.cpp | 1 + libs/ysig/yatesig.h | 26 ++++++++++++++++++++++++-- 4 files changed, 47 insertions(+), 3 deletions(-) diff --git a/conf.d/ysigchan.conf.sample b/conf.d/ysigchan.conf.sample index 3e9e438e..5864752e 100644 --- a/conf.d/ysigchan.conf.sample +++ b/conf.d/ysigchan.conf.sample @@ -468,6 +468,10 @@ ; netind2pctype=ANSI8,ITU,ANSI,ITU ;netind2pctype= +; netindicator: keyword: Default value of Network Indicator bits +; Allowed values: international, spareinternational, national, reservednational +;netindicator=national + ; route: string: Build a destination route for the SS7 network ; The format of this option is pointcodetype,label,priority ; This parameter can be repeated to build multiple destination routes @@ -629,6 +633,14 @@ ; Example: local=ITU,2-2-4 ;local= +; priority: keyword: Value of the Priority bits in the Service Information Octet +; Allowed values: regular, special, circuit, facility +;priority=regular + +; netindicator: keyword: Default value of Network Indicator bits in the SIO +; Allowed values: international, spareinternational, national, reservednational +;netindicator=national + ; changemsgs: boolean: Emit and process changeover and changeback messages ; Disabling these messages forces always using time controlled diversion ;changemsgs=yes diff --git a/libs/ysig/layer3.cpp b/libs/ysig/layer3.cpp index dadde4a3..ab24fb67 100644 --- a/libs/ysig/layer3.cpp +++ b/libs/ysig/layer3.cpp @@ -59,7 +59,7 @@ SS7Layer3::SS7Layer3(SS7PointCode::Type type) : SignallingComponent("SS7Layer3"), m_routeMutex(true,"SS7Layer3::route"), m_l3userMutex(true,"SS7Layer3::l3user"), - m_l3user(0) + m_l3user(0), m_defNI(SS7MSU::National) { for (unsigned int i = 0; i < YSS7_PCTYPE_COUNT; i++) m_local[i] = 0; @@ -69,6 +69,8 @@ SS7Layer3::SS7Layer3(SS7PointCode::Type type) // Initialize the Layer 3 component bool SS7Layer3::initialize(const NamedList* config) { + if (config) + setNI(SS7MSU::getNetIndicator(config->getValue("netindicator"),SS7MSU::National)); if (engine() && !user()) { NamedList params("ss7router"); if (config) @@ -145,6 +147,13 @@ unsigned char SS7Layer3::getNI(SS7PointCode::Type pcType, unsigned char defNI) c return defNI; } +void SS7Layer3::setNI(unsigned char defNI) +{ + if ((defNI & 0xc0) == 0) + defNI <<= 6; + m_defNI = defNI & 0xc0; +} + bool SS7Layer3::hasType(SS7PointCode::Type pcType) const { if (SS7PointCode::Other == pcType) diff --git a/libs/ysig/router.cpp b/libs/ysig/router.cpp index 99d27daf..56ea377a 100644 --- a/libs/ysig/router.cpp +++ b/libs/ysig/router.cpp @@ -376,6 +376,7 @@ bool SS7Router::initialize(const NamedList* config) m_transferSilent = (*tr == "silent"); m_transfer = !m_transferSilent && tr->toBoolean(m_transfer); } + setNI(SS7MSU::getNetIndicator(config->getValue("netindicator"),SS7MSU::National)); m_autoAllowed = config->getBoolValue("autoallow",m_autoAllowed); m_sendUnavail = config->getBoolValue("sendupu",m_sendUnavail); m_sendProhibited = config->getBoolValue("sendtfp",m_sendProhibited); diff --git a/libs/ysig/yatesig.h b/libs/ysig/yatesig.h index f4a3a38e..3a119a7c 100644 --- a/libs/ysig/yatesig.h +++ b/libs/ysig/yatesig.h @@ -5727,7 +5727,28 @@ public: * @param defNI Default Network Indicator bits to use * @return Network Indicator bits matching the Point Code type */ - virtual unsigned char getNI(SS7PointCode::Type pcType, unsigned char defNI = SS7MSU::National) const; + virtual unsigned char getNI(SS7PointCode::Type pcType, unsigned char defNI) const; + + /** + * Get the Network Indicator bits that would match a Point Code type + * @param pcType Point Code type to search for + * @return Network Indicator bits matching the Point Code type + */ + inline unsigned char getNI(SS7PointCode::Type pcType) const + { return getNI(pcType,m_defNI); } + + /** + * Get the default Network Indicator bits + * @return Default Network Indicator bits for this layer + */ + inline unsigned char getNI() const + { return m_defNI; } + + /** + * Set the default Network Indicator bits + * @param defNI Network Indicator bits to set as defaults + */ + void setNI(unsigned char defNI); /** * Build the list of outgoing routes serviced by this network. Clear the list before re-building it. @@ -5946,6 +5967,7 @@ private: SS7PointCode::Type m_cpType[4]; // Map incoming MSUs net indicators to point code type // or the routing table of a message router unsigned int m_local[YSS7_PCTYPE_COUNT]; + unsigned char m_defNI; // Default Network Indicator }; /** @@ -6251,7 +6273,7 @@ public: * @param defNI Default Network Indicator bits to use * @return Network Indicator bits matching the Point Code type */ - virtual unsigned char getNI(SS7PointCode::Type pcType, unsigned char defNI = SS7MSU::National) const; + virtual unsigned char getNI(SS7PointCode::Type pcType, unsigned char defNI) const; /** * Retrieve the default local Point Code for a specific Point Code type