Exemplo n.º 1
0
 private IEnumerable <ValidationResult> ValidateRegistrarServer(VoiceProfileViewModel viewModel)
 {
     if (string.IsNullOrEmpty(viewModel.RegistrarServer))
     {
         yield return(new ValidationResult("RegistrarServer", "Should be specified"));
     }
 }
Exemplo n.º 2
0
 private IEnumerable <ValidationResult> ValidateUserAgentDomain(VoiceProfileViewModel viewModel)
 {
     if (string.IsNullOrEmpty(viewModel.UserAgentDomain))
     {
         yield return(new ValidationResult("UserAgentDomain", "Should be specified"));
     }
 }
Exemplo n.º 3
0
 private IEnumerable <ValidationResult> ValidateOutboundProxy(VoiceProfileViewModel viewModel)
 {
     if (string.IsNullOrEmpty(viewModel.OutboundProxy))
     {
         yield return(new ValidationResult("OutboundProxy", "Should be specified"));
     }
 }
Exemplo n.º 4
0
 private IEnumerable <ValidationResult> ValidateDigitMap(VoiceProfileViewModel viewModel)
 {
     if (viewModel.DigitMapEnable && string.IsNullOrWhiteSpace(viewModel.DigitMap))
     {
         yield return(new ValidationResult("DigitMap", "Should be specified"));
     }
 }
Exemplo n.º 5
0
        private VoiceProfileViewModel GetViewProfileModel()
        {
            var line1Model = this.GetLine1Model();

            var line2Model = this.GetLine2Model();

            var voiceProfileModel = new VoiceProfileViewModel
            {
                IpAddress          = this.txtIpAddress.Text,
                UserName           = this.txtUserName.Text,
                Password           = this.txtPassword.Text,
                PingEnabled        = this.appSettings.PingEnabled,
                DigitMapEnable     = this.cbDigitMapEnable.Checked,
                DigitMap           = this.txtDigitMap.Text,
                UserAgentDomain    = this.txtUserAgentDomain.Text,
                ProxyServer        = this.txtProxyServer.Text,
                RegistrarServer    = this.txtRegistrarServer.Text,
                OutboundProxy      = this.txtOutboundProxy.Text,
                RegistrationPeriod = this.txtRegistrationPeriod.Text,
                Lines =
                    new List <LineViewModel>(new[] { line1Model, line2Model })
            };

            return(voiceProfileModel);
        }
Exemplo n.º 6
0
 private void SendVoiceProfileModelHeader(VoiceProfileViewModel model)
 {
     this.WriteMessage("enable");
     this.WriteMessage("/system/tr069");
     this.WriteMessage("add InternetGatewayDevice.Services.VoiceService");
     this.WriteMessage("add InternetGatewayDevice.Services.VoiceService.1.VoiceProfile");
     this.WriteLog();
 }
Exemplo n.º 7
0
        private void WriteRegistrationPeriod(VoiceProfileViewModel model)
        {
            var message = string.Join(
                " ",
                "set InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.RegistrationPeriod",
                model.RegistrationPeriod);

            this.WriteMessage(message);
        }
Exemplo n.º 8
0
        private void WriteOutboundProxy(VoiceProfileViewModel model)
        {
            var message = string.Join(
                " ",
                "set InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.OutboundProxy",
                model.OutboundProxy);

            this.WriteMessage(message);
        }
Exemplo n.º 9
0
        private void WriteProxyServer(VoiceProfileViewModel model)
        {
            var message = string.Join(
                " ",
                "set InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.ProxyServer",
                model.ProxyServer);

            this.WriteMessage(message);
        }
Exemplo n.º 10
0
        private void WriteUserAgentDomain(VoiceProfileViewModel model)
        {
            var message = string.Join(
                " ",
                "set InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.UserAgentDomain",
                model.UserAgentDomain);

            this.WriteMessage(message);
        }
Exemplo n.º 11
0
 private void SendVoiceProfileModelBody(VoiceProfileViewModel model)
 {
     this.WriteDigitMapEnabled(model);
     this.WriteUserAgentDomain(model);
     this.WriteProxyServer(model);
     this.WriteRegistrarServer(model);
     this.WriteOutboundProxy(model);
     this.WriteRegistrationPeriod(model);
     this.WriteLog();
 }
