Exemple #1
0
        /// <summary>
        /// Handler to receive new configuration
        /// Avoid to re-create account if its data haven't changed
        /// </summary>
        /// <param name="sender"></param>
        private void OnConfigChanged(object sender)
        {
            string idEquipo;
            string newProxy = Top.Cfg.GetProxyIp(out idEquipo);
            List <AccountDataSip> NewAccDataList = new List <AccountDataSip>();

            foreach (StrNumeroAbonado num in Top.Cfg.HostAddresses)
            {
                if (num.Prefijo == Cd40Cfg.ATS_DST)
                {
                    NewAccDataList.Add(new AccountDataSip(num));
                }
            }

            if (_ProxyIP != newProxy)
            {
                // If proxy has changed all accounts are created again
                SipAgent.DestroyAccounts();
                AccDataList = new List <AccountDataSip>(NewAccDataList);
                _ProxyIP    = newProxy;
                foreach (AccountDataSip data in AccDataList)
                {
                    if ((_ProxyIP == null) || (_ProxyIP.Length == 0))
                    {
                        SipAgent.CreateAccount(data.NumeroAbonado);
                    }
                    else
                    {
                        SipAgent.CreateAccountAndRegisterInProxy(data.NumeroAbonado, _ProxyIP, Settings.Default.ExpireInProxy, data.NumeroAbonado, data.NumeroAbonado, data.IdAgrupacion);
                    }
                }
            }
            else
            {
                SynchronizeAccountsList(NewAccDataList);
            }


            // JCAM. 20170324
            // Incorporar las direcciones de los grabadores en la configuración
            // y hacer que el módulo de grabación se entere del cambio de configuración
            AsignacionUsuariosTV tv = Top.Cfg.GetUserTv(Top.Cfg.MainId);

            if (tv != null)
            {
                SipAgent.PictRecordingCfg(tv.IpGrabador1, tv.IpGrabador2, tv.RtspPort);
            }
        }
        private static void ConfiguraUsuario()
        {
            // Sector
            DireccionamientoIP i = new DireccionamientoIP();

            i.IdHost      = "PICT04";
            i.IpRed1      = "192.168.2.204";
            i.TipoHost    = Tipo_Elemento_HW.TEH_TOP;
            i.Interno     = false;
            i.Max         = 0;
            i.Min         = 0;
            i.EsCentralIP = false;
            cfg.ConfiguracionGeneral.PlanDireccionamientoIP.Add(i);

            //Recurso interno Usuario
            AsignacionUsuariosTV a = new AsignacionUsuariosTV();

            a.IdUsuario = "S4_SCV2";
            a.IdHost    = "PICT04";
            cfg.ConfiguracionGeneral.PlanAsignacionUsuarios.Add(a);
        }