MultiPartyCall
Conference
AudioStream
- Overview
- Initiate an audio stream
- Stream events to Plivo
Dial
GetDigits
PreAnswer
Redirect
Redirect
Tranfer a call
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
Copy
Ask AI
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())
Copy
Ask AI
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())
Copy
Ask AI
from flask import Flask, Response, request
import plivoxml
app=Flask(__name__)
@app.route('/transfer_call/', methods=['GET','POST'])
def transfer_call():
response = plivoxml.Response()
response.addSpeak("Your call is being transferred.")
response.addRedirect("https://foo.com/redirect")
return Response(str(response), mimetype='text/xml')
if __name__ == "__main__":
app.run(host='0.0.0.0', debug=True)
# Sample Conference XML
# <Response>
# <Speak>Your call is being transferred.</Speak>
# <Redirect>https://foo.com/redirect</Redirect>
# </Response>
Response
Copy
Ask AI
<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.
Copy
Ask AI
<Response>
<Dial dialMusic="real">
<Number>12025551111</Number>
</Dial>
</Response>
Assistant
Responses are generated using AI and may contain mistakes.