[Freeswitch-users] How to bridge 2 sessions with Javascript?
Nicolas Brenner
nicolas at medularis.com
Thu Mar 27 19:10:21 PDT 2008
Hello everybody again,
First of all I want to say thanks to the people on this list and on
IRC, I'm really surprised (in a very good way) of the help I've
received.
Now to my problem: I'm trying to bridge two SIP calls together with a
JS script, and to achieve it, I'm did the following:
- created a dialplan entry for extension 500 which calls js script
- created a js script with the following code:
// Create new_session
session1 = new Session();
session1.originate(session,
"{ignore_early_media=true}sofia/gateway/sip.sipdiscount.com/005624949458");
session1.waitForAnswer(10000);
new_session = new Session();
new_session.originate(session,
"{ignore_early_media=true}sofia/gateway/sip.sipdiscount.com/0056979039388",
30);
new_session.waitForAnswer(10000);
// IF everybody is ready, then bridge our current session & the new_session
if (session1.ready() && new_session.ready()) {
console_log("info", "Interoligofrenico!\n");
bridge(session1, new_session);
}
// hangup when done
session1.hangup();
new_session.hangup();
When I register with extension 1000 using a softphone and dial
extension 500, the code above successfully creates the two new
sessions, makes the calls in order, and supposedly bridges the
sessions (I get no error about the bridge on the console, and I get
the log text too), but I get no audio on either end. Anybody know
what's wrong with the code?
Btw, how can I originate a call to a configure extension? All examples
on the wiki use the 'sofia syntax', should I just use
sofia/default/1001 for example?
Thanks!
Nicolas
More information about the FreeSWITCH-users
mailing list