Twilio.TwilioRestClient.HangupCall C# (CSharp) Method

HangupCall() public method

Hangs up a call in progress. Makes a POST request to a Call Instance resource.
public HangupCall ( string callSid, HangupStyle style ) : Call
callSid string The Sid of the call to hang up.
style HangupStyle 'Canceled' will attempt to hangup calls that are queued or ringing but not affect calls already in progress. 'Completed' will attempt to hang up a call even if it's already in progress.
return Call
        public virtual Call HangupCall(string callSid, HangupStyle style)
        {
            Require.Argument("CallSid", callSid);

            var request = new RestRequest(Method.POST);
            request.Resource = "Accounts/{AccountSid}/Calls/{CallSid}.json";

            request.AddUrlSegment("CallSid", callSid);
            request.AddParameter("Status", style.ToString().ToLower());

            return Execute<Call>(request);
        }

Same methods

TwilioRestClient::HangupCall ( string callSid, HangupStyle style, Action callback ) : void

Usage Example

    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/user/account
        string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        string AuthToken = "your_auth_token";
        var twilio = new TwilioRestClient(AccountSid, AuthToken);

        twilio.HangupCall("CAe1644a7eed5088b159577c5802d8be38", HangupStyle.Completed);
    }