Beispiel #1
0
        /// <summary>
        /// To change the behavior of live calls, TelAPI provides the ability to interrupt calls in real time and end or redirect them to InboundXML for execution.
        /// </summary>
        /// <param name="callSid">An alphanumeric string used for identification of calls</param>
        /// <param name="url">The URL in-progress calls can be forwarded to.</param>
        /// <param name="httpMethod">Specifies the HTTP method used to request forwarding URL. Allowed Value: POST or GET. Default Value: POST</param>
        /// <param name="status">The status used to end the call. canceled only ends queued/ringing calls while completed ends in-progress calls as well as queued/ringing calls. Allowed Value: canceled or completed</param>
        /// <returns></returns>
        public async Task<Call> InterruptLiveCall(string callSid, string url, HttpMethod? httpMethod, HangupCallStatus? status)
        {
            Require.Argument("CallSid", callSid);

            var request = new RestRequest(System.Net.Http.HttpMethod.Post);
            request.Resource = RequestUri.InterruptLiveCallUri;
            request.AddUrlSegment(RequestUriParams.CallSid, callSid);
            
            if(url != null) request.AddParameter("Url", url);
            if(httpMethod != null) request.AddParameter("Method", httpMethod.ToString().ToLower());
            if(status != null) request.AddParameter("Status", status.ToString().ToLower());

            return await Execute<Call>(request);
        }
Beispiel #2
0
        /// <summary>
        /// To change the behavior of live calls, TelAPI provides the ability to interrupt calls in real time and end or redirect them to InboundXML for execution.
        /// </summary>
        /// <param name="callSid">An alphanumeric string used for identification of calls</param>
        /// <param name="url">The URL in-progress calls can be forwarded to.</param>
        /// <param name="httpMethod">Specifies the HTTP method used to request forwarding URL. Allowed Value: POST or GET. Default Value: POST</param>
        /// <param name="status">The status used to end the call. canceled only ends queued/ringing calls while completed ends in-progress calls as well as queued/ringing calls. Allowed Value: canceled or completed</param>
        /// <returns></returns>
        public Call InterruptLiveCall(string callSid, string url, HttpMethod? httpMethod, HangupCallStatus? status)
        {
            Require.Argument("CallSid", callSid);
            
            var request = new RestRequest(Method.POST);
            request.Resource = RequestUri.InterruptLiveCallUri;
            request.AddUrlSegment(RequestUriParams.CallSid, callSid);
            
            if(url.HasValue()) request.AddParameter("Url", url);
            if(httpMethod.HasValue) request.AddParameter("Method", httpMethod.ToString().ToLower());
            if(status.HasValue) request.AddParameter("Status", status.ToString().ToLower());

            return Execute<Call>(request);
        }