Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000340 [Yate - Yet Another Telephony Engine] module feature N/A 2013-04-19 17:16 2013-04-19 23:55
Reporter asymetrixs View Status public  
Assigned To
Priority normal Resolution open  
Status feedback   Product Version 4.x
Summary 0000340: JS: shared temporary storage between routing script and handlers to exchange information
Description It would be good to have a shared storage within the same call. This would enable it to store data within the JS routing script in the shared storage object and to retrieve this data in a handler and vice versa.

Each call will have it's own storage object, something like a session-object. Exchange of information within the same call but between a handler and the routing script should be done like this:

Session.put("key", "value");
var retrieve = Session.get("key", "value");

When implementing that, maybe it is also possible to make shared storage available yate-wide like Application.put/get
Additional Information
Tags No tags attached.
Attached Files

- Relationships

-  Notes
(0000526)
paulc (administrator)
2013-04-19 17:26

I suggest a more flexible way:

  myVar = new Engine.shared(message.billid);

This way scripts may decide how many shared objects they want and which key to use to tie them together.

A single shared block already exists via the Engine.shared object which exposes the methods of the static C++ object TelEngine::Engine::sharedVars() - see the Engine::SharedVars class.
(0000527)
asymetrixs (reporter)
2013-04-19 23:55

So it would work like this:

// first call
myVar = new Engine.shared("identifier");
-> when object with this identifier is not found, then Engine will automatically create and retrieve it

// second call
myVar2 = new Engine.shared("identifier");
-> Engine retrieves the object that was created in first step, no matter if called in same JS script or in a JS handler

// assign a new value to myVar2 just like
myVar2 = "new value";

myVar3 = new Engine.shared("identifer");

// return true:
myVar2 == myVar3

Do you mean like this?
I don't see how it is possible to assign a new value to the shared object, because (as I did above) assigning would overwrite the actual shared object reference. Maybe it is then better to use put and get like this:
Engine.getShared("identifier") // returns null or the value
Engine.putShared("identifer", "value") // stores a new object or updates an existing, so PUT needs to be done before GET normally.

Moreover: There must be a way to dispose objects in shared storage when shared storage is not coupled with a call itself. Otherwise the shared storage would grow and grow...
Tying the shared storage on a call would give the possibility to automatically remove all referenced objects when the call ends.

- Issue History
Date Modified Username Field Change
2013-04-19 17:16 asymetrixs New Issue
2013-04-19 17:26 paulc Note Added: 0000526
2013-04-19 17:26 paulc Status new => feedback
2013-04-19 23:55 asymetrixs Note Added: 0000527


Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker