dtmftest.js 417 B

123456789101112131415161718192021
  1. function onPlayFile(s, type, obj, arg)
  2. {
  3. try {
  4. if (type == "dtmf") {
  5. console_log("info", "DTMF digit: " + s.name + " [" + obj.digit + "] len [" + obj.duration + "]\n\n");
  6. session.execute("phrase", "spell," + obj.digit);
  7. }
  8. } catch (e) {
  9. console_log("err", e + "\n");
  10. }
  11. return true;
  12. }
  13. session.answer();
  14. while(session.ready()) {
  15. session.streamFile(argv[0], onPlayFile);
  16. }