In this example, we have a Redirect element after a Speak element. When the Speak element finishes, the Redirect element executes, and Plivo processes the call based on the XML returned from the Redirect element.

Example Request

from plivo import plivoxml

response = plivoxml.ResponseElement()
response.add(
    plivoxml.SpeakElement('Your call is being transferred.'))
response.add(plivoxml.RedirectElement('https://<yourdomain>.com/redirect/'))
print(response.to_string())

Response

<Response>
    <Speak>Please wait while you call is being transferred.</Speak>
    <Redirect>https://<yourdomain>.com/redirect/</Redirect>
</Response>

To connect the incoming call to a different number, you should return the section example’s XML from the Redirect URL.

<Response>
    <Dial dialMusic="real">
        <Number>12025551111</Number>
    </Dial>
</Response>