When you make an outbound call and then connect that call to a different number using the Dial element, you can play a custom caller tone using the dialMusic attribute.

Plivo requests the dialMusic URL using the POST HTTP method for a valid Play, Speak, or Wait XML element.

To play a message on a call while it’s being connected, you should return the second XML example response.

from plivo import plivoxml

response = plivoxml.ResponseElement()
response.add(
    plivoxml.DialElement(dial_music='https://<yourdomain>.com/dial_music/').add(
        plivoxml.NumberElement('12025551111')))
print(response.to_string())

# XML to play the message
play_message_response = plivoxml.ResponseElement()
play_message_response.add(
    plivoxml.SpeakElement('Your call is being connected'))
print(play_message_response.to_string())
Response
<Response>
    <Dial dialMusic="https://<yourdomain>.com/dial_music/">
        <Number>12025551111</Number>
    </Dial>
</Response>
Return this XML to play the message
<Response>
    <Speak>Your call is being connected</Speak>
</Response>