Last active
August 29, 2015 14:15
-
-
Save PixnBits/5d31a86a2112af3261ee to your computer and use it in GitHub Desktop.
fixed the borken (written by ANOTHER LANGUAGE developer?) Session collectInput example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tenDigitCollector( session, type, data, arg ) { | |
if ( type == "dtmf" ) { | |
arg.digits += data.digit; | |
return arg.digits.length >= 10; | |
} | |
return true; | |
} | |
if ( session.ready() ) { | |
var dataStore = { | |
digits: "" | |
}; | |
session.answer(); | |
session.streamFile( "sounds/typeSomeDigits.wav" ); | |
session.collectInput( tenDigitCollector, dataStore, 3000, 0); | |
console_log( "info", "Got " + dataStore.digits + "\n" ); | |
session.streamFile( "sounds/thanksBye.wav" ); | |
session.hangup(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment