Exemple #1
0
        /// <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);
        }
Exemple #2
0
        /// <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));
        }
Exemple #3
0
        /// <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));
        }
Exemple #4
0
        /// <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));
        }
Exemple #5
0
        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);
        }
Exemple #6
0
        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;
        }
Exemple #7
0
 /// <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 IAsyncOperation<Call> HangupCallAsync(string callSid, HangupStyle style)
 {
     return (IAsyncOperation<Call>)AsyncInfo.Run((System.Threading.CancellationToken ct) => HangupCallAsyncInternal(callSid, style));
 }
Exemple #8
0
 /// <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 IAsyncOperation <Call> HangupCallAsync(string callSid, HangupStyle style)
 {
     return((IAsyncOperation <Call>)AsyncInfo.Run((System.Threading.CancellationToken ct) => HangupCallAsyncInternal(callSid, style)));
 }