<html dir="ltr"><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaTempEditStyle"></style><style title="owaParaStyle"><!--P {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
--></style>
</head>
<body ocsi="x">
<div style="FONT-FAMILY: Tahoma; DIRECTION: ltr; COLOR: #000000; FONT-SIZE: 13px">
<div></div>
<div dir="ltr"><font color="#000000" size="2" face="Tahoma">Hey ppl,</font></div>
<div dir="ltr"><font size="2" face="tahoma"></font> </div>
<div dir="ltr"><font size="2" face="tahoma">At the moment im building a Javascript based IVR but im kind of stuck on a part.</font></div>
<div dir="ltr"><font size="2" face="tahoma"></font> </div>
<div dir="ltr"><font size="2" face="tahoma">The IVR should do this:</font></div>
<div dir="ltr"><font size="2" face="tahoma"></font> </div>
<div dir="ltr"><font size="2" face="tahoma">- Answer session</font> (working)</div>
<div dir="ltr"><font size="2" face="tahoma">- Play some wav files (working)</font></div>
<div dir="ltr"><font size="2" face="tahoma">- Record a message to file (working)</font></div>
<div dir="ltr"><font size="2" face="tahoma">- Hang up the first session (working)</font></div>
<div dir="ltr"><font size="2" face="tahoma">- Call the second session (not working)</font></div>
<div dir="ltr"><font size="2" face="tahoma">- Play the previous recorded file (not working)</font></div>
<div dir="ltr"><font size="2" face="tahoma"></font> </div>
<div dir="ltr"><font size="2" face="tahoma">After I dial the second session, the console says "channel is hungup already". How should i do this?</font></div>
<div dir="ltr"><font size="2" face="tahoma"></font> </div>
<div dir="ltr"><font size="2" face="tahoma">Kind regards,</font></div>
<div dir="ltr"><font size="2" face="tahoma"></font> </div>
<div dir="ltr"><font size="2" face="tahoma">Erik Dekkers (wvds-nl on IRC)</font></div>
<div dir="ltr"><font size="2" face="tahoma"></font> </div>
<div dir="ltr"><font size="2" face="tahoma"></font> </div>
<div dir="ltr"> </div>
<div dir="ltr"><font size="2" face="tahoma">my script:</font></div>
<div dir="ltr"><font size="2" face="tahoma"></font> </div>
<div dir="ltr"><font size="2" face="tahoma">var allDigits = "";</font></div>
<div dir="ltr"><font size="2" face="tahoma">function on_dtmf(session, type, digits, arg)<br>
{<br>
if (digits.digit == "#") {<br>
return allDigits;<br>
}</font></div>
<div dir="ltr"><font size="2" face="tahoma"> if (digits.digit == "*") {<br>
return false; //stop the recording.<br>
}</font></div>
<div dir="ltr"><font size="2" face="tahoma"> console_log("digit: " + digits.digit + "\n");<br>
allDigits += digits.digit;<br>
return(allDigits);<br>
}</font></div>
<div dir="ltr"><font size="2" face="tahoma">session.answer();</font></div>
<div dir="ltr"><font size="2" face="tahoma">if (session.ready()) {<br>
allDigits = "";<br>
var rtn;</font></div>
<div dir="ltr"><font size="2" face="tahoma"> rtn = session.streamFile("/home/edekkers/sounds/10_spreek_in.wav", on_dtmf, "");</font></div>
<div dir="ltr"><font size="2" face="tahoma"> if (session.ready()) {<br>
var tmp_Filename = "/tmp/test.wav";</font></div>
<div dir="ltr"><font size="2" face="tahoma"> if (session.ready()) {<br>
rtn = session.recordFile(tmp_Filename, on_dtmf, "", 120);<br>
}</font></div>
<div dir="ltr"><font size="2" face="tahoma"> rtn = session.streamFile("/home/edekkers/sounds/11_bericht_is_ontvangen.wav", on_dtmf, "");</font></div>
<div dir="ltr"><font size="2" face="tahoma"> if (session.ready()) {<br>
session.hangup();<br>
}<br>
}<br>
}</font></div>
<div dir="ltr"><font size="2" face="tahoma">session.execute("bridge","user/202")<br>
if (session.ready()) {<br>
session.streamFile("/tmp/test.wav");<br>
}<br>
</font></div>
<div dir="ltr"><font size="2" face="tahoma"><font face="tahoma"></font></font> </div>
<div dir="ltr"><font size="2" face="tahoma"><font face="tahoma"></font> </div>
</font></div>
</body>
</html>