How do I modify a call after it has been created?

Once a call is created you can modify calls further via the REST API. For example, you can end the call if it has been ringing too long or you might want to redirect it to a feedback survey after the conversation is completed. To modify an in-progress call you'll need to find the call SID, as well as specify the following optional parameters: Url, Method, and/or Status.

Depending on how you created the call, there are a few ways to find the call SID while the call is in-progress:

Outbound API calls

When you initiate a call through the REST API, Twilio makes a synchronous HTTP request to the URL found in the value of the 'Url' POST parameter, in order to retrieve TwiML for handling the call. This request is identical to the request Twilio sends when receiving a phone call to one of your Twilio numbers. As part of this request, you'll see a CallSid returned as part of the list of parameters, this is the unique identifier you'll use when you POST the API to modify the call.

You can also set the StatusCallbackEvent and StatusCallback parameter in your request to initiate a call via the API. For every call progress event specified in the ‘StatusCallbackEvent’ parameter, Twilio will make an asynchronous webhook to the ‘StatusCallback’ which includes the CallSid in the list of returned parameters.

<Dial><Number>

You can set the StatusCallbackEvent and StatusCallback parameter as part of the <Number> noun in your TwiML. For every call progress event specified in the ‘StatusCallbackEvent’ parameter, Twilio will make an asynchronous webhook to the ‘StatusCallback’ which includes the CallSid for the <Dial> leg as well as the ParentCallSid in the list of returned parameters.

<Dial><Sip>

You can set the StatusCallbackEvent and StatusCallback parameter as part of the <Sip> noun in your TwiML. For every call progress event specified in the ‘StatusCallbackEvent’ parameter, Twilio will make an asynchronous webhook to the ‘StatusCallback’ which includes the CallSid for the <Dial> leg as well as the ParentCallSid in the list of returned parameters.

<Dial><Client>

You can set the StatusCallbackEvent and StatusCallback parameter as part of the <Client> noun in your TwiML. For every call progress event specified in the ‘StatusCallbackEvent’ parameter, Twilio will make an asynchronous webhook to the ‘StatusCallback’ which includes the CallSid for the <Dial> leg as well as the ParentCallSid in the list of returned parameters.

Have more questions? Submit a request
Powered by Zendesk