[Freeswitch-users] How do I notify FreeSwitch that a phone has been answered to play audio or TTS
mszlazak at aol.com
mszlazak at aol.com
Thu Mar 12 23:38:53 PDT 2009
If I originate an outgoing call from FreeSwitch and want to tts a phrase or play an audio once the call has been answered (i.e, someone answered their cell phone or I got their voicemail) then how do I detect that.
Otherwise, I've tried the following but it relies in getting the timing right which won't always work or looping the tts phrase over and over.
var s;
while (tryCalling()) {}
s.hangup();
exit();
function tryCalling() {
??? s = new Session("sofia/gateway/spa3102/12223334444 at 10.0.0.5:5061");
??? s.waitForAnswer(10000);
???
??? if (s.cause == "USER_BUSY") {
??? ?? ?return true;
??? }
??? if (s.ready()) {
??? ?? ?s.sleep(10000);
??? ?? ?s.speak("cepstral","Callie","Hello from FreeSwitch");
??? }
??? return false;
}
Another way is to keep replaying the tts phrase by replacing
? if (s.ready()) {
??? ?? ?s.sleep(10000);
??? ?? ?s.speak("cepstral","Callie","Hello from FreeSwitch");
??? }
with something like:
while (s.ready()) {
??? ?? ?s.speak("cepstral","Callie","Hello from FreeSwitch");
??? }
Thanks. Mark.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20090313/4574725b/attachment-0002.html
More information about the FreeSWITCH-users
mailing list