Esempio n. 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);
        }
Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 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);
        }
Esempio n. 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;
        }