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"); }
If I read this correctly you are hanging up the channel that you later wish to bridge to user/202. Why do you need to hangup? Perhaps you could describe a little more about the application? I'm sure we can help you iron out the details. -MC On Sun, Jan 23, 2011 at 12:48 PM, Erik Dekkers <erik.dekkers@wvds.nl> wrote:
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"); }
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Michael, It's like this. I would like to let the customer records a message. Then a technician should get called and the previous recorded message should be played. So after the customer has records his message, the line should be hung up. Then a new call should be made from the IVR to the technician. Regards, Erik Van: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] Namens Michael Collins Verzonden: maandag 24 januari 2011 21:14 Aan: FreeSWITCH Users Help Onderwerp: Re: [Freeswitch-users] Javascript IVR session question If I read this correctly you are hanging up the channel that you later wish to bridge to user/202. Why do you need to hangup? Perhaps you could describe a little more about the application? I'm sure we can help you iron out the details. -MC On Sun, Jan 23, 2011 at 12:48 PM, Erik Dekkers <erik.dekkers@wvds.nl<mailto:erik.dekkers@wvds.nl>> wrote: 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"); } _______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org<mailto:FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
So the customer records a message, then hangs up. Then you want a separate call made to the technician. So the call made to the tech (which is user/202 I presume) is just another IVR?
From what I can see, you've got a one-legged call between the caller and the IVR, and you disconnect that when the caller is done recording his message. The "proper" thing to do would be to generate a new call (instead of attempting to bridge a non-existent call) to the tech. Check out this wiki page for the syntax: http://wiki.freeswitch.org/wiki/Session_originate
-MC On Tue, Jan 25, 2011 at 12:57 AM, Erik Dekkers <erik.dekkers@wvds.nl> wrote:
Michael,
It’s like this. I would like to let the customer records a message. Then a technician should get called and the previous recorded message should be played.
So after the customer has records his message, the line should be hung up. Then a new call should be made from the IVR to the technician.
Regards,
Erik
*Van:* freeswitch-users-bounces@lists.freeswitch.org [mailto: freeswitch-users-bounces@lists.freeswitch.org] *Namens *Michael Collins *Verzonden:* maandag 24 januari 2011 21:14 *Aan:* FreeSWITCH Users Help *Onderwerp:* Re: [Freeswitch-users] Javascript IVR session question
If I read this correctly you are hanging up the channel that you later wish to bridge to user/202. Why do you need to hangup? Perhaps you could describe a little more about the application? I'm sure we can help you iron out the details.
-MC
On Sun, Jan 23, 2011 at 12:48 PM, Erik Dekkers <erik.dekkers@wvds.nl> wrote:
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"); }
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Michael, This is where I was looking for! While reading your answer I remember it again how to do this :) Thank you very much. Kind regards, Erik Van: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] Namens Michael Collins Verzonden: dinsdag 25 januari 2011 21:04 Aan: FreeSWITCH Users Help Onderwerp: Re: [Freeswitch-users] Javascript IVR session question So the customer records a message, then hangs up. Then you want a separate call made to the technician. So the call made to the tech (which is user/202 I presume) is just another IVR?
From what I can see, you've got a one-legged call between the caller and the IVR, and you disconnect that when the caller is done recording his message. The "proper" thing to do would be to generate a new call (instead of attempting to bridge a non-existent call) to the tech. Check out this wiki page for the syntax: http://wiki.freeswitch.org/wiki/Session_originate
-MC On Tue, Jan 25, 2011 at 12:57 AM, Erik Dekkers <erik.dekkers@wvds.nl<mailto:erik.dekkers@wvds.nl>> wrote: Michael, It's like this. I would like to let the customer records a message. Then a technician should get called and the previous recorded message should be played. So after the customer has records his message, the line should be hung up. Then a new call should be made from the IVR to the technician. Regards, Erik Van: freeswitch-users-bounces@lists.freeswitch.org<mailto:freeswitch-users-bounces@lists.freeswitch.org> [mailto:freeswitch-users-bounces@lists.freeswitch.org<mailto:freeswitch-users-bounces@lists.freeswitch.org>] Namens Michael Collins Verzonden: maandag 24 januari 2011 21:14 Aan: FreeSWITCH Users Help Onderwerp: Re: [Freeswitch-users] Javascript IVR session question If I read this correctly you are hanging up the channel that you later wish to bridge to user/202. Why do you need to hangup? Perhaps you could describe a little more about the application? I'm sure we can help you iron out the details. -MC On Sun, Jan 23, 2011 at 12:48 PM, Erik Dekkers <erik.dekkers@wvds.nl<mailto:erik.dekkers@wvds.nl>> wrote: 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"); } _______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org<mailto:FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org _______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org<mailto:FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
participants (2)
-
Erik Dekkers
-
Michael Collins