Esempio n. 1
0
 public bool CheckIfAvailable(string ip)
 {
     log.Debug("Checking if codec at " + ip + " is reachable");
     try
     {
         using (var client = new UmacClient(ip, Sdk.Umac.ExternalProtocolIpCommandsPort))
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Esempio n. 2
0
        public LineStatus GetLineStatus(string ip, int line)
        {
            log.Debug("Getting line status from Umac codec at {0}", ip);

            try
            {
                using (var client = new UmacClient(ip, Sdk.Umac.ExternalProtocolIpCommandsPort))
                {
                    var lineStatus = client.GetLineStatus();
                    return(lineStatus);
                }
            }
            catch (Exception ex)
            {
                return(new LineStatus
                {
                    StatusCode = LineStatusCode.ErrorGettingStatus,
                    DisconnectReason = DisconnectReason.None
                });
            }
        }
Esempio n. 3
0
        public bool HangUp(string hostAddress, Codec codec)
        {
            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(lineStatus);
                }
            }
            catch (Exception ex)
            {
                log.Warn("", ex);
                return(false);
            }
        }
Esempio n. 4
0
        public bool Call(string hostAddress, Call call)
        {
            log.Debug("Call from Umac codec at {0}", hostAddress);

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

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