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
| Name | Type | Default | Description |
|---|---|---|---|
recordRequired | object | - | An object that accepts the record parameters. |
record Parameters
| Name | Type | Default | Description |
|---|---|---|---|
stereoOptional | boolean | false | Whether to record in stereo mode |
formatOptional | string | wav | Format ("wav" or "mp3") |
directionOptional | string | speak | Direction of the audio to record: "speak" for what party says, "listen" for what party hears |
terminatorsOptional | string | # | String of digits that will stop the recording when pressed |
beepOptional | boolean | false | Whether to play a beep before recording |
input_sensitivityOptional | number | 44.0 | 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. |
initial_timeoutOptional | number | 4.0 seconds | How long, in seconds, to wait for speech to start? |
end_silence_timeoutOptional | number | 5.0 seconds | How much silence, in seconds, will end the recording? |
status_urlOptional | string | - | HTTP or HTTPS URL to deliver record status events. |
Variables
Set by the method:
- record_url: (out) the URL of the newly created recording.
- record_result: (out)
success|failed.
Examples
Record some audio and play it back
- YAML
- JSON
version: 1.0.0
sections:
main:
- play:
url: 'say:Start speaking after the beep. Press hash to end recording.'
- record:
end_silence_timeout: 3
beep: true
- play:
url: 'say:Recording %{record_result}. Playing back recording:'
- play:
url: '%{record_url}'
{
"version": "1.0.0",
"sections": {
"main": [
{
"play": {
"url": "say:Start speaking after the beep. Press hash to end recording."
}
},
{
"record": {
"end_silence_timeout": 3,
"beep": true
}
},
{
"play": {
"url": "say:Recording %{record_result}. Playing back recording:"
}
},
{
"play": {
"url": "%{record_url}"
}
}
]
}
}