Tropo Scripting Development Guide Home  |  Frameset Home


record()  method


Used to request input from the caller and records any audible response. At the conclusion of the recording, the audio file may be automatically sent to an external server via FTP or an HTTP POST/Multipart Form. If specified, the audio file can also be transcribed and the text returned to you via an email address or HTTP POST/Multipart Form. This parameter only applies to voice calls.



usage

record( prompt: String, {
    bargein: Boolean,
    beep: Boolean,
    maxTime: Integer,
    onError: Function,
    onEvent: Function,
    onHangup: Function,
    onRecord: Function,
    onTimeout: Function,
    recordFormat: String,
    recordMethod: String,
    recordPassword: String,
    recordURI: String,
    recordUser: String,
    repeat: Integer,
    silenceTimeout: Float,
    terminator: String,
    timeout: float,
    transcriptionId: String,
    transcriptionOutFormat: String,
    transcriptionOutURI: String,
    voice: String } )


parameters

prompt Data Type: String Default: (none) Required
In the case of a voice session, this can either be TTS (Text to Speech) or it can be a link to an audio file. In the case of a text messaging session, this would be the text sent to the user. Prompt can be a null value.



map parameters

bargein Data Type: Boolean Default: true Optional
The bargein attribute specifies whether or not the caller will be able to interrupt the TTS/audio output with a touch tone phone keypress or voice utterance. A value of 'true' indicates that the user is allowed to interrupt, while a value of 'false' forces the caller to listen to the entire prompt before being allowed to give input to the application.
beep Data Type: Boolean Default: false Optional
When set to true, callers will hear a tone indicating the recording has begun.
maxTime Data Type: Integer Default: 30 Optional
The maximum amount of time (in seconds) allowed for a recording. Defaults to 30 seconds, but may be set much higher.

How high? 68 years. Seriously. 2,147,483,647 seconds, to be precise. So if you want to record your entire life, you'd better plan on dying a little early.
onError Data Type: Function Default: "" (undefined) Optional
This registers an event handler that fires when a system error (a non-user error) occurs during input. See onBadChoice and onTimeout for information on how to handle user errors.
onEvent Data Type: Function Default: "" (undefined) Optional
This registers an event handler that fires as a catch all for all events. See the Events section of the Scripting Guide for more information on possible events.
onHangup Data Type: Function Default: "" (undefined) Optional
This registers an event handler that fires when the user disconnects or hangs up.
onRecord Data Type: Function Default: "" (undefined) Optional
This registers an event handler that fires when a recording of the input is complete.
onTimeout Data Type: Function Default: "" (undefined) Optional
This registers an event handler that fires when the user did not respond within a specified period of time.
recordFormat Data Type: String Default: audio/wav Optional
The audio format used for the recording; values can be 'audio/wav' or 'audio/mp3'.
recordMethod Data Type: String Default: POST Optional
When submitting recordings via HTTP, this parameter determines the method used. This can be 'POST' or 'PUT'. When sending via POST, the name of the form field is "filename".
recordPassword Data Type: String Default: (none) Optional
When using FTP, this indicates the FTP password.
recordURI Data Type: String Default: (none) Optional
The FTP or HTTP URL to send the recorded audio file. When sending via POST, the name of the form field is "filename".
recordUser Data Type: String Default: (none) Optional
When using FTP, this is the FTP account username

Note: If the user and password field in the URL contains one of these characters : or @ or /, the character must be encoded.
repeat Data Type: Integer Default: 0 Optional
Number of times to attempt to collect a valid input from the user before considering the ask a nomatch.
silenceTimeout Data Type: Float Default: 5.0 Optional
The amount of time, after the caller is done speaking, before the user's response is considered done. Applies only to voice input.
terminator Data Type: String Default: (none) Optional
This is the touch-tone key (also known as "DTMF digit") that stops the recording.
timeout Data Type: float Default: 30.0 Optional
The amount of time Tropo will wait--after sending or playing the prompt--for the user to begin a response.
transcriptionId Data Type: String Default: (none) Optional
User definable ID that can be included when the transcription is posted to transcriptionOutURI.
transcriptionOutFormat Data Type: String Default: xml Optional
The formatting for the transcription that will be sent to your transcription URI - either 'xml' or 'json'.
transcriptionOutURI Data Type: String Default: "" (undefined) Optional
The e-mail address or HTTP URL to send the transcription results to.

Note: Email addresses must be prefaced with mailto: if used (mailto:you@example.com)
voice Data Type: String Default: allison Optional
Specifies the voice to be used when speaking text back to a user. Possible voices are:

  • carmen - Castilian Spanish - Female
  • jorge - Castilian Spanish - Male
  • florence - French - Female
  • bernard - French - Male
  • allison - US English - Female
  • dave - US English - Male
  • kate - British English - Female
  • simon - British English - Male
  • katrin - German - Female
  • stefan - German - Male
  • paola - Italian - Female
  • luca - Italian - Male
  • saskia - Dutch - Female
  • willem - Dutch - Male
  • soledad - Mexican Spanish - Female
  • carlos - Mexican Spanish - Male
  • zosia - Polish - Female
  • krzysztof - Polish - Male



events

error   hangup   record   timeout


return values

event


code samples

Javascript example - recording audio input
answer();
// Record a message.  Play the beep, caller must speak within 10 seconds.  
// Allow 7 seconds of silence and up to 60 seconds of recording.
result=record( "Hello.  Thanks for calling.  Leave your message at the beep.",
                { beep:true, timeout:10, silenceTimeout:7, maxTime:60 }         );
if ( result.name=='record') 
{ 
    // record returns a URI pointing to the recorded audio...
    log( "result.recordURI = " + result.recordURI );
    // we can then use that URI in a say command to play the recorded audio back...
    say( "you said " + result.recordURI );
}
hangup();


PHP example - saving a posted recording
<?php

$target_path = 'path/to/recording/' . $_FILES['filename']['name'];
move_uploaded_file($_FILES['filename']['tmp_name'], $target_path));
?>
 




additional links

none


  ANNOTATIONS: EXISTING POSTS
0 posts - click the button below to add a note to this page

login



© 2010 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site