コード例 #1
0
        public async Task <ActionResult <bool> > Hangup([FromBody] HangupRequest request)
        {
            if (request == null)
            {
                return(BadRequest());
            }

            log.Info($"Request to Hangup. SipAddress={request.SipAddress} DeviceEncoder={request.DeviceEncoder}");

            string hangUpWithDeviceEncoder = string.IsNullOrEmpty(request.DeviceEncoder) ? "Program" : request.DeviceEncoder;

            var caller = new SipUri(request.SipAddress).UserAtHost;

            return(await Execute(caller, async (codecApi, codecInformation) => await codecApi.HangUpAsync(codecInformation.Ip, hangUpWithDeviceEncoder)));
        }
コード例 #2
0
        public void ToDictionary_Works()
        {
            var dict = new HangupRequest().ToDictionary();

            Assert.Equal("Hangup", Assert.Contains("Command", dict).ToObject());
        }