When an inbound call triggers the voice URL on a FreeClimb application, the PlayEarlyMedia
command is sent before a call has been answered, hung up, or rejected. It can only be in the PerCL script returned for an incoming Call. In such cases, one or more PlayEarlyMedia commands can be executed before FreeClimb attempts to connect the call. The audio file it uses can be stored in any location that is accessible via URL.
FreeClimb supports multi-channel 8 bit audio a-law/μ-law (WAV) formats with an audio sampling rate of between 1000 and 96000. The max download size is 100MB. You can convert files to this format using an audio editor. Audacity is a free, open source option:
- Import the high quality source audio
- Adjust the project rate to 8 kHz.
- Export the track using the μ-law encoding.
Nesting Rules
No commands can be nested within PlayEarlyMedia
and the PlayEarlyMedia
command cannot be nested in any other commands.
Example
This PerCL script plays a greeting as the first command.
[
{
"PlayEarlyMedia" : {
"file" : "http://www.foo.com/greeting.wav"
}
}
]
Command Attributes
PlayEarlyMedia
supports the following attributes that modify its behavior:
file
REQUIREDType: string
URL of the audio file to be played to the caller. The URL can be the recordingUrl
generated from the RecordUtterance
or StartRecordCall
PerCL commands or any accessible URL.
FreeClimb will respect Cache-Control headers for this file. See Cache-Control Headers below for more details.
Cache-Control Headers
Use headers to limit repeated requests for unchanged audio. If no Cache-Control header is provided, the file will be cached for 5 seconds by default. FreeClimb supports the following headers and Cache-Control directives:
Header | Type |
---|---|
Cache-Control | General header |
Pragma | General header |
Expires | Response header |
ETag | Response header |
Last-Modified | Response header |
Cache-Control Request Directive | FreeClimb Support |
---|---|
max-age | Supported |
no-cache | Supported |
no-store | Supported |
private | Unsupported |
public | Unsupported |
must-revalidate | Unsupported |
no-transform | Unsupported |
proxy-revalidate | Unsupported |
s-maxage | Unsupported |