Added option to get the age of a message.

git-svn-id: http://yate.null.ro/svn/yate/trunk@6211 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
andrei 2017-04-27 12:30:45 +00:00
parent d836aca12b
commit f44fef8bfc
1 changed files with 10 additions and 0 deletions

View File

@ -311,6 +311,7 @@ public:
params().addParam(new ExpFunction("broadcast"));
params().addParam(new ExpFunction("retValue"));
params().addParam(new ExpFunction("msgTime"));
params().addParam(new ExpFunction("msgAge"));
params().addParam(new ExpFunction("getParam"));
params().addParam(new ExpFunction("setParam"));
params().addParam(new ExpFunction("getColumn"));
@ -1785,6 +1786,15 @@ bool JsMessage::runNative(ObjList& stack, const ExpOperation& oper, GenObject* c
return false;
}
}
else if (oper.name() == YSTRING("msgAge")) {
if (oper.number())
return false;
if (m_message)
ExpEvaluator::pushOne(stack,new ExpOperation(
(int64_t)(Time::msecNow() - m_message->msgTime().msec())));
else
ExpEvaluator::pushOne(stack,JsParser::nullClone());
}
else if (oper.name() == YSTRING("getParam")) {
bool autoNum = true;
ObjList args;