Commit Graph

127 Commits

Author SHA1 Message Date
paulc 8558e81047 Added DNS.resolve() and DNS.local() methods in Javascript.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5909 acf43c95-373e-0410-b603-e72c3f656dc1
2014-08-26 17:21:36 +00:00
paulc dddac05512 Fixed a pushed down row in Javascript tabelar output functions.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5908 acf43c95-373e-0410-b603-e72c3f656dc1
2014-08-22 10:43:37 +00:00
paulc 011cafdb6c Fixed rows alignment in Javascript tabelar output functions.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5907 acf43c95-373e-0410-b603-e72c3f656dc1
2014-08-20 15:03:30 +00:00
paulc e183bd7020 Added JS methods to build or print a table from Array of Object or Object of Array.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5904 acf43c95-373e-0410-b603-e72c3f656dc1
2014-08-06 14:38:28 +00:00
paulc 771ee63ff3 Added support for creating scripting extensions in other modules.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5902 acf43c95-373e-0410-b603-e72c3f656dc1
2014-08-06 08:08:06 +00:00
paulc 7efd3b0747 Store TTL in retrieved DNS records.
Add ttl, order and preference to JS returned NAPTR and SRV records.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5889 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-31 13:32:54 +00:00
paulc f64803b64f Added Message.handlers() function to return list of installed message handlers.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5878 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-24 13:03:16 +00:00
paulc 7ddd7cf498 Use the proper JsObject constructor with prototype where applicable.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5876 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-22 11:41:55 +00:00
paulc bbcfbbb506 Added DNS resolver object in Javascript.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5875 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-22 11:04:28 +00:00
paulc f9a0ff7791 Fixed crash in JSON.stringify() for objects having no "__proto__".
git-svn-id: http://yate.null.ro/svn/yate/trunk@5872 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-21 15:33:46 +00:00
paulc 9b6259ac82 Added native JSON parser and stringifier.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5869 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-14 08:06:41 +00:00
paulc 0842fc2581 Extract native function arguments only after recognizing the function name.
This allows falling back to the native JsObject methods.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5868 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-11 16:54:28 +00:00
marian 99f1280a37 Added support for (un)hexify functions: btoh and htob.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5865 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-07 07:52:42 +00:00
marian 45931bec7f Use a boolean parameter to indicate hexified data in Hasher update and hmac methods.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5843 acf43c95-373e-0410-b603-e72c3f656dc1
2014-06-11 12:59:46 +00:00
marian 6bde44d9c9 Added Hasher object exposing Engine Hasher class methods.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5842 acf43c95-373e-0410-b603-e72c3f656dc1
2014-06-11 12:18:01 +00:00
marian 5cac753134 Return null object from XML constructor if parse fails.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5831 acf43c95-373e-0410-b603-e72c3f656dc1
2014-05-14 09:06:36 +00:00
paulc 401d4b8793 Added objects and methods for accessing COnfiguration files from Javascript.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5811 acf43c95-373e-0410-b603-e72c3f656dc1
2014-04-01 11:27:51 +00:00
paulc 5ef78fdfa4 Added Base64 handling methods to Javascript.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5807 acf43c95-373e-0410-b603-e72c3f656dc1
2014-03-26 10:45:01 +00:00
paulc 0e603be619 Added and extra include path (defaulting to config dir) for JS scripts.
Engine runtime parameters can be used in javascript.conf for script paths.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5799 acf43c95-373e-0410-b603-e72c3f656dc1
2014-03-14 14:45:41 +00:00
oana 6d2de9dfc8 Bug fix: properly set prototype property on JS Array objects.
Added JsObject::setPrototype() in order to set an objects prototype from given context.
Added new JsArray constructor which set its own prototype. Replaced use of constructor which returned Array prototype with this contructor.



