/// <summary> /// Hangs up a call in progress. Makes a POST request to a Call Instance resource. /// </summary> /// <param name="callSid">The Sid of the call to hang up.</param> /// <param name="style">'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.</param> 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); }
/// <summary> /// Hangs up a call in progress. /// </summary> /// <param name="callSid">The Sid of the call to hang up.</param> /// <param name="style">'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.</param> /// <param name="callback">Method to call upon successful completion</param> public virtual void HangupCall(string callSid, HangupStyle style, Action<Call> callback) { 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()); ExecuteAsync<Call>(request, (response) => callback(response)); }
/// <summary> /// Hangs up a call in progress. Makes a POST request to a Call Instance resource. /// </summary> /// <param name="callSid">The Sid of the call to hang up.</param> /// <param name="style">'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.</param> 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)); }
/// <summary> /// Hangs up a call in progress. /// </summary> /// <param name="callSid">The Sid of the call to hang up.</param> /// <param name="style">'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.</param> /// <param name="callback">Method to call upon successful completion</param> public void HangupCall(string callSid, HangupStyle style, Action <Call> callback) { 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()); ExecuteAsync <Call>(request, (response) => callback(response)); }
private async Task <Call> HangupCallAsyncInternal(string callSid, HangupStyle style) { Require.Argument("CallSid", callSid); var request = new RestRequest(); request.Method = Method.POST; request.Resource = "Accounts/{AccountSid}/Calls/{CallSid}.json"; request.AddUrlSegment("CallSid", callSid); request.AddParameter("Status", style.ToString().ToLower()); var result = await ExecuteAsync(request, typeof(Call)); return((Call)result); }
private async Task<Call> HangupCallAsyncInternal(string callSid, HangupStyle style) { Require.Argument("CallSid", callSid); var request = new RestRequest(); request.Method = Method.POST; request.Resource = "Accounts/{AccountSid}/Calls/{CallSid}.json"; request.AddUrlSegment("CallSid", callSid); request.AddParameter("Status", style.ToString().ToLower()); var result = await ExecuteAsync(request, typeof(Call)); return (Call)result; }