import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')

response = client.calls.play(
    call_uuid='bc480f62-6d99-469e-b80e-090e620de824',
    urls='https://s3.amazonaws.com/plivocloud/music.mp3', )
print(response)
{
  "message": "play started",
  "api_id": "07abfd94-58c0-11e1-86da-adf28403fe48"
}

This endpoint allows you to play an audio file during an active call. Plivo supports .mp3 and .wav audio files.

API Endpoint

POST
https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Play/

Arguments

ParameterTypeRequiredDescription
urlsstringYesA URL or a list of comma-separated URLs linking to an .mp3 or .wav file.
lengthintegerNoThe maximum length, in seconds, to play this audio file.
legsstringNoThe call leg in which the audio is to be played.
Allowed values: aleg, bleg, or both.
Defaults to aleg.
loopbooleanNoWhen set to true, the audio file plays indefinitely.
Defaults to false.
mixbooleanNoDetermines how current call audio behaves when the file is played.
If false, participants cannot hear others until audio stops.
If true, call and play audio are mixed.
Defaults to true.

Returns

Returns the acknowledgement that the audio file has started playing.

import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')

response = client.calls.play(
    call_uuid='bc480f62-6d99-469e-b80e-090e620de824',
    urls='https://s3.amazonaws.com/plivocloud/music.mp3', )
print(response)
{
  "message": "play started",
  "api_id": "07abfd94-58c0-11e1-86da-adf28403fe48"
}