Check the route status of the STP too if routing an User Part message.

Perform time controlled rerouting on all routes on a STP whose state changed.


git-svn-id: http://voip.null.ro/svn/yate@3742 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2010-10-21 13:53:06 +00:00
parent 024add22c5
commit 373045e192
3 changed files with 21 additions and 10 deletions

View File

@ -236,14 +236,18 @@ unsigned int SS7Layer3::getRoutePriority(SS7PointCode::Type type, unsigned int p
}
// Get the state of a route.
SS7Route::State SS7Layer3::getRouteState(SS7PointCode::Type type, unsigned int packedPC)
SS7Route::State SS7Layer3::getRouteState(SS7PointCode::Type type, unsigned int packedPC, bool checkAdjacent)
{
if (type == SS7PointCode::Other || (unsigned int)type > YSS7_PCTYPE_COUNT || !packedPC)
return SS7Route::Unknown;
Lock lock(m_routeMutex);
SS7Route* route = findRoute(type,packedPC);
if (route)
return route->state();
for (ObjList* o = m_route[type-1].skipNull(); o; o = o->skipNext()) {
SS7Route* route = static_cast<SS7Route*>(o->get());
if (route->packed() == packedPC)
return route->state();
if (checkAdjacent && !route->priority() && !(route->state() & SS7Route::NotProhibited))
return route->state();
}
return SS7Route::Unknown;
}

View File

@ -241,13 +241,14 @@ int SS7Route::transmitInternal(const SS7Router* router, const SS7MSU& msu,
const SS7Label& label, int sls, State states, const SS7Layer3* source)
{
int offs = 0;
if (msu.getSIF() > SS7MSU::MTNS)
bool userPart = (msu.getSIF() > SS7MSU::MTNS);
if (userPart)
offs = sls >> shift();
ListIterator iter(m_networks,offs);
while (L3Pointer* p = static_cast<L3Pointer*>(iter.get())) {
RefPointer<SS7Layer3> l3 = static_cast<SS7Layer3*>(*p);
if (!l3 || (l3 == source) ||
!(l3->getRouteState(label.type(),label.dpc()) & states))
!(l3->getRouteState(label.type(),label.dpc(),userPart) & states))
continue;
unlock();
XDebug(router,DebugAll,"Attempting transmitMSU on L3=%p '%s' [%p]",
@ -1156,7 +1157,11 @@ bool SS7Router::setRouteSpecificState(SS7PointCode::Type type, unsigned int pack
r->packed(),r->priority(),l3->toString().c_str(),
SS7Route::stateName(r->state()),SS7Route::stateName(state));
if (r->m_state != state) {
route->reroute();
// controlled reroute for the entire linkset if node is adjacent
if (!r->priority())
reroute(l3);
else
route->reroute();
r->m_state = state;
}
}

View File

@ -5661,19 +5661,21 @@ public:
* This method is thread safe
* @param type Destination point code type
* @param packedPC The packed point code
* @param checkAdjacent True to take into account the adjacent STP
* @return The state of the route, SS7Route::Unknown if no route to the given point code
*/
SS7Route::State getRouteState(SS7PointCode::Type type, unsigned int packedPC);
SS7Route::State getRouteState(SS7PointCode::Type type, unsigned int packedPC, bool checkAdjacent = false);
/**
* Get the current state of a route by unpacked Point Code.
* This method is thread safe
* @param type Destination point code type
* @param dest The destination point code
* @param checkAdjacent True to take into account the adjacent STP
* @return The state of the route, SS7Route::Unknown if no route to the given point code
*/
inline SS7Route::State getRouteState(SS7PointCode::Type type, const SS7PointCode& dest)
{ return getRouteState(type,dest.pack(type)); }
inline SS7Route::State getRouteState(SS7PointCode::Type type, const SS7PointCode& dest, bool checkAdjacent = false)
{ return getRouteState(type,dest.pack(type),checkAdjacent); }
/**
* Check if access to a specific Point Code is allowed from this network