Commit Graph

185 Commits

Author SHA1 Message Date
marian c7e3515eed Fixed return of matching item description. 2023-03-31 13:22:08 +03:00
marian ebf8bcc9b2 Added support for multiple filters in MessageHandler.
Added javascript matching item class.
Added javascript support to set multiple filters when installing message handlers.
2023-03-27 16:07:39 +03:00
marian 3436092371 Added javascript support for callback function set when a message is enqueued by a script. Call the function after message was dispatched. 2023-03-15 16:58:21 +02:00
marian ac720b2209 Update number of instances in script's context.
Added support for scripts to install a 'reinit' event callback (allowed for global instances only, called on javascript module init). This will allow them to detect instance count changes.
2023-03-06 16:46:39 +02:00
marian 5ed7e84f2c Added javascript support to install message handlers running a separate context for each handled message.
Handlers can be installed from a global script or separate config section.
Added support to share objects (JsObject descendants implementing cloneForCopy() method) between scripts. Each script will obtain a copy of a shared object.
2023-03-06 15:00:41 +02:00
marian d43863899a Added extra parameter to config clearKey() method used to clear key(s) matching a given value.
git-svn-id: http://voip.null.ro/svn/yate@6563 acf43c95-373e-0410-b603-e72c3f656dc1
2022-06-27 08:25:05 +00:00
marian a2866f6206 Added File.listDirectory() function. Added extra optional parameter to XML.xmlText() for all lines indent length.
git-svn-id: http://voip.null.ro/svn/yate@6548 acf43c95-373e-0410-b603-e72c3f656dc1
2022-03-08 11:06:08 +00:00
oana a0d085b165 Cleanup created script instances if they failed to run.
git-svn-id: http://voip.null.ro/svn/yate@6545 acf43c95-373e-0410-b603-e72c3f656dc1
2022-03-02 15:32:00 +00:00
oana 94a2b7ce80 Add support for building and running multiple instances of the same script.
git-svn-id: http://voip.null.ro/svn/yate@6542 acf43c95-373e-0410-b603-e72c3f656dc1
2022-02-09 10:59:28 +00:00
marian a6e91f6b7d Added javascript XPath escape string method.
git-svn-id: http://voip.null.ro/svn/yate@6540 acf43c95-373e-0410-b603-e72c3f656dc1
2022-02-01 10:33:19 +00:00
marian f6fa058aa3 Export XPath in javascript.
git-svn-id: http://voip.null.ro/svn/yate@6537 acf43c95-373e-0410-b603-e72c3f656dc1
2022-01-11 09:02:56 +00:00
marian f74685918c Added functions used to set/add a list of parameters in configuration and section.
git-svn-id: http://voip.null.ro/svn/yate@6532 acf43c95-373e-0410-b603-e72c3f656dc1
2021-12-22 07:03:35 +00:00
marian 76b412d4ea Added dump_t/print_t support to handle field name mapping. Added parameter to allow printing empty results (header only).
git-svn-id: http://voip.null.ro/svn/yate@6530 acf43c95-373e-0410-b603-e72c3f656dc1
2021-12-13 07:29:32 +00:00
marian 27ba8dfbec Added support for JSON Path (find value in object by path). Fixed JSON.stringify(): avoid crashing on circular references, replace already found objects by their path reference. Report path in Engine.dump_r for already found objects.
git-svn-id: http://voip.null.ro/svn/yate@6525 acf43c95-373e-0410-b603-e72c3f656dc1
2021-10-27 10:22:53 +00:00
marian 495ae65bc9 Fixed dump_t bug: wrong field handling for late added columns. Added support to dump array of rows with first element array containing header names.
git-svn-id: http://voip.null.ro/svn/yate@6523 acf43c95-373e-0410-b603-e72c3f656dc1
2021-10-07 12:49:07 +00:00
marian 8a46774099 Added support to create arbitrary named lists of shared vars (separate from Engine's global). Added extra functions to shared vars list. Export in javascript.
git-svn-id: http://voip.null.ro/svn/yate@6521 acf43c95-373e-0410-b603-e72c3f656dc1
2021-09-28 10:55:08 +00:00
paulc 06546d08e5 Set the name for the JS scheduler thread so it can be identified.
git-svn-id: http://voip.null.ro/svn/yate@6495 acf43c95-373e-0410-b603-e72c3f656dc1
2021-05-21 15:26:13 +00:00
marian 921a3108f8 Fixed bug: clear timer events before engine and runner to make sure all objects are released while script context is valid.
git-svn-id: http://voip.null.ro/svn/yate@6494 acf43c95-373e-0410-b603-e72c3f656dc1
2021-05-20 12:24:31 +00:00
marian b6275067fa Fixed bug: re-insert time events in list before calling the callback to allow scripts to safely remove the event in callback.
git-svn-id: http://voip.null.ro/svn/yate@6493 acf43c95-373e-0410-b603-e72c3f656dc1
2021-05-19 14:16:06 +00:00
paulc e052feba69 Added Javascript method to set the engine congestion.
git-svn-id: http://voip.null.ro/svn/yate@6490 acf43c95-373e-0410-b603-e72c3f656dc1
2021-05-18 18:07:43 +00:00
oana eb65a68dc7 Allow javascript to retrieve engine congestion level.
git-svn-id: http://voip.null.ro/svn/yate@6489 acf43c95-373e-0410-b603-e72c3f656dc1
2021-05-18 12:19:21 +00:00
marian 4f6c89c694 Fixed bug: check pointer before use in Engine.output.
git-svn-id: http://voip.null.ro/svn/yate@6488 acf43c95-373e-0410-b603-e72c3f656dc1
2021-05-17 08:42:30 +00:00
paulc ac7ca86885 Don't add spacing for empty strings in Engine.output(), just like in Engine.debug().
git-svn-id: http://voip.null.ro/svn/yate@6479 acf43c95-373e-0410-b603-e72c3f656dc1
2021-04-16 10:24:17 +00:00
marian 39e16e093b Added support to pass file open parameters to File.setContent function. Fixed code alignment.
git-svn-id: http://voip.null.ro/svn/yate@6476 acf43c95-373e-0410-b603-e72c3f656dc1
2021-04-05 08:46:50 +00:00
oana 8b0aab86a8 Protect access to object tracking list of the script execution context.
Some objects are created outside of the context.



git-svn-id: http://voip.null.ro/svn/yate@6447 acf43c95-373e-0410-b603-e72c3f656dc1
2020-10-29 16:28:49 +00:00
oana d5a835c3cf Minor fix: return sections of a configuration file as object instead of array.
git-svn-id: http://voip.null.ro/svn/yate@6443 acf43c95-373e-0410-b603-e72c3f656dc1
2020-10-21 11:53:57 +00:00
oana 83ef49437f Add tracking for Javascript object creation and destruction.
Add command that reports how many objects are still alive that have been created at the reported code line.
Fix constructor for ConfigFile.



git-svn-id: http://voip.null.ro/svn/yate@6442 acf43c95-373e-0410-b603-e72c3f656dc1
2020-10-21 11:01:31 +00:00
marian f4e68d8527 Added support to dump JsHashList items in print_r and toJSON.
git-svn-id: http://voip.null.ro/svn/yate@6439 acf43c95-373e-0410-b603-e72c3f656dc1
2020-10-14 14:03:56 +00:00
paulc a1dd97cf0d Added setting to track created objects per script instead of whole module.
git-svn-id: http://voip.null.ro/svn/yate@6438 acf43c95-373e-0410-b603-e72c3f656dc1
2020-10-14 13:24:46 +00:00
marian a51728652e Added print/dump_r functions used to print/dump a specific variable or script context using flags to filter what to print: props only (default), funcs only ...
git-svn-id: http://voip.null.ro/svn/yate@6437 acf43c95-373e-0410-b603-e72c3f656dc1
2020-10-14 10:38:31 +00:00
marian b3c83d2410 Added support to set Regexp in javascript message handler.
git-svn-id: http://voip.null.ro/svn/yate@6427 acf43c95-373e-0410-b603-e72c3f656dc1
2020-09-22 11:29:22 +00:00
paulc c593990189 Made DNS resolver work with libc versions that don't define __NAMESER.
Initialize the resolver in JS DNS and return null if initialization fails.


git-svn-id: http://voip.null.ro/svn/yate@6422 acf43c95-373e-0410-b603-e72c3f656dc1
2020-08-27 09:54:46 +00:00
marian 21b9d6a32c Added separate (global) mutex used to protect access to Channel::m_status. Removed unsafe public method used to obtain it. Added methods used to safely obtain a copy of it.
git-svn-id: http://voip.null.ro/svn/yate@6410 acf43c95-373e-0410-b603-e72c3f656dc1
2020-05-29 14:03:35 +00:00
oana 8209f5614c Add Javascript implementation for trace debug methods.
Add a setTraceId() method in Engine that sets the trace ID in current runner. This then activates internally displaying the trace ID for any Engine.debug/output.alarm call from a script.



git-svn-id: http://voip.null.ro/svn/yate@6403 acf43c95-373e-0410-b603-e72c3f656dc1
2020-04-22 12:05:53 +00:00
paulc f099430479 Added support for checking if a module is loaded.
Added support for configuration conditionals on module loaded.


git-svn-id: http://voip.null.ro/svn/yate@6399 acf43c95-373e-0410-b603-e72c3f656dc1
2020-04-15 13:50:14 +00:00
marian 7da6684a2a Make JsURI URI value available: properly call JsObject constructor.
git-svn-id: http://voip.null.ro/svn/yate@6398 acf43c95-373e-0410-b603-e72c3f656dc1
2020-04-14 05:58:16 +00:00
oana 700b3b1036 Add Engine methods for retrieving current line of source code being executed, current source file name and the concatenation of both.
Add Message.trace() method for tracking of message handling in JS code.



git-svn-id: http://voip.null.ro/svn/yate@6397 acf43c95-373e-0410-b603-e72c3f656dc1
2020-04-01 11:47:55 +00:00
paulc 4e993705cf Fixed xdebug build of the javascript module.
git-svn-id: http://voip.null.ro/svn/yate@6389 acf43c95-373e-0410-b603-e72c3f656dc1
2020-03-03 14:52:36 +00:00
marian c194371fbd Made URI object and methods available in javascript.
git-svn-id: http://voip.null.ro/svn/yate@6384 acf43c95-373e-0410-b603-e72c3f656dc1
2020-02-21 14:41:19 +00:00
marian dbdc6b6c2e Added separate mutex to protect the scripts list and operations. Avoids locking the module if script parse is taking a long time.
git-svn-id: http://voip.null.ro/svn/yate@6376 acf43c95-373e-0410-b603-e72c3f656dc1
2019-12-19 12:21:42 +00:00
oana 84b8b542e8 Add support for passing arguments to setTimeout/setInterval Engine methods.
git-svn-id: http://voip.null.ro/svn/yate@6373 acf43c95-373e-0410-b603-e72c3f656dc1
2019-11-26 11:17:24 +00:00
marian 4e30cb7655 Fixed some memory leaks: values extracted from stack and not freed.
git-svn-id: http://voip.null.ro/svn/yate@6354 acf43c95-373e-0410-b603-e72c3f656dc1
2019-06-25 13:00:25 +00:00
paulc 37aa16255e Added File methods to read and write file content from Javascript.
Fixed a memory leak in some cases of File.mkdir().


git-svn-id: http://voip.null.ro/svn/yate@6336 acf43c95-373e-0410-b603-e72c3f656dc1
2018-12-11 16:57:32 +00:00
oana 1a8b055ed2 Moved methods to the JS library that stringify objects to JSON format.
git-svn-id: http://voip.null.ro/svn/yate@6317 acf43c95-373e-0410-b603-e72c3f656dc1
2018-06-15 13:39:48 +00:00
marian 6bf0fda4c6 Added saveFile() and loadFile() to javascript XML.
git-svn-id: http://voip.null.ro/svn/yate@6311 acf43c95-373e-0410-b603-e72c3f656dc1
2018-04-12 12:44:38 +00:00
marian f3a3aa566a Fixed bug: avoid infinite loop when stringifying an array with holes (index is missing). Put null for missing indexes.
git-svn-id: http://voip.null.ro/svn/yate@6308 acf43c95-373e-0410-b603-e72c3f656dc1
2018-04-11 12:00:37 +00:00
marian ffa7d24050 Added replaceParams() function to JSON.
git-svn-id: http://voip.null.ro/svn/yate@6307 acf43c95-373e-0410-b603-e72c3f656dc1
2018-04-10 12:16:20 +00:00
marian b33f66c741 XML element replaceParams() is now available in javascript.
git-svn-id: http://voip.null.ro/svn/yate@6306 acf43c95-373e-0410-b603-e72c3f656dc1
2018-04-10 11:08:25 +00:00
marian b3ee072711 Engine::init() is now available in javascript.
git-svn-id: http://voip.null.ro/svn/yate@6300 acf43c95-373e-0410-b603-e72c3f656dc1
2018-03-12 14:10:45 +00:00
oana 3303f77b22 Add method to clear parameter(s) to JS Message API.
git-svn-id: http://voip.null.ro/svn/yate@6298 acf43c95-373e-0410-b603-e72c3f656dc1
2018-02-12 14:42:45 +00:00