0

I am currently learning Twilio. I tried creating an outbound call, but after creating the call and running TwiXML, call terminates automatically.

# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client


# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = 'aaaa'
auth_token = 'bbbb'
client = Client(account_sid, auth_token)

call = client.calls.create(
                        twiml='<Response><Say>Ahoy, World!</Say></Response>',
                        to='+91638000000',
                        from_='+132500000'
                    )

print(call.sid)

while True:
    reply: str = input('Enter reply > ')
    call2 = call.update(twiml=f'<Response><Say>{reply}</Say></Response>')
    print('updated')

Now, I able to the receive the call in +91638000000, but after saying the 'Ahoy, World', call terminates automatically without reaching while block

I want to continue it and hang up manually when needed. How to do it?

RagAnt
  • 1,064
  • 2
  • 17
  • 35

0 Answers0