git-svn-id: http://yate.null.ro/svn/yate/trunk@5796 acf43c95-373e-0410-b603-e72c3f656dc1
2014-03-13 13:10:56 +00:00
paulc 90c08d207f Added an optional 2nd argument to callTo() and callJust() to set parameters.
Made callTo() and callJust() to be callable from pretty much anywhere.
Solves bug #338.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5791 acf43c95-373e-0410-b603-e72c3f656dc1
2014-02-26 14:57:57 +00:00
paulc d8e565816b Keep executing a channel script until callTo, callJust or hangup.
A different non-blocking function does not exit the script.
Fixes bug #336.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5790 acf43c95-373e-0410-b603-e72c3f656dc1
2014-02-26 14:51:15 +00:00
paulc 37a72e4bc1 Added copyright notices to sources and scripts missing them.
Updated copyright notices for 2014.
Fixed end of lines in many files.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5755 acf43c95-373e-0410-b603-e72c3f656dc1
2014-02-05 11:42:17 +00:00
marian 1229b07588 Added setText function to XML object. Added optional third argument to XML constructor used to take the xml from list parameter instead of making a copy.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5712 acf43c95-373e-0410-b603-e72c3f656dc1
2014-01-10 11:55:36 +00:00
paulc 150e763c0d Added JS static method Engine.runParams() and Message member msgTime()
git-svn-id: http://yate.null.ro/svn/yate/trunk@5688 acf43c95-373e-0410-b603-e72c3f656dc1
2013-11-05 15:50:09 +00:00
paulc d906455080 Limit Javascript debug output to DebugTest, not DebugGoOn.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5687 acf43c95-373e-0410-b603-e72c3f656dc1
2013-11-01 14:36:18 +00:00
oana c8f18f9d15 Fixed compile warnings which appear when compiling with xdebug.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5642 acf43c95-373e-0410-b603-e72c3f656dc1
2013-09-09 15:26:27 +00:00
paulc 58df5ea11b Check the timestamps of all files included in Javascript.
On initialization reload scripts if any included file has changed.
Reload routing script only if it has changed.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5631 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-28 13:19:42 +00:00
paulc 7c39b31458 Fixed warnings - mostly conversions - exposed by Visual C++ compiler.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5614 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-07 11:24:10 +00:00
paulc e81cbde58e More fixes related to 32 and 64 bit types usage in JS.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5613 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-07 10:18:23 +00:00
paulc 18ff43d395 Fixed 64 bit types usage in Javascript, was broken on 32 bit machines.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5612 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-07 09:49:52 +00:00
paulc cf5d0fd71a Changed license terms in each source file to reference an external file.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5609 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-06 13:38:10 +00:00
paulc bdcfd22d5b Added Javascript methods for enabling and controlling debug levels.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5605 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-05 09:56:52 +00:00
paulc 2d7d0489d5 Added Engine.alarm() method in Javascript.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5564 acf43c95-373e-0410-b603-e72c3f656dc1
2013-07-05 12:50:18 +00:00
paulc 6f028c32cb Added method to set the debug name of Javascript instances.
Implemented reentrant operation mode for JS Message.dispatch()


git-svn-id: http://yate.null.ro/svn/yate/trunk@5465 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 15:18:50 +00:00
andrei dffa68a0c1 Added support for timeouts and interval in JavaScript.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5457 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 14:00:39 +00:00
andrei fe4f9e7a18 Added MessageQueue support in JavaScript.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5456 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 13:56:00 +00:00
paulc 53b28b870a Added static method to set or retrieve the tracker name in JS handlers.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5445 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 12:55:51 +00:00
paulc 2f19c830c2 Store ExpOperations in JsObjects so the value type is preserved.
Automatically convert database results to numbers if possible.
Added faster method ExpOperation::typeOf()


git-svn-id: http://yate.null.ro/svn/yate/trunk@5444 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 12:54:30 +00:00
paulc d6476113c5 Allow specifying a filter for Javascript message handlers.
Mask message handlers early enough to avoid trace file races at shutdown.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5443 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 12:53:10 +00:00
paulc b3c4c0c694 Added support for tracing Javascript execution in KCacheGrind format.
Fixed line counting for a possible keyword or identifier at end of line.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5439 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 12:46:21 +00:00
paulc 3854ec61c2 Allow manually evaluating JS expressions in a specific context.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5437 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 12:41:47 +00:00
oana 3d75d22828 Added functions unprefixedTag(), getTag(), removeAttribute() and clearChildren() to the Javascript XML API.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5434 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 12:08:13 +00:00
oana 2d65f043cb Do linking (jump resolving) for Javascript code.
Added configuration parameter to enable/disable linking.



git-svn-id: http://yate.null.ro/svn/yate/trunk@5407 acf43c95-373e-0410-b603-e72c3f656dc1
2013-02-14 14:37:20 +00:00
oana 6df78f9dcb Lock context while evaluating instructions.
Don't do context initialization everytime the execution of the script is reset.



