[Freeswitch-users] How do I notify FreeSwitch that a phone has been answered to play audio or TTS

David Dan davidwdan at gmail.com
Fri Mar 13 06:45:13 PDT 2009


Try ignore early media.



On 3/13/09, mszlazak at aol.com <mszlazak at aol.com> wrote:
> 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.
>

-- 
Sent from my mobile device




More information about the FreeSWITCH-users mailing list