<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:courier,monaco,monospace,sans-serif;font-size:12pt">
and just to point it out, you can also do:<br><br>session1 = new Session();<br>session1.originate(session1, "{ignore_early_media=true}sofia/gateway/ <br><a target="_blank" href="http://asterlink.com/19184249378"><span style="background: transparent none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;" class="yshortcuts" id="lw_1206717089_0">asterlink.com/19184249378</span></a>");<br><br>session1.execute("bridge", "sofia/gateway/asterlink.com/<span class="yshortcuts" id="lw_1206717089_1">19184238080</span>");<br><br>or even better<br><br>// this will transfer the channel into the dialplan and end the script<br>// thus reducing overhead of leaving JS open.<br>session1.execute("transfer", "<span class="yshortcuts" id="lw_1206717089_1">19184238080</span>");<br><br><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>GTALK/JABBER/PAYPAL: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: Brian West &lt;brian.west@mac.com&gt;<br>To: freeswitch-users@lists.freeswitch.org<br>Sent: Thursday, March 27, 2008 9:55:25 PM<br>Subject: Re: [Freeswitch-users] How to bridge 2 sessions with Javascript?<br><br>
Revised script:<br><br>session1 = new Session();<br>session1.originate(session1, "{ignore_early_media=true}sofia/gateway/ <br><a target="_blank" href="http://asterlink.com/19184249378">asterlink.com/19184249378</a>");<br><br>session2 = new Session();<br>session2.originate(session2, "sofia/gateway/asterlink.com/19184238080");<br><br>bridge(session1, session2);<br>session.hangup();<br>while (session1.ready() &amp;&amp; session2.ready()) { }<br><br><br>You don't need waitForAnswer because the ignore_early_media=true&nbsp; <br>performs that automatically for you so it won't return till you&nbsp; <br>answer.&nbsp; And you don't want the ignore_early_media on the second leg&nbsp; <br>otherwise you get NO ringback and its just silent till the other end&nbsp; <br>is answered.<br><br>/b<br><br>On Mar 27, 2008, at 9:10 PM, Nicolas Brenner wrote:<br><br>&gt; Hello everybody again,<br>&gt;<br>&gt; First of all I want to say thanks to the people on this list and
 on<br>&gt; IRC, I'm really surprised (in a very good way) of the help I've<br>&gt; received.<br>&gt;<br>&gt; Now to my problem: I'm trying to bridge two SIP calls together with a<br>&gt; JS script, and to achieve it, I'm did the following:<br>&gt; - created a dialplan entry for extension 500 which calls js script<br>&gt; - created a js script with the following code:<br>&gt;<br>&gt; // Create new_session<br>&gt; session1 = new Session();<br>&gt; session1.originate(session,<br>&gt; "{ignore_early_media=true}sofia/gateway/sip.sipdiscount.com/ <br>&gt; 005624949458");<br>&gt; session1.waitForAnswer(10000);<br>&gt;<br>&gt; new_session = new Session();<br>&gt; new_session.originate(session,<br>&gt; "{ignore_early_media=true}sofia/gateway/sip.sipdiscount.com/ <br>&gt; 0056979039388",<br>&gt; 30);<br>&gt; new_session.waitForAnswer(10000);<br>&gt;<br>&gt; // IF everybody is ready, then bridge our current session &amp; the&nbsp; <br>&gt; new_session<br>&gt; if
 (session1.ready() &amp;&amp; new_session.ready()) {<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; console_log("info", "Interoligofrenico!\n");<br>&gt;&nbsp; &nbsp; bridge(session1, new_session);<br>&gt; }<br>&gt;<br>&gt; // hangup when done<br>&gt; session1.hangup();<br>&gt; new_session.hangup();<br>&gt;<br>&gt; When I register with extension 1000 using a softphone and dial<br>&gt; extension 500, the code above successfully creates the two new<br>&gt; sessions, makes the calls in order, and supposedly bridges the<br>&gt; sessions (I get no error about the bridge on the console, and I get<br>&gt; the log text too), but I get no audio on either end. Anybody know<br>&gt; what's wrong with the code?<br>&gt;<br>&gt; Btw, how can I originate a call to a configure extension? All examples<br>&gt; on the wiki use the 'sofia syntax', should I just use<br>&gt; sofia/default/1001 for example?<br>&gt;<br>&gt; Thanks!<br>&gt;<br>&gt; Nicolas<br>&gt;<br>&gt;
 _______________________________________________<br>&gt; Freeswitch-users mailing list<br>&gt; <a ymailto="mailto:Freeswitch-users@lists.freeswitch.org" href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br>&gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>&gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>&gt; <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br><br><br>_______________________________________________<br>Freeswitch-users mailing list<br><a ymailto="mailto:Freeswitch-users@lists.freeswitch.org" href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br><a
 href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br></div><br></div></div><br>
      <hr size=1>Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile. <a href="http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ "> Try it now.</a></body></html>