The <Record> element records the caller’s voice and stores the file containing the audio recording.

Note: If bothLegs is set to true, it will record the complete conversation between both the parties during the call. timeout, finishOnKey, playBeep attributes have no effect when bothLegs is set to true. In this case, recording will start on background and will continue until call has hung up or maxLength has been reached.

Element Attributes

The <Record> element supports the following attributes that modify its behavior:

Attribute Name Allowed Values Default Value
action absolute URL no default action for Record
method GET, POST POST
redirect true, false true
timeout positive integer 15
finishOnKey any digit, #, * 1234567890*#
maxLength integer greater than 1 60 (1 min)
playBeep true, false true
filePath Any file path /usr/local/freeswitch/recordings/
fileFormat mp3, wav mp3
fileName File name to be used for recording. If empty, a unique name is used. none
bothLegs true, false false
  • action: Submit the result of the record to this URL.
  • method: Submit to ‘action’ url using GET or POST.
  • redirect if ‘false’, don’t redirect to ‘action’, only request url and continue to next element.
  • maxLength: Maximum number of seconds to record (default 60).
  • timeout: Seconds of silence before considering the recording complete (default 500). Only used when bothLegs is ‘false’.
  • playBeep: Play a beep before recording (true/false, default true). Only used when bothLegs is ‘false’.
  • finishOnKey: Stop recording on this key. Only used when bothLegs is ‘false’.
  • fileFormat: File format (default mp3)
  • filePath: Full directory path to save the file to
  • fileName: If provided this name will be used for the recording. If empty or not set, a unique name will be generated.
  • bothLegs: Record both legs (true/false, default false). No beep will be played
Request Parameters
Parameter Description
RecordingFileFormat File format used for recording.
RecordingFilePath File path used for recording.
RecordingFileName File name used for recording
RecordFile Complete path to the recorded file.
RecordingDuration Recording length in milliseconds. Always -1 if bothLegs was set.
Digits If set, the digits pressed to stop the record.

Examples

Example 1: Record a voicemail

This is an example of a simple voicemail prompt. The caller is asked to leave a message after the beep. The <Record> element beeps and begins recording up to 30 seconds of audio.

1
2
3
4
5
6
7
8
9
10
11
12
13
<?xml version="1.0" encoding="UTF-8"?>
<!-- page located at http://www.foo.com/voicemail_record.xml -->
<Response>
    <Speak>
        Please leave a message after the beep. 
        Press the star key when done.
    </Speak>
    <Record 
        maxLength="30"
        finishOnKey="*"
        />
    <Speak>Recording not received</Speak>
</Response>
  • If the caller remains silent, the <Record> element exits after 15 seconds, falling through to the next element. In this case, it would fall through to the <Speak> element.

Example 2: Record a complete call session

1
2
3
4
5
6
7
8
9
<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Record bothLegs="true" />
    <Dial>
         <Number sendDigits="wwww2410" gateways="sofia/gateway/PSTNgateway1/,sofia/gateway/PSTNgateway2/" gatewayCodecs="'PCMA,PCMU','G729,PCMU'">
             15551234567
         </Number>
     </Dial>
</Response>

Comments are closed.