<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:courier,monaco,monospace,sans-serif;font-size:12pt">It's all the same as when you do it in the dialplan.<br>If you set the ringback channel var to the name of a file<br>or a ttml script it will play it while the B leg originates providing<br>that the inbound leg is passed to the new session's originate method:<br><br>session.setVariable("ringback", "%(2000, 4000, 440.0, 480.0)");<br>//or<br>//session.setVariable("ringback", "/path/to/proper_sample_rate.wav");<br>
<br>new_session = new Session();<br>new_session.originate(session, "sofia/foo@bar.com");<br><br><div>&nbsp;</div><div>Anthony Minessale II<br><br><span>FreeSWITCH <a target="_blank" href="http://www.freeswitch.org/">http://www.freeswitch.org/</a></span><br><span>ClueCon <a target="_blank" href="http://www.cluecon.com/">http://www.cluecon.com/</a></span><br><br>AIM: anthm<br>MSN:anthony_minessale@hotmail.com<br>JABBER:anthony.minessale@gmail.com<br>IRC: irc.freenode.net #freeswitch</div><div><br>FreeSWITCH Developer Conference<br>sip:888@conference.freeswitch.org<br>iax:guest@conference.freeswitch.org/888<br>googletalk:conf+888@conference.freeswitch.org<br>pstn:213-799-1400</div><div style="font-family: courier,monaco,monospace,sans-serif; font-size: 12pt;"><br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Original Message ----<br>From: Tamas Cseke &lt;cstomi.levlist@gmail.com&gt;<br>To:
 freeswitch-users@lists.freeswitch.org<br>Sent: Wednesday, April 4, 2007 4:29:38 AM<br>Subject: [Freeswitch-users] session.originate question<br><br><div>Hello,<br><br>I'd like to make an ivr, what ask for a number, and call it. I try to <br>write a js script.<br><br>As i see, the new session originate method return when the called party <br>answer the call.<br>I need to play a soundfile back to the caller on 180 reply, what inform <br>the call is ringing.<br>Is it possible somehow? If with js not, with anything else ? <br>(mod_bridgecall or something)<br><br>(Maybe if would useful an other callback function setAnswerHook() ?)<br><br>Thanks any help,<br>Tamas<br><br>Anthony Minessale wrote:<br><br>&gt;please update to 4773 or better and see the code examples<br>&gt;in the commit log.<br>&gt;<br>&gt;<a target="_blank" href="http://fisheye.freeswitch.org/changelog/FreeSWITCH/?cs=4773">http://fisheye.freeswitch.org/changelog/FreeSWITCH/?cs=4773</a><br>&gt; <br>&gt;Anthony
 Minessale II<br>&gt;<br>&gt;FreeSWITCH <a target="_blank" href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>&gt;ClueCon <a target="_blank" href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>&gt;<br>&gt;AIM: anthm<br>&gt;MSN:anthony_minessale@hotmail.com<br>&gt;JABBER:anthony.minessale@gmail.com<br>&gt;IRC: irc.freenode.net #freeswitch<br>&gt;<br>&gt;FreeSWITCH Developer Conference<br>&gt;sip:888@conference.freeswitch.org<br>&gt;iax:guest@conference.freeswitch.org/888<br>&gt;googletalk:conf+888@conference.freeswitch.org<br>&gt;pstn:213-799-1400<br>&gt;<br>&gt;<br>&gt;----- Original Message ----<br>&gt;From: Tamas Cseke &lt;cstomi.levlist@gmail.com&gt;<br>&gt;To: freeswitch-users@lists.freeswitch.org<br>&gt;Sent: Saturday, March 24, 2007 5:34:13 AM<br>&gt;Subject: [Freeswitch-users] spidermonkey- session done-&gt;script terminate<br>&gt;<br>&gt;Hello,<br>&gt;<br>&gt;I need help using session object, please help me.<br>&gt;"Note: While the
 JavaScript application will continue to execute after a<br>&gt;hangup is detected the session object will be gone and any attempt to<br>&gt;access it will cause the JavaScript to terminate. Save off any<br>&gt;variables you might need for post hangup processing and use your local<br>&gt;variables instead."<br>&gt;<br>&gt;How can i avoid the script termination, is it possible to somehow safely check if the session hungup?<br>&gt;<br>&gt;exactly i'd like to call an user, if don't answer call another, i can't use simply mod_bridgecall because<br>&gt;<br>&gt;i know the destinations just in runtime, i try use fetchURLHash to determine the next user, when one fails.<br>&gt;<br>&gt;<br>&gt;<br>&gt;var queue = argv;<br>&gt;var hash = new Array();<br>&gt;<br>&gt;while (true) {<br>&gt;<br>&gt;// fetch first agent<br>&gt;<br>&gt;fetchURLHash("<a target="_blank" href="http://localhost:8000/lockagent/%22">http://localhost:8000/lockagent/"</a>; + queue + "/"+session.uuid,
 "hash");<br>&gt;var agent = hash["agent"];<br>&gt;<br>&gt;<br>&gt;//call agent<br>&gt;<br>&gt;//...<br>&gt;&nbsp;&nbsp;new_session = new Session(session,<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "sofia/devil/" + agent + "%192.168.1.93", //dest<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "xml",//dialplan<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "default",//context<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 "",//cid_name<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb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p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10);//to<br>&gt;&nbsp;&nbsp;<br>&gt; <br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;// i need help in this condition<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;// on timeout, new_session is done, and if i try access its properties, script terminate<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;if (session.ready() &amp;&amp; new_session.ready()) {<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bridge(session, new_session);<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; fetchURLHash("<br>&gt;<a target="_blank" href="http://localhost:8000/unlockagent/%22">http://localhost:8000/unlockagent/"</a>; + agent + "/" + session.uuid,
 "hash");<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;else {<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// should try again, but script terminated<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;console_log("notice","timeout, try again...\n");<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //wait a bit<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; fetchURLHash("<a target="_blank" href="http://localhost:8000/unlockagent/">http://localhost:8000/unlockagent/</a><br>&gt;" + agent + "/" + session.uuid, "hash");<br>&gt;}<br>&gt;<br>&gt;Thanks any help,<br>&gt;Tamas<br>&gt;<br>&gt;_______________________________________________<br>&gt;Freeswitch-users mailing list<br>&gt;Freeswitch-users@lists.freeswitch.org<br>&gt;<a target="_blank"
 href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>&gt;UNSUBSCRIBE:<a target="_blank" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>&gt;<a target="_blank" href="http://www.freeswitch.org">http://www.freeswitch.org</a><br>&gt;<br>&gt;<br>&gt;<br>&gt;<br>&gt;<br>&gt;<br>&gt;<br>&gt; <br>&gt;____________________________________________________________________________________<br>&gt;Be a PS3 game guru.<br>&gt;Get your game face on with the latest PS3 news and previews at Yahoo! Games.<br>&gt;<a target="_blank"
 href="http://videogames.yahoo.com/platform?platform=120121">http://videogames.yahoo.com/platform?platform=120121</a><br>&gt;&nbsp;&nbsp;<br>&gt;<br>&gt;------------------------------------------------------------------------<br>&gt;<br>&gt;_______________________________________________<br>&gt;Freeswitch-users mailing list<br>&gt;Freeswitch-users@lists.freeswitch.org<br>&gt;<a target="_blank" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>&gt;UNSUBSCRIBE:<a target="_blank" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>&gt;<a target="_blank" href="http://www.freeswitch.org">http://www.freeswitch.org</a><br>&gt;&nbsp;&nbsp;<br>&gt;<br><br><br>_______________________________________________<br>Freeswitch-users mailing list<br>Freeswitch-users@lists.freeswitch.org<br><a target="_blank"
 href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>UNSUBSCRIBE:<a target="_blank" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a target="_blank" href="http://www.freeswitch.org">http://www.freeswitch.org</a><br></div></div><br></div></div><br>

<hr size=1><a href="
http://us.rd.yahoo.com/evt=49981/*http://advision.webevents.yahoo.com/mailbeta/features_spam.html">Sucker-punch spam</a> with award-winning protection.<br> Try the <a href="
http://us.rd.yahoo.com/evt=49981/*http://advision.webevents.yahoo.com/mailbeta/features_spam.html">free Yahoo! Mail Beta.</a></body></html>