Yate server > Yate IVR

Javascript Routing - Empty message-Object

(1/1)

asymetrixs:
Hi,

I just wrote a simple routing script in Javascript and I have the following problem:


--- Code: ---message.callto_account = mysqlAccount; // Setting the MySQL Account (this is a variable containing a string)
message.callto_query = "CALL yate_voice_timeout('" + dbTimeout + "', '" + language + "')"; // Setting up the query
Engine.output("1) ME: " + message.caller); // Gives: 123456
Channel.callTo("dbwave/play//backup.au"); // Plays the Binary Data returned by the SQL Query
Engine.output("2) ME: " + message.caller); // Gives: (empty)
...
message.callto.1  = "sip/sip:999@abc.com";
message.callto.2  = "sip/sip:888@xyz.org";
Channel.callJust("fork");

--- End code ---

When issuing the callJust, then message.caller is empty which causes problems because the value in CDR insert/update/finalize is empty too.
As far as described in the docs, that behavior is correct, because the return values of Channel.callTo are written in the message object, but I want to call other targets as well.

So do I have to copy all parameters and store them in separate variables to reuse them or is there a way to retrieve the original 'incoming'-message with all its values?

Regards,
Damian / asymetrixs

asymetrixs:
Ok, as talked to Paul the answer is:

All parameters in the message object have to be copied and preserved in variables because they are overwritten in Channel.callTo().

Navigation

[0] Message Index

Go to full version