<Play/>

Introduction to <Play/> Tag in Opentact XML

The <Play/> tag in Opentact XML offers users the capability to play audio files, either from remote URLs or by converting specified text to speech. This versatile feature supports both mp3 and wav file formats, enhancing the interactive and dynamic nature of call flows. Let's explore how the <Play/> tag works with a few illustrative examples:

Basic Audio Playback:

<Response>
   <Answer/>
   <Play>https://api.callify.io/public/media/b6226d81-8e2a-4d9d-9d34-f5c598d5f912_f3ad945a-7ba6-4057-8e6c-44a1afc7e832.wav</Play>
   <Error>
       <Hangup/>
   </Error>
</Response>

In this example, the <Play/> tag instructs Opentact to play an audio file from a remote URL (in this case, a WAV file). The call flow continues with the <Error> block to handle any potential errors, such as the file being unavailable.

Supporting Multiple Audio Formats:

The <Play/> tag seamlessly supports both mp3 and wav file formats, providing flexibility in audio file selection.

<Response>
   <Answer/>
   <!-- Play an mp3 file -->
   <Play>https://example.com/audio/example.mp3</Play>

   <!-- Play a wav file -->
   <Play>https://example.com/audio/example.wav</Play>

   <Error>
       <Hangup/>
   </Error>
</Response>

Users can incorporate various audio files into their call flows, catering to diverse preferences and requirements.

leg

no

Parameter say which leg should hear the audio:

Available values are: aleg, bleg, both

loop

no

playback loop. Default: 1

url

yes

playback url (mp3 / wav)

Last updated