record
Record the call audio in the foreground pausing further SWML execution until recording ends. Use this, for example, to record voicemails.
To record calls in the background in a non-blocking fashion, use the record_call
Properties
record
An object that accepts the following properties.
record.stereo
Whether to record in stereo mode
record.format
Format ("wav", "mp3", or "mp4")
record.direction
Direction of the audio to record: "speak" for what party says, "listen" for what party hears
record.terminators
String of digits that will stop the recording when pressed
record.beep
Whether to play a beep before recording
record.input_sensitivity
How sensitive the recording voice activity detector is to background noise. A larger value is more sensitive. Allowed values from 0.0 to 100.0.
record.initial_timeout
How long, in seconds, to wait for speech to start?
record.end_silence_timeout
How much silence, in seconds, will end the recording?
record.max_length
Maximum length of the recording in seconds.
record.status_url
HTTP or HTTPS URL to deliver record status events. Learn more about status callbacks.
Variables
Set by the method:
- record_url: (out) the URL of the newly created recording.
- record_result: (out)
success|failed.
StatusCallbacks
A POST request will be sent to status_url with a JSON payload like the following:
event_type
The type of event. Always calling.call.record for this method.
event_channel
The channel for the event, includes the SWML session ID.
timestamp
Unix timestamp (float) when the event was generated.
project_id
The project ID associated with the call.
space_id
The Space ID associated with the call.
params
An object containing recording-specific parameters.
params.call_id
The call ID.
params.node_id
The node handling the call.
params.control_id
The control ID for this record operation.
params.state
The current recording state. Valid values: recording, paused, finished, no_input, error.
params.url
URL to download the recording.
params.duration
Recording duration in seconds. Present when state is finished or no_input.
params.size
Recording file size in bytes. Present when state is finished or no_input.
params.recording_id
The unique identifier for the recording. Present when available.
params.start_time
Unix timestamp (seconds, float) when the recording started. Present when the recording has ended.
params.end_time
Unix timestamp (seconds, float) when the recording ended. Present when the recording has ended.
params.pause_behavior
How paused recording handles audio. Only present when state is paused. Valid values: silence, skip.
params.record
Recording configuration details.
record.audio.format
Recording format. Valid values: wav, mp3.
record.audio.direction
Direction of the audio recorded: speak or listen.
record.audio.stereo
Whether the recording was made in stereo mode.