<font face="Arial, Helvetica, sans-serif">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.<br>
<br>
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.<br>
<br>
var s;<br>
while (tryCalling()) {}<br>
s.hangup();<br>
exit();<br>
<br>
function tryCalling() {<br>
s = new Session("sofia/gateway/spa3102/12223334444@10.0.0.5:5061");<br>
s.waitForAnswer(10000);<br>
<br>
if (s.cause == "USER_BUSY") { <br>
return true;<br>
}<br>
<br>
if (s.ready()) {<br>
s.sleep(10000);<br>
s.speak("cepstral","Callie","Hello from FreeSwitch");<br>
}<br>
return false;<br>
}<br>
<br>
<br>
Another way is to keep replaying the tts phrase by replacing<br>
<br>
</font><font face="Arial, Helvetica, sans-serif"> if (s.ready()) {<br>
s.sleep(10000);<br>
s.speak("cepstral","Callie","Hello from FreeSwitch");<br>
}<br>
<br>
with something like:<br>
<br>
</font><font face="Arial, Helvetica, sans-serif"> while (s.ready()) {<br>
s.speak("cepstral","Callie","Hello from FreeSwitch");<br>
}</font><br>
<font face="Arial, Helvetica, sans-serif"><br>
<br>
Thanks. Mark.<br>
</font><div id='MAILCIADB026-5bb049b9ff7c64' class='aol_ad_footer'><br/><font style="color:black;font:normal 10pt arial,san-serif;"> <hr style="margin-top:10px"/><b>A Good Credit Score is 700 or Above. <a href="http://pr.atwola.com/promoclk/100126575x1219671244x1201345076/aol?redir=http:%2F%2Fwww.freecreditreport.com%2Fpm%2Fdefault.aspx%3Fsc%3D668072%26hmpgID%3D62%26bcd%3DfebemailfooterNO62"> See yours in just 2 easy steps!</a></b></font> </div>