[Freeswitch-users] Javascript IVR session question

Erik Dekkers erik.dekkers at wvds.nl
Sun Jan 23 23:48:27 MSK 2011


Hey ppl,

At the moment im building a Javascript based IVR but im kind of stuck on a part.

The IVR should do this:

- Answer session (working)
- Play some wav files (working)
- Record a message to file (working)
- Hang up the first session (working)
- Call the second session (not working)
- Play the previous recorded file (not working)

After I dial the second session, the console says "channel is hungup already". How should i do this?

Kind regards,

Erik Dekkers (wvds-nl on IRC)



my script:

var allDigits = "";
function on_dtmf(session, type, digits, arg)
{
    if (digits.digit == "#") {
        return allDigits;
    }
    if (digits.digit == "*") {
        return false; //stop the recording.
    }
    console_log("digit: " + digits.digit + "\n");
    allDigits += digits.digit;
    return(allDigits);
}
session.answer();
if (session.ready()) {
    allDigits = "";
    var rtn;
    rtn = session.streamFile("/home/edekkers/sounds/10_spreek_in.wav", on_dtmf, "");
    if (session.ready()) {
        var tmp_Filename = "/tmp/test.wav";
        if (session.ready()) {
            rtn = session.recordFile(tmp_Filename, on_dtmf, "", 120);
            }
        rtn = session.streamFile("/home/edekkers/sounds/11_bericht_is_ontvangen.wav", on_dtmf, "");
        if (session.ready()) {
            session.hangup();
        }
    }
}
session.execute("bridge","user/202")
if (session.ready()) {
    session.streamFile("/tmp/test.wav");
}


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20110123/628e2d25/attachment.html 


More information about the FreeSWITCH-users mailing list