Skip to main content
When multiple calls are fired, the first person to answer gets connected and the rest of the calls are dropped. To make sure that the call is answered by a person and not by voice mail, use the confirmKey and confirmSound attributes. The example XML here requires the call recipient to input the digit 5 after answering the call to connect. Plivo requests the confirmSound URL using the POST HTTP method for a valid Play, Speak, or a Wait XML element. To play a message asking the recipient to input a DTMF tone to connect the call, return the second XML example.
from plivo import plivoxml

response = plivoxml.ResponseElement()
response.add(
    plivoxml.DialElement(
        confirm_key='5', confirm_sound='https://<yourdomain>.com/confirm_sound/').add(
            plivoxml.NumberElement('12025551111')).add(
                plivoxml.NumberElement('12025552222')).add(
                    plivoxml.NumberElement('12025553333')))
print(response.to_string())

# XML to play the message
play_message_response = plivoxml.ResponseElement()
play_message_response.add(
    plivoxml.SpeakElement('Enter the digit 5 to connect the call'))
print(play_message_response.to_string())
Response
<Response>
    <Dial confirmSound="https://<yourdomain>.com/confirm_sound/" confirmKey="5">
        <Number>12025551111</Number>
        <Number>12025552222</Number>
        <Number>12025553333</Number>
    </Dial>
</Response>
Return the following XML to play a message.
<Response>
    <Speak>Enter the digit 5 to connect the call</Speak>
</Response>
I