Changed the format of the accounts, links and interfaces status reported through engine.status. Added accountUsername OID. Modified the monitoring module to deal with the status change and the need to handle the accountUsername OID information.
git-svn-id: http://voip.null.ro/svn/yate@3938 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
68cfda5b07
commit
5abf18900b
|
@ -365,7 +365,7 @@ public:
|
|||
inline bool canHandleProtocol(const String& proto)
|
||||
{ return proto == "jabber"; }
|
||||
// List accounts
|
||||
void statusAccounts(String& retVal);
|
||||
void statusAccounts(String& retVal, bool details = true);
|
||||
|
||||
protected:
|
||||
// Inherited methods
|
||||
|
@ -2186,7 +2186,7 @@ bool JBModule::received(Message& msg, int id)
|
|||
return Module::received(msg,id);
|
||||
// Handle: status jabberclient stream_name
|
||||
if (target == "accounts")
|
||||
statusAccounts(msg.retValue());
|
||||
statusAccounts(msg.retValue(),msg.getBoolValue("details",true));
|
||||
else {
|
||||
statusModule(msg.retValue());
|
||||
s_jabber->statusDetail(msg.retValue(),target);
|
||||
|
@ -2296,8 +2296,14 @@ bool JBModule::commandComplete(Message& msg, const String& partLine,
|
|||
if (word == "status") {
|
||||
// Handle: status jabberclient stream_name
|
||||
getWord(line,word);
|
||||
if (word != name())
|
||||
if (word != name()) {
|
||||
if (word == "overview") {
|
||||
getWord(line,word);
|
||||
if (word == name() && line.null())
|
||||
itemComplete(msg.retValue(),"accounts",partWord);
|
||||
}
|
||||
return Module::commandComplete(msg,partLine,partWord);
|
||||
}
|
||||
getWord(line,word);
|
||||
if (word == "accounts")
|
||||
return false;
|
||||
|
@ -2371,13 +2377,24 @@ bool JBModule::commandExecute(String& retVal, const String& line)
|
|||
return true;
|
||||
}
|
||||
|
||||
void JBModule::statusAccounts(String& retVal)
|
||||
void JBModule::statusAccounts(String& retVal, bool details)
|
||||
{
|
||||
DDebug(this,DebugAll,"List the status of all accounts");
|
||||
RefPointer<JBStreamSetList> list;
|
||||
s_jabber->getStreamList(list,JBStream::c2s);
|
||||
|
||||
retVal.clear();
|
||||
retVal << "module=" << name();
|
||||
retVal << ",protocol=Jabber";
|
||||
retVal << ",format=Username|Status;";
|
||||
retVal << "accounts=";
|
||||
if (!list)
|
||||
retVal << 0;
|
||||
else
|
||||
retVal << list->sets().count();
|
||||
if (!details)
|
||||
return;
|
||||
|
||||
String str = "";
|
||||
list->lock();
|
||||
for (ObjList* o = list->sets().skipNull(); o; o = o->skipNext()) {
|
||||
|
@ -2385,19 +2402,15 @@ void JBModule::statusAccounts(String& retVal)
|
|||
for (ObjList* s = set->clients().skipNull(); s; s = s->skipNext()) {
|
||||
JBClientStream* stream = static_cast<JBClientStream*>(s->get());
|
||||
stream->lock();
|
||||
str.append(stream->local().bare(),",");
|
||||
str << "=Jabber|";
|
||||
str.append(stream->account(),",") << "=";
|
||||
str.append(stream->local().bare()) << "|";
|
||||
str << stream->stateName();
|
||||
stream->unlock();
|
||||
}
|
||||
}
|
||||
list->unlock();
|
||||
list = 0;
|
||||
if (retVal.null()) {
|
||||
retVal << "module=" << name();
|
||||
retVal << ",format=Protocol|Status;";
|
||||
}
|
||||
retVal << str;
|
||||
retVal.append(str,";");
|
||||
}
|
||||
|
||||
}; // anonymous namespace
|
||||
|
|
|
@ -2482,9 +2482,9 @@ void H323Driver::initialize()
|
|||
|
||||
bool H323Driver::commandComplete(Message& msg, const String& partLine, const String& partWord)
|
||||
{
|
||||
String cmd = s_statusCmd;
|
||||
cmd << " " << name();
|
||||
if (partLine == cmd)
|
||||
String cmd = s_statusCmd + " " + name();
|
||||
String overviewCmd = s_statusCmd + " overview " + name();
|
||||
if (partLine == cmd || partLine == overviewCmd)
|
||||
itemComplete(msg.retValue(),"accounts",partWord);
|
||||
else
|
||||
return Driver::commandComplete(msg,partLine,partWord);
|
||||
|
@ -2501,10 +2501,17 @@ void H323Driver::msgStatus(Message& msg)
|
|||
if (str.startSkip("accounts")) {
|
||||
msg.retValue().clear();
|
||||
msg.retValue() << "module=" << name();
|
||||
msg.retValue() << ",format=Protocol|Status";
|
||||
msg.retValue() << ",protocol=H323";
|
||||
msg.retValue() << ",format=Username|Status;";
|
||||
msg.retValue() << "accounts=" << m_endpoints.count();
|
||||
if (!msg.getBoolValue("details",true)) {
|
||||
msg.retValue() << "\r\n";
|
||||
return;
|
||||
}
|
||||
for (ObjList* o = m_endpoints.skipNull(); o; o = o->skipNext()) {
|
||||
YateH323EndPoint* ep = static_cast<YateH323EndPoint*>(o->get());
|
||||
str.append(ep->c_str(),",") << "=H323|";
|
||||
str.append(ep->c_str(),",") << "=";
|
||||
str.append("") << "|";
|
||||
str << (ep->IsRegisteredWithGatekeeper() ? "registered" : "not-registered");
|
||||
}
|
||||
msg.retValue().append(str,";");
|
||||
|
|
|
@ -228,7 +228,7 @@ public:
|
|||
CALLER = 5, // caller party
|
||||
CALLED = 6, // called party
|
||||
PEER = 7, // peer(s) channel of a call
|
||||
DURATION = 8 // call duration
|
||||
DURATION = 8, // call duration
|
||||
};
|
||||
// Constructor
|
||||
inline ActiveCallsInfo()
|
||||
|
@ -260,7 +260,7 @@ public:
|
|||
STATUS = 4, // status of a component
|
||||
TYPE = 5, // the type of the component
|
||||
ALARMS_COUNT = 6, // alarm counter for the component
|
||||
SKIP = 7 // helper value to skip unnecessary information when parsing the status string
|
||||
SKIP = 7, // helper value to skip unnecessary information when parsing the status string
|
||||
};
|
||||
// Constructor
|
||||
inline SigInfo(const char* name, const TokenDict* dict)
|
||||
|
@ -385,7 +385,8 @@ public:
|
|||
INDEX = 2,
|
||||
ID = 3,
|
||||
STATUS = 4,
|
||||
PROTO = 5
|
||||
PROTO = 5,
|
||||
USERNAME = 6,
|
||||
};
|
||||
// Constructor
|
||||
inline AccountsInfo()
|
||||
|
@ -671,7 +672,7 @@ class CallRouteQoS : public GenObject
|
|||
public:
|
||||
enum CallStatus {
|
||||
ANSWERED = 1,
|
||||
DELIVERED = 2
|
||||
DELIVERED = 2,
|
||||
};
|
||||
enum Indexes {
|
||||
CURRENT_IDX = 0,
|
||||
|
@ -793,13 +794,13 @@ public:
|
|||
IN_ASR_Idx = 0,
|
||||
OUT_ASR_Idx = 1,
|
||||
IN_NER_Idx = 2,
|
||||
OUT_NER_Idx = 3
|
||||
OUT_NER_Idx = 3,
|
||||
};
|
||||
|
||||
enum Queries {
|
||||
INCOMING_CALLS = 9,
|
||||
OUTGOING_CALLS = 10,
|
||||
ROUTES_COUNT = 11
|
||||
ROUTES_COUNT = 11,
|
||||
};
|
||||
|
||||
// constructor
|
||||
|
@ -867,7 +868,7 @@ public:
|
|||
LINKS = 15,
|
||||
IFACES = 16,
|
||||
ACCOUNTS = 17,
|
||||
MGCP = 18
|
||||
MGCP = 18,
|
||||
};
|
||||
|
||||
enum SigTypes {
|
||||
|
@ -889,7 +890,7 @@ public:
|
|||
LinkDown,
|
||||
LinkUp,
|
||||
IsdnQ921Down,
|
||||
IsdnQ921Up
|
||||
IsdnQ921Up,
|
||||
};
|
||||
|
||||
enum SipNotifs {
|
||||
|
@ -898,7 +899,7 @@ public:
|
|||
ByesTimedOut,
|
||||
GWTimeout,
|
||||
GWUp,
|
||||
DeletesTimedOut
|
||||
DeletesTimedOut,
|
||||
};
|
||||
Monitor();
|
||||
virtual ~Monitor();
|
||||
|
@ -1073,6 +1074,7 @@ static TokenDict s_categories[] = {
|
|||
{"accountID", Monitor::ACCOUNTS},
|
||||
{"accountStatus", Monitor::ACCOUNTS},
|
||||
{"accountProtocol", Monitor::ACCOUNTS},
|
||||
{"accountUsername", Monitor::ACCOUNTS},
|
||||
// active calls info
|
||||
{"activeCallsCount", Monitor::ACTIVE_CALLS},
|
||||
{"callEntryIndex", Monitor::ACTIVE_CALLS},
|
||||
|
@ -1243,6 +1245,7 @@ static TokenDict s_accountInfo[] = {
|
|||
{"accountID", AccountsInfo::ID},
|
||||
{"accountStatus", AccountsInfo::STATUS},
|
||||
{"accountProtocol", AccountsInfo::PROTO},
|
||||
{"accountUsername", AccountsInfo::USERNAME},
|
||||
{0,0}
|
||||
};
|
||||
|
||||
|
@ -2036,7 +2039,17 @@ bool AccountsInfo::load()
|
|||
continue;
|
||||
|
||||
cutNewLine(status);
|
||||
int pos = status.rfind(';');
|
||||
//find protocol
|
||||
String protoParam = "protocol=";
|
||||
int pos = status.find(protoParam);
|
||||
if (pos < 0)
|
||||
continue;
|
||||
int auxPos = status.find(",",pos);
|
||||
if (auxPos < pos + (int)protoParam.length())
|
||||
continue;
|
||||
String proto = status.substr(pos + protoParam.length(),auxPos - (pos + protoParam.length()));
|
||||
|
||||
pos = status.rfind(';');
|
||||
if (pos < 0)
|
||||
continue;
|
||||
status = status.substr(pos + 1);
|
||||
|
@ -2049,13 +2062,14 @@ bool AccountsInfo::load()
|
|||
if (pos1 < 0 || pos2 < 0)
|
||||
continue;
|
||||
String name = account->substr(0,pos1);
|
||||
String proto = account->substr(pos1 + 1,pos2 - pos1 -1);
|
||||
String username = account->substr(pos1 + 1,pos2 - pos1 -1);
|
||||
String status = account->substr(pos2 + 1);
|
||||
|
||||
if (name.null())
|
||||
continue;
|
||||
NamedList* nl = new NamedList("");
|
||||
nl->setParam(lookup(ID,s_accountInfo,""),name);
|
||||
nl->setParam(lookup(USERNAME,s_accountInfo,""),username);
|
||||
nl->setParam(lookup(STATUS,s_accountInfo,""),status);
|
||||
nl->setParam(lookup(PROTO,s_accountInfo,""),proto);
|
||||
m_table.append(nl);
|
||||
|
|
|
@ -1722,8 +1722,9 @@ bool SigDriver::received(Message& msg, int id)
|
|||
return false;
|
||||
if (target.startSkip("links")) {
|
||||
msg.retValue() << "module=" << name();
|
||||
msg.retValue() << ",format=Type|Status";
|
||||
String ret = "";
|
||||
msg.retValue() << ",format=Type|Status;";
|
||||
|
||||
String ret;
|
||||
m_trunksMutex.lock();
|
||||
for (ObjList* o = m_trunks.skipNull(); o; o = o->skipNext()) {
|
||||
SigTrunk* trunk = static_cast<SigTrunk*>(o->get());
|
||||
|
@ -1736,14 +1737,20 @@ bool SigDriver::received(Message& msg, int id)
|
|||
top->linkStatus(ret);
|
||||
}
|
||||
m_topmostMutex.unlock();
|
||||
if (!ret.null())
|
||||
msg.retValue() << ";" << ret;
|
||||
|
||||
ObjList* l = ret.split(',',false);
|
||||
msg.retValue() << "count=" << l->count();
|
||||
TelEngine::destruct(l);
|
||||
if (msg.getBoolValue("details",true))
|
||||
msg.retValue().append(ret,";");
|
||||
|
||||
msg.retValue() << "\r\n";
|
||||
}
|
||||
if (target.startSkip("ifaces")) {
|
||||
msg.retValue() << "module=" << name();
|
||||
msg.retValue() << ",format=Status";
|
||||
String ret = "";
|
||||
msg.retValue() << ",format=Status;";
|
||||
|
||||
String ret;
|
||||
m_trunksMutex.lock();
|
||||
for (ObjList* o = m_trunks.skipNull(); o; o = o->skipNext()) {
|
||||
SigTrunk* trunk = static_cast<SigTrunk*>(o->get());
|
||||
|
@ -1756,8 +1763,13 @@ bool SigDriver::received(Message& msg, int id)
|
|||
top->ifStatus(ret);
|
||||
}
|
||||
m_topmostMutex.unlock();
|
||||
if (!ret.null())
|
||||
msg.retValue() << ";" << ret;
|
||||
|
||||
ObjList* l = ret.split(',',false);
|
||||
msg.retValue() << "count=" << l->count();
|
||||
TelEngine::destruct(l);
|
||||
if (msg.getBoolValue("details",true))
|
||||
msg.retValue().append(ret,";");
|
||||
|
||||
msg.retValue() << "\r\n";
|
||||
}
|
||||
|
||||
|
@ -2058,6 +2070,12 @@ bool SigDriver::commandComplete(Message& msg, const String& partLine,
|
|||
bool drop = !status && partLine.startsWith("drop");
|
||||
if (!(status || drop))
|
||||
return Driver::commandComplete(msg,partLine,partWord);
|
||||
String overviewCmd = "status overview " + name();
|
||||
if (partLine == overviewCmd) {
|
||||
itemComplete(msg.retValue(),"links",partWord);
|
||||
itemComplete(msg.retValue(),"ifaces",partWord);
|
||||
return true;
|
||||
}
|
||||
|
||||
Lock lock(this);
|
||||
// line='status sig': add trunks and topmost components
|
||||
|
|
|
@ -1434,9 +1434,9 @@ bool YIAXDriver::userAuth(IAXTransaction* tr, bool response, bool& requestAuth,
|
|||
|
||||
bool YIAXDriver::commandComplete(Message& msg, const String& partLine, const String& partWord)
|
||||
{
|
||||
String cmd = s_statusCmd;
|
||||
cmd << " " << name();
|
||||
if (partLine == cmd)
|
||||
String cmd = s_statusCmd + " " + name();
|
||||
String overviewCmd = s_statusCmd + " overview " + name();
|
||||
if (partLine == cmd || partLine == overviewCmd)
|
||||
itemComplete(msg.retValue(),"accounts",partWord);
|
||||
else
|
||||
return Driver::commandComplete(msg,partLine,partWord);
|
||||
|
@ -1453,10 +1453,17 @@ void YIAXDriver::msgStatus(Message& msg)
|
|||
if (str.startSkip("accounts")) {
|
||||
msg.retValue().clear();
|
||||
msg.retValue() << "module=" << name();
|
||||
msg.retValue() << ",format=Protocol|Status";
|
||||
msg.retValue() << ",protocol=IAX";
|
||||
msg.retValue() << ",format=Username|Status;";
|
||||
msg.retValue() << "accounts=" << s_lines.lines()->count();
|
||||
if (!msg.getBoolValue("details",true)) {
|
||||
msg.retValue() << "\r\n";
|
||||
return;
|
||||
}
|
||||
for (ObjList* o = s_lines.lines(); o; o = o->skipNext()) {
|
||||
YIAXLine* line = static_cast<YIAXLine*>(o->get());
|
||||
str.append(line->username(),",") << "=IAX|";
|
||||
str.append(line->toString(),",") << "=";
|
||||
str.append(line->username()) << "|";
|
||||
str << (line-> registered() ? "online" : "offline");
|
||||
}
|
||||
msg.retValue().append(str,";");
|
||||
|
|
|
@ -4287,9 +4287,9 @@ void SIPDriver::genUpdate(Message& msg)
|
|||
|
||||
bool SIPDriver::commandComplete(Message& msg, const String& partLine, const String& partWord)
|
||||
{
|
||||
String cmd = s_statusCmd;
|
||||
cmd << " " << name();
|
||||
if (partLine == cmd)
|
||||
String cmd = s_statusCmd + " " + name();
|
||||
String overviewCmd = s_statusCmd + " overview " + name();
|
||||
if (partLine == cmd || partLine == overviewCmd)
|
||||
itemComplete(msg.retValue(),"accounts",partWord);
|
||||
else
|
||||
return Driver::commandComplete(msg,partLine,partWord);
|
||||
|
@ -4306,11 +4306,18 @@ void SIPDriver::msgStatus(Message& msg)
|
|||
else if (str.startSkip("accounts")) {
|
||||
msg.retValue().clear();
|
||||
msg.retValue() << "module=" << name();
|
||||
msg.retValue() << ",format=Protocol|Status";
|
||||
msg.retValue() << ",protocol=SIP";
|
||||
msg.retValue() << ",format=Username|Status;";
|
||||
msg.retValue() << "accounts=" << s_lines.count();
|
||||
if (!msg.getBoolValue("details",true)) {
|
||||
msg.retValue() << "\r\n";
|
||||
return;
|
||||
}
|
||||
String accounts = "";
|
||||
for (ObjList* o = s_lines.skipNull(); o; o = o->skipNext()) {
|
||||
YateSIPLine* line = static_cast<YateSIPLine*>(o->get());
|
||||
accounts.append(line->getUserName(),",") << "=SIP|";
|
||||
accounts.append(line->c_str(),",") << "=";
|
||||
accounts.append(line->getUserName()) << "|";
|
||||
accounts << (line->valid() ? "online" : "offline");
|
||||
}
|
||||
msg.retValue().append(accounts,";");
|
||||
|
|
|
@ -727,7 +727,8 @@ AccountEntry ::= SEQUENCE {
|
|||
accountIndex Counter32,
|
||||
accountID DisplayString,
|
||||
accountStatus DisplayString,
|
||||
accountProtocol DisplayString
|
||||
accountProtocol DisplayString,
|
||||
accountUsername DisplayString
|
||||
}
|
||||
|
||||
accountIndex OBJECT-TYPE
|
||||
|
@ -762,6 +763,14 @@ accountProtocol OBJECT-TYPE
|
|||
"The protocol used for this account."
|
||||
::= { accountEntry 4 }
|
||||
|
||||
accountUsername OBJECT-TYPE
|
||||
SYNTAX DisplayString
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The username used by this account."
|
||||
::= { accountEntry 5 }
|
||||
|
||||
-- accounts end
|
||||
|
||||
-- connections END
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; generated on Nov 30, 2010 4:17 PM. DO NOT MODIFY!
|
||||
; generated on Dec 9, 2010 1:58 PM. DO NOT MODIFY!
|
||||
|
||||
[1.3]
|
||||
name=org
|
||||
|
@ -674,6 +674,11 @@ name=accountProtocol
|
|||
access=read-only
|
||||
type=DisplayString
|
||||
|
||||
[1.3.6.1.4.1.34501.1.6.6.2.1.5]
|
||||
name=accountUsername
|
||||
access=read-only
|
||||
type=DisplayString
|
||||
|
||||
[1.3.6.1.4.1.34501.1.7]
|
||||
name=statistics
|
||||
|
||||
|
|
Loading…
Reference in New Issue