RecordFile

From SoftIVR

Revision as of 17:47, 26 April 2009 by Dave (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

recordFile

recordFile(filename[, options]) records audio from the caller.

Parameters

  • filename - the name of the file to record
  • options - an optional string containing options

The options are:

  • background - return immediately, so that the script can carry on processing while recording;
  • stop_on_dtmf - stop playing and return if the IVR received a tone during recording;
  • max_time=<n> - limit recording time to a maximum of n seconds;
  • max_silence=<n> - stop recording after n seconds of silence.

Return values

The recordFile function returns 0 on success.

Examples

This snippet recording, and stops if the user presses 1:

recordFile("recording.wav", "background");
while (getStatus().indexOf("recording") >= 0) {
  dtmf = getDTMF(1);
  if (dtmf == 1) {
    stopIVR();
    break;
  }
}

Return to Javascript functions.

Personal tools