Skip to content

Instantly share code, notes, and snippets.

@PixnBits
Last active August 29, 2015 14:15
Show Gist options
  • Save PixnBits/5d31a86a2112af3261ee to your computer and use it in GitHub Desktop.
Save PixnBits/5d31a86a2112af3261ee to your computer and use it in GitHub Desktop.
fixed the borken (written by ANOTHER LANGUAGE developer?) Session collectInput example
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