git-svn-id: http://yate.null.ro/svn/yate/trunk@5403 acf43c95-373e-0410-b603-e72c3f656dc1
2013-02-12 15:47:54 +00:00
oana 6f6932de07 Fixed XML constructor from string.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5386 acf43c95-373e-0410-b603-e72c3f656dc1
2013-01-28 10:57:41 +00:00
paulc aa90a97779 Added XML support in Javascript.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5366 acf43c95-373e-0410-b603-e72c3f656dc1
2012-12-21 10:21:16 +00:00
paulc 1848fe201f Added support for calling object methods by variable.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5332 acf43c95-373e-0410-b603-e72c3f656dc1
2012-11-20 16:11:38 +00:00
paulc 20b149f704 Added setting to allow DebugFail from Javascript.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5331 acf43c95-373e-0410-b603-e72c3f656dc1
2012-11-20 16:08:25 +00:00
paulc cb3efae166 Added reload Javascript command.
Fixed some potential concurrency issues.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5316 acf43c95-373e-0410-b603-e72c3f656dc1
2012-11-01 14:58:46 +00:00
paulc f3ab3dee03 Abandon Javascript message handlers on shutdown since they get destroyed by the engine anyway.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5315 acf43c95-373e-0410-b603-e72c3f656dc1
2012-11-01 11:18:35 +00:00
paulc 713b9b4bd9 Clear the "message" member of Channel only when script ended, else just mark it invalid.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5207 acf43c95-373e-0410-b603-e72c3f656dc1
2012-07-24 10:31:12 +00:00
paulc 186e26d218 Changed name of Javascript rmanager command from "js" to "javascript".
Implemented line completion, info and status.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5170 acf43c95-373e-0410-b603-e72c3f656dc1
2012-07-02 11:55:34 +00:00
paulc 1e443066b9 Added methods to JS Message for accessing an Yate Array attached to an Yate Message.
This allows retrieving database query results.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5162 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-28 18:23:04 +00:00
paulc d6e57e9f4c Added an Engine.shared singleton object that exposes in JS the engine shared variables.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5160 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-27 17:49:49 +00:00
paulc 92efe58739 Added "message" variable in routing scope context.
Removed current message parameters from routing scope context.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5156 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-27 12:57:18 +00:00
paulc e57c6dc740 Deep copy inline objects and arrays when placing them in a context.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5154 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-26 16:40:38 +00:00
paulc 5bbbe0ead9 Fixed the call context creation, was double wrapping the scope and this objects.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5152 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-26 13:31:30 +00:00
paulc 87ca03bec0 Added method Channel.answered() to check if the call leg was answered.
Allow the onDisconnected() function to override the default reroute behavior.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5147 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-22 14:42:41 +00:00
paulc 788ed299f7 Fixed parsing of { objects } as expressions.
Fixed parsing of "var" declarations.
Fixed indexing and fields of expressions.
Small improvement to speed up the simplification of large code.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5146 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-22 14:06:16 +00:00
paulc 52c2e0a004 Implemented pseudo-linear execution flow for channel routing.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5145 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-22 09:38:51 +00:00
paulc 9bffbe6d90 Took call.preroute out of the main code flow.
Allow call.ringing and call.answered handlers to stop the message.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5141 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-20 15:54:43 +00:00
paulc 128acd4367 Linked the call.preroute, call.route and chan.disconnected to Channel.message.
Added some run time reporting in DEBUG compile mode.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5138 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-20 14:02:18 +00:00
paulc da0444345d Fixed undefining message parameters.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5136 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-19 19:28:30 +00:00
paulc 80bc17ebe7 Added support for non-JS NamedList in JsObject that is overriden in JsMessage.
Separate method is used to store the key names for iterating over unsafe lists.
Implemented handling of Yate messages and their parameters in module.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5135 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-19 18:55:45 +00:00
paulc a5a434f6cb Keep the prototype as an internal __proto__ property.
Exclude properties starting with two underlines from iterators.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5131 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-18 17:17:43 +00:00
paulc c446eb8d2e Changed the way native objects' constructors are called.
Added proper cleanup in module.
Added script unload hook onUnload() that just needs be defined.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5128 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-18 13:52:21 +00:00
paulc f5e76ddb6b Changed the way callback JS functions are called.
Added a global Javascript loader.
Moved the main routing script to the [global] section.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5127 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-16 23:21:13 +00:00
paulc bf57830c7f Added possibility to track message progress through handlers.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5107 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-12 23:47:01 +00:00
paulc 64c9808103 Fixed object assignment to object fields.
Added dump_r and print_r methods of Engine to aid in debugging.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5078 acf43c95-373e-0410-b603-e72c3f656dc1
2012-05-30 08:32:47 +00:00
paulc 97c2a7e6bb Moved helper functions to static methods of JsObject so code can be reused.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5063 acf43c95-373e-0410-b603-e72c3f656dc1
2012-05-15 14:43:15 +00:00
paulc 1eec7eb43b Moved some Js objects implementation in another file.
Renamed Engine.Debug and Engine.Output to lower case to avoid confusion with constants.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5035 acf43c95-373e-0410-b603-e72c3f656dc1
2012-05-02 15:11:48 +00:00
paulc 6a19d73e58 Fixed a compile conversion warning.
git-svn-id: http://yate.null.ro/svn/yate/trunk@4955 acf43c95-373e-0410-b603-e72c3f656dc1
2012-03-05 17:14:16 +00:00
paulc 49e1f5586d Moved declaration of some of the JS methods in the proper static initializer.
git-svn-id: http://yate.null.ro/svn/yate/trunk@4954 acf43c95-373e-0410-b603-e72c3f656dc1
2012-03-05 09:53:31 +00:00
paulc ed193a3432 Got rid of the useless ScriptEvaluator class, made instead some ExpEvaluator methods public.
Fixed parsing of function declarations.


git-svn-id: http://yate.null.ro/svn/yate/trunk@4933 acf43c95-373e-0410-b603-e72c3f656dc1
2012-02-20 15:46:19 +00:00
paulc a242f792c5 Updated scripting code.
git-svn-id: http://yate.null.ro/svn/yate/trunk@4921 acf43c95-373e-0410-b603-e72c3f656dc1
2012-02-17 16:19:17 +00:00
paulc 5b773e7c5a Added partial universal scripting implementation with Javascript support.
git-svn-id: http://yate.null.ro/svn/yate/trunk@4892 acf43c95-373e-0410-b603-e72c3f656dc1
2012-02-10 14:53:55 +00:00