예제 #1
0
 public Task <bool> CheckIfAvailableAsync(string hostAddress)
 {
     log.Debug("Checking if codec at " + hostAddress + " is reachable");
     try
     {
         using (var client = new UmacClient(hostAddress, Sdk.Umac.ExternalProtocolIpCommandsPort))
         {
             return(Task.FromResult(true));
         }
     }
     catch (Exception)
     {
         return(Task.FromResult(false));
     }
 }
예제 #2
0
 public Task <LineStatus> GetLineStatusAsync(string hostAddress, string lineEncoder = "ProgramL1")
 {
     log.Debug("Getting line status from Umac codec at {0}", hostAddress);
     try
     {
         using (var client = new UmacClient(hostAddress, Sdk.Umac.ExternalProtocolIpCommandsPort))
         {
             var lineStatus = client.GetLineStatus();
             return(Task.FromResult(lineStatus));
         }
     }
     catch (Exception)
     {
         return(Task.FromResult(new LineStatus
         {
             StatusCode = LineStatusCode.Unknown,
             DisconnectReason = DisconnectReason.None
         }));
     }
 }
예제 #3
0
        public Task <bool> HangUpAsync(string hostAddress, string deviceEncoder = "Program")
        {
            log.Debug("Hanging up Umac codec at {0}", hostAddress);

            /* Example dialog:
             *          admin> hangup
             *          admin> not streaming
             *          CALL_STATE disconnected [tx: idle, rx: idle]
             */

            try
            {
                using (var client = new UmacClient(hostAddress, Sdk.Umac.ExternalProtocolIpCommandsPort))
                {
                    var lineStatus = client.HangUp();
                    return(Task.FromResult(lineStatus));
                }
            }
            catch (Exception ex)
            {
                log.Warn(ex);
                return(Task.FromResult(false));
            }
        }
예제 #4
0
        public Task <bool> CallAsync(string hostAddress, string callee, string profileName, string deviceEncoder = "Program")
        {
            log.Debug("Call from Umac codec at {0}", hostAddress);

            if (profileName != "Telefon")
            {
                // We can't deal with anything but the phone profile for now
                return(Task.FromResult(false));
            }

            try
            {
                using (var client = new UmacClient(hostAddress, Sdk.Umac.ExternalProtocolIpCommandsPort))
                {
                    var lineStatus = client.Call(callee, profileName);
                    return(Task.FromResult(lineStatus));
                }
            }
            catch (Exception ex)
            {
                log.Warn(ex);
                return(Task.FromResult(false));
            }
        }