[Freeswitch-users] Bridge 2 calls, catchup hangup and connect to 3rd party
Birgit Arkesteijn
birgit at westhawk.co.uk
Wed Oct 8 10:19:50 PDT 2008
Hi,
I'm running FreeSWITCH 498:8901 on x86_64 GNU/Linux.
I'm trying to get person 1 to speak to person 2, then after person 2
hangs up, speak to person 3, etc, etc.
So:
person1 -> person2
person1 -> person3
...
person1 -> personN
In between connecting person1 to the next person, I need to do some
admin and speak phrases to person1 and personX independently.
Our software originates the calls, so I've chosen for RPC and JS.
I succeed orginating a call to person1 and person2 and bridging them.
However, I struggle to find a way to 'catch' the hangup and make person1
connect to person3.
I tried using session.setHangupHook, but the function is never called.
Any idea how I can catch the hangup of person2 so it doesn't hangup on
person1, so I can connect person1 to person3?
This is what I've got so far:
function on_hangup2(hup_session, how) {
console_log("info", "on_hangup2(): " + how + " HOOK"
+ " name: " + hup_session.name
+ " state: " + hup_session.state
+ " cause: " + hup_session.cause + "\n");
exit();
}
function on_hangup1(hup_session, how) {
console_log("info", "on_hangup1(): " + how + " HOOK"
+ " name: " + hup_session.name
+ " state: " + hup_session.state
+ " cause: " + hup_session.cause + "\n");
cSession.speak("cepstral", "Diane", "Wait we are trying to find the
next person");
var m2Session = new Session("sofia/gateway/westhawk/0661");
cSession.setHangupHook(on_hangup2);
m2Session.setHangupHook(on_hangup2);
bridge(cSession, m2Session);
}
var cSession = new
Session("{ignore_early_media=true,call_timeout=60}sofia/gateway/westhawk/0662");
while (cSession.ready()) {
// The call has been answered
cSession.speak("cepstral", "Diane", "Wait we are trying to find the
next person");
var m1Session = new Session("sofia/gateway/westhawk/0663");
cSession.setHangupHook(on_hangup1);
m1Session.setHangupHook(on_hangup1);
bridge(cSession, m1Session);
}
(end js).
I tried
cSession.bridge("sofia/gateway/westhawk/0663|sofia/gateway/westhawk/0661");
but that didn't work either.
Thanks, Birgit
--
-- Birgit Arkesteijn, birgit at westhawk.co.uk,
-- Westhawk Ltd, Albion Wharf, 19 Albion Street, Manchester M1 5LN, UK
-- Company no: 1769350
-- Registered Office:
-- 15 London Road, Stockton Heath, Warrington WA4 6SJ. UK.
-- tel.: +44 (0)161 237 0660
-- <URL: http://www.westhawk.co.uk>
More information about the FreeSWITCH-users
mailing list