Esempio n. 1
0
        public async Task <bool> CallAsync(string hostAddress, string callee, string profileName, string deviceEncoder = "Program")
        {
            // TODO: first check codec call status. Do not execute the call method if the codec is already in a call.
            // Some codecs will hangup the current call and dial up the new call without hesitation.

            // If the device have multiple encoders to call with
            var          deviceLineEncoder   = string.IsNullOrEmpty(deviceEncoder) || deviceEncoder == "null" ? "Program" : deviceEncoder;
            IkusNetCodec callSelectedEncoder = IkusNetCodec.Program;

            try
            {
                callSelectedEncoder = (IkusNetCodec)Enum.Parse(typeof(IkusNetCodec), deviceLineEncoder, true);
            }
            catch (Exception)
            {
                callSelectedEncoder = IkusNetCodec.Program;
            }

            var cmd = new CommandIkusNetCall
            {
                Address     = callee,
                Profile     = profileName,
                CallContent = IkusNetCallContent.Audio,
                CallType    = IkusNetIPCallType.UnicastBidirectional,
                Codec       = callSelectedEncoder,
            };

            return(await SendConfigurationCommandAsync(hostAddress, cmd));
        }
Esempio n. 2
0
        public async Task <bool> HangUpAsync(string hostAddress, string deviceEncoder = "Program")
        {
            // If the device have multiple encoders to hang up
            var          deviceLineEncoder     = string.IsNullOrEmpty(deviceEncoder) || deviceEncoder == "null" ? "Program" : deviceEncoder;
            IkusNetCodec hangupSelectedEncoder = IkusNetCodec.Program;

            try
            {
                hangupSelectedEncoder = (IkusNetCodec)Enum.Parse(typeof(IkusNetCodec), deviceLineEncoder, true);
            }
            catch (Exception)
            {
                hangupSelectedEncoder = IkusNetCodec.Program;
            }

            var cmd = new CommandIkusNetHangUp {
                Codec = hangupSelectedEncoder
            };

            return(await SendConfigurationCommandAsync(hostAddress, cmd));
        }