PlayEarlyMedia

When an inbound call triggers the voice URL on a FreeClimb application, the PlayEarlyMediacommand 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:

  1. Import the high quality source audio
  2. Adjust the project rate to 8 kHz.
  3. 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

REQUIRED

Type: 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:

HeaderType
Cache-ControlGeneral header
PragmaGeneral header
ExpiresResponse header
ETagResponse header
Last-ModifiedResponse header
Cache-Control Request DirectiveFreeClimb Support
max-ageSupported
no-cacheSupported
no-storeSupported
privateUnsupported
publicUnsupported
must-revalidateUnsupported
no-transformUnsupported
proxy-revalidateUnsupported
s-maxageUnsupported