Engine::init() is now available in javascript.

git-svn-id: http://voip.null.ro/svn/yate@6300 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2018-03-12 14:10:45 +00:00
parent 871aeae4c5
commit b3ee072711
1 changed files with 16 additions and 0 deletions

View File

@ -324,6 +324,7 @@ public:
params().addParam(new ExpFunction("yield"));
params().addParam(new ExpFunction("idle"));
params().addParam(new ExpFunction("restart"));
params().addParam(new ExpFunction("init"));
params().addParam(new ExpFunction("dump_r"));
params().addParam(new ExpFunction("print_r"));
params().addParam(new ExpFunction("dump_t"));
@ -1534,6 +1535,21 @@ bool JsEngine::runNative(ObjList& stack, const ExpOperation& oper, GenObject* co
Debug(&__plugin,DebugNote,"Engine restart is disabled by allow_abort configuration");
ExpEvaluator::pushOne(stack,new ExpOperation(ok));
}
else if (oper.name() == YSTRING("init")) {
bool ok = true;
if (!oper.number())
Engine::init();
else if (oper.number() == 1) {
ExpOperation* module = popValue(stack,context);
if (!module)
return false;
ok = Engine::init(*module);
TelEngine::destruct(module);
}
else
return false;
ExpEvaluator::pushOne(stack,new ExpOperation(ok));
}
else if (oper.name() == YSTRING("uptime")) {
SysUsage::Type typ = SysUsage::WallTime;
bool msec = false;