[Freeswitch-users] spidermonkey- session done->script terminate

Tamas Cseke cstomi.levlist at gmail.com
Sat Mar 24 03:34:13 PDT 2007


Hello,

I need help using session object, please help me.
"Note: While the JavaScript application will continue to execute after a
hangup is detected the session object will be gone and any attempt to access
it will cause the JavaScript to terminate. Save off any variables you might
need for post hangup processing and use your local variables instead."

How can i avoid the script termination, is it possible to somehow safely
check if the session hungup?

exactly i'd like to call an user, if don't answer call another, i can't use
simply mod_bridgecall because
i know the destinations just in runtime, i try use fetchURLHash to determine
the next user, when one fails.



var queue = argv;
var hash = new Array();

while (true) {

// fetch first agent
fetchURLHash("http://localhost:8000/lockagent/" + queue + "/"+session.uuid,
"hash");
var agent = hash["agent"];


//call agent
//...
  new_session = new Session(session,
                             "sofia/devil/" + agent + "%192.168.1.93",
//dest
                             "xml",//dialplan
                             "default",//context
                             "",//cid_name
                             ""), //cid_num
                             "",//network_addr
                             "",//ani
                             "",//anii
                             "",//rdnis
                             "",//username
                             10);//to


    // i need help in this condition
    // on timeout, new_session is done, and if i try access its properties,
script terminate

    if (session.ready() && new_session.ready()) {

      bridge(session, new_session);
     fetchURLHash("http://localhost:8000/unlockagent/" + agent + "/" +
session.uuid, "hash");
     break;

    }
    else {
        // should try again, but script terminated
        console_log("notice","timeout, try again...\n");
       //wait a bit
    }
     fetchURLHash("http://localhost:8000/unlockagent/" + agent + "/" +
session.uuid, "hash");
}

Thanks any help,
Tamas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20070324/9fcac5f9/attachment-0002.html 


More information about the FreeSWITCH-users mailing list