please update to 4773 or better and see the code examples
in the commit log.

http://fisheye.freeswitch.org/changelog/FreeSWITCH/?cs=4773
 
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/

AIM: anthm
MSN:anthony_minessale@hotmail.com
JABBER:anthony.minessale@gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org
pstn:213-799-1400


----- Original Message ----
From: Tamas Cseke <cstomi.levlist@gmail.com>
To: freeswitch-users@lists.freeswitch.org
Sent: Saturday, March 24, 2007 5:34:13 AM
Subject: [Freeswitch-users] spidermonkey- session done->script terminate

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
_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org



We won't tell. Get more on shows you hate to love
(and love to hate): Yahoo! TV's Guilty Pleasures list.