Exemplo n.º 12
0
 private void SendVoiceProfileModelLines(VoiceProfileViewModel model)
 {
     for (int i = 0; i < model.Lines.Count; i++)
     {
         var index = i + 1;
         var line  = model.Lines[i];
         this.SendVoiceProfileModelLine(line, index);
         this.WriteLog();
     }
 }
        private void InitializeKeepAliveService(VoiceProfileViewModel viewModel)
        {
            var settings = new FormAppSettings
            {
                Host        = viewModel.IpAddress,
                PingEnabled = viewModel.PingEnabled,
            };

            this.pingService = new PingService(settings, this.progressCallback);
        }
        public void Submit(VoiceProfileViewModel viewModel, IProgressCallback progressCallback)
        {
            this.progressCallback = progressCallback;
            this.progressCallback.SetText("Initialize");
            this.InitializeKeepAliveService(viewModel);
            this.InitializeTerminalClient(viewModel);

            this.pingService.Send();
            this.telnet.Send(viewModel);
        }
Exemplo n.º 15
0
        public IEnumerable <ValidationResult> Validate(VoiceProfileViewModel viewModel)
        {
            var result = new List <ValidationResult>();

            result.AddRange(this.ValidateDigitMap(viewModel));
            result.AddRange(this.ValidateUserAgentDomain(viewModel));
            result.AddRange(this.ValidateProxyServer(viewModel));
            result.AddRange(this.ValidateRegistrarServer(viewModel));
            result.AddRange(this.ValidateOutboundProxy(viewModel));
            result.AddRange(this.ValidateRegistrationPeriod(viewModel));

            return(result);
        }
Exemplo n.º 16
0
        private IEnumerable <ValidationResult> ValidateRegistrationPeriod(VoiceProfileViewModel viewModel)
        {
            if (string.IsNullOrEmpty(viewModel.RegistrationPeriod))
            {
                yield return(new ValidationResult("RegistrationPeriod", "Should be specified"));
            }

            uint value;

            if (!uint.TryParse(viewModel.RegistrationPeriod, out value))
            {
                yield return(new ValidationResult("RegistrationPeriod", "Should be specified as unsigned int"));
            }
        }
        private void InitializeTerminalClient(VoiceProfileViewModel viewModel)
        {
            var settings = new FormAppSettings
            {
                Host                = viewModel.IpAddress,
                UserName            = viewModel.UserName,
                Password            = viewModel.Password,
                Port                = this.appSettings.Port,
                TimeoutSeconds      = this.appSettings.TimeoutSeconds,
                VirtualScreenHeight = this.appSettings.VirtualScreenHeight,
                VirtualScreenWidth  = this.appSettings.VirtualScreenWidth
            };

            this.telnet = new Telnet(settings, this.progressCallback);
        }
Exemplo n.º 18
0
        private void WriteDigitMapEnabled(VoiceProfileViewModel model)
        {
            if (!model.DigitMapEnable)
            {
                return;
            }

            this.WriteMessage("set InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.DigitMapEnable Enabled");

            var message = string.Join(
                " ",
                "set InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.DigitMap",
                model.DigitMap);

            this.WriteMessage(message);
        }
Exemplo n.º 19
0
        public void Send(VoiceProfileViewModel model)
        {
            this.progressCallback.SetRange(0, 24);
            using (this.terminal = new Terminal(
                       this.appSettings.Host,
                       this.appSettings.Port,
                       this.appSettings.TimeoutSeconds,
                       this.appSettings.VirtualScreenHeight,
                       this.appSettings.VirtualScreenWidth))
            {
                this.Connect();

                this.Login();

                this.SendVoiceProfileModel(model);
                this.SendVoiceProfileModelLines(model);
                this.SendShowConfigurationStatus(model);
            }
        }
Exemplo n.º 20
0
 private void SendVoiceProfileModelFooter(VoiceProfileViewModel model)
 {
     this.WriteMessage("set InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.Enable Enabled");
     this.WriteLog();
 }
Exemplo n.º 21
0
 private void SendShowConfigurationStatus(VoiceProfileViewModel model)
 {
     this.WriteMessage("/t/v");
     this.WriteMessage("show ua reg 0");
     this.WriteLog();
 }
Exemplo n.º 22
0
 private void SendVoiceProfileModel(VoiceProfileViewModel model)
 {
     this.SendVoiceProfileModelHeader(model);
     this.SendVoiceProfileModelBody(model);
     this.SendVoiceProfileModelFooter(model);
 }