I make a outbound call i.e I make a request to twilio to make a call to a number using twilio api. How to know if a person has picked up or rejected the call?. What is statuscallback url?..I dont have a url.
Asked
Active
Viewed 93 times
0
-
We were chatting on [this question](https://stackoverflow.com/questions/40419512/answered-notification-for-outbound-call-from-an-app-twilio/40423262?noredirect=1#comment95496179_40423262) but it seems like a better idea to cover this here. Can you share the code you're using? – philnash Jan 24 '19 at 05:37
-
`call=client_twilio.calls.create(status_callback="https://401d2bb8.ngrok.io",method='GET',to=number,from_="+19729759934",url="http://demo.twilio.com/docs/voice.xml",status_callback_method='POST')` `print(call.sid)`. This is the code iam using. I need to know the status of the outbound call in my output. – Anesh Jan 24 '19 at 05:48
-
Ok, you need to set up a server to receive the status callback webhook. Have you done that? – philnash Jan 24 '19 at 05:52
-
No sir. How to setup a server? – Anesh Jan 24 '19 at 05:56
-
I know this tutorial is about sending SMS messages, but the process for calls is the same, so I recommend you walk through this and see how you do: https://www.twilio.com/docs/sms/tutorials/how-to-confirm-delivery-python – philnash Jan 24 '19 at 05:57
-
Thank you. Let me check it and say if it works. – Anesh Jan 24 '19 at 05:58
-
Should always keep running that flask code to get the status callback. When I run that, it says Running on http:/// (Press CTRL+C to quit)...should I give that http to the status callback? – Anesh Jan 24 '19 at 06:27
-
You will need the server to be running to receive the webhook, yes – philnash Jan 24 '19 at 06:32
-
Iam still not getting the status. i gave ngrok http 5000 and copied the link to status callback url. Still when I `print(call.sid)` iam getting some random alpha numeric thing. – Anesh Jan 24 '19 at 06:49
-
Please help me. I need to know the callback status – Anesh Jan 24 '19 at 07:42
-
when you call `print(call.sid)` the `sid` is the unique ID for the call, so it is random numbers and letters. If you want the call status, try `call.status`. Sounds like it's all working for you so I'll write this up as an answer. – philnash Jan 24 '19 at 21:46
-
Thanks but iam getting the status 'queued' only. How do I know if the call is completed? – Anesh Jan 25 '19 at 06:46
-
That's when you send the message or make the call. Did you set up the Flask app as [shown in the tutorial](https://www.twilio.com/docs/sms/tutorials/how-to-confirm-delivery-python?code-sample=code-handle-a-sms-statuscallback&code-language=Python&code-sdk-version=6.x)? Did you get ngrok set up? Did you use the ngrok URL to your Flask app as the `statusCallback` URL? – philnash Jan 25 '19 at 21:44
1 Answers
0
Twilio developer evangelist here.
When you make an outbound call you can register to receive status updates by setting the statusCallback
parameter to a URL. When the call changes status, Twilio will send an HTTP request to the URL with details of the call and its current status.
To learn more about this, I recommend following this tutorial. It covers delivery notifications for SMS messages, but the process is exactly the same for calls.

philnash
- 70,667
- 10
- 60
- 88