Generate events when SS7 Layer2 status changes.

git-svn-id: http://yate.null.ro/svn/yate/trunk@4964 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2012-03-15 16:03:22 +00:00
parent b84b00a104
commit c8c65602e4
1 changed files with 17 additions and 2 deletions

View File

@ -176,13 +176,28 @@ void SS7Layer2::timerTick(const Time& when)
void SS7Layer2::notify() void SS7Layer2::notify()
{ {
if (!operational()) unsigned int wasUp = 0;
bool doNotify = false;
if (!operational()) {
wasUp = upTime();
m_lastUp = 0; m_lastUp = 0;
else if (!m_lastUp) doNotify = (wasUp != 0);
}
else if (!m_lastUp) {
m_lastUp = Time::secNow(); m_lastUp = Time::secNow();
doNotify = true;
}
m_l2userMutex.lock(); m_l2userMutex.lock();
m_notify = true; m_notify = true;
m_l2userMutex.unlock(); m_l2userMutex.unlock();
if (doNotify && engine()) {
NamedList params("");
params.addParam("from",toString());
params.addParam("type","ss7-layer2");
params.addParam("operational",String::boolText(operational()));
params.addParam("text",statusName());
engine()->notify(this,params);
}
} }
unsigned int SS7Layer2::status() const unsigned int SS7Layer2::status() const