internal static void SetSettingValue(SipProfileSettingTypes type, string value, SipProfile profile)
        {
            Connection conn = ConnectionPoolManager.GetConnection(typeof(SipProfileSetting));

            if (GetSettingValue(type, profile) != null)
            {
                Dictionary <string, object> fields = new Dictionary <string, object>();
                fields.Add("Value", value);
                conn.Update(typeof(SipProfileSetting),
                            fields,
                            new SelectParameter[] {
                    new EqualParameter("Profile", profile),
                    new EqualParameter("SettingType", type)
                });
            }
            else
            {
                SipProfileSetting sps = new SipProfileSetting();
                sps.Profile     = profile;
                sps.SettingType = type;
                sps.Value       = value;
                conn.Save(sps);
            }
            conn.CloseConnection();
        }
Beispiel #2
0
        public static List <PhoneBookEntry> GetPagedList(string firstName, string lastName, string number, string organization, string type, ulong startIndex, ulong pageSize, out int totalPages)
        {
            List <PhoneBookEntry>  ret  = new List <PhoneBookEntry>();
            Connection             conn = ConnectionPoolManager.GetConnection(typeof(PhoneBookEntry));
            List <SelectParameter> pars = new List <SelectParameter>();

            if (firstName != null)
            {
                pars.Add(new LikeParameter("FirstName", firstName));
            }
            if (lastName != null)
            {
                pars.Add(new LikeParameter("LastName", lastName));
            }
            if (number != null)
            {
                pars.Add(new LikeParameter("Number", number));
            }
            if (organization != null)
            {
                pars.Add(new LikeParameter("Organization", organization));
            }
            if (type != null)
            {
                pars.Add(new EqualParameter("Type", (PhoneBookEntryType)Enum.Parse(typeof(PhoneBookEntryType), type)));
            }
            totalPages = (int)Math.Ceiling((decimal)conn.SelectCount(typeof(PhoneBookEntry), pars.ToArray()) / (decimal)pageSize);
            foreach (PhoneBookEntry pbe in conn.SelectPaged(typeof(PhoneBookEntry), pars.ToArray(), startIndex, pageSize))
            {
                ret.Add(pbe);
            }
            conn.CloseConnection();
            return(ret);
        }
Beispiel #3
0
        public static new Extension Load(string number)
        {
            Extension  ret  = null;
            Connection conn = ConnectionPoolManager.GetConnection(typeof(Extension));
            List <Org.Reddragonit.Dbpro.Structure.Table> tmp = null;

            if (number.Contains("@"))
            {
                tmp = conn.Select(typeof(Extension),
                                  new SelectParameter[] { new EqualParameter("Number", number.Substring(0, number.IndexOf('@'))),
                                                          new EqualParameter("Domain.Name", number.Substring(number.IndexOf('@') + 1)) });
            }
            else
            {
                tmp = conn.Select(typeof(Extension),
                                  new SelectParameter[] { new EqualParameter("Number", number),
                                                          new EqualParameter("Context", Context.Current) });
            }
            if (tmp.Count > 0)
            {
                ret = (Extension)tmp[0];
            }
            conn.CloseConnection();
            return(ret);
        }
Beispiel #4
0
        public NspiRpcClientConnection GetNspiRpcClientConnection()
        {
            string text = base.ServerSettings.PreferredGlobalCatalog(base.SessionSettings.GetAccountOrResourceForestFqdn());
            string domainController;

            if (!string.IsNullOrEmpty(text))
            {
                domainController = text;
            }
            else
            {
                PooledLdapConnection pooledLdapConnection = null;
                try
                {
                    pooledLdapConnection = ConnectionPoolManager.GetConnection(ConnectionType.GlobalCatalog, base.SessionSettings.GetAccountOrResourceForestFqdn());
                    domainController     = pooledLdapConnection.ServerName;
                }
                finally
                {
                    if (pooledLdapConnection != null)
                    {
                        pooledLdapConnection.ReturnToPool();
                    }
                }
            }
            return(NspiRpcClientConnection.GetNspiRpcClientConnection(domainController));
        }
        public static DirectLine Load(string dialedNumber)
        {
            List <SelectParameter> pars = new List <SelectParameter>();

            if (dialedNumber.Contains("@"))
            {
                pars.Add(new EqualParameter("DialedContext.Name", dialedNumber.Substring(dialedNumber.LastIndexOf('@') + 1)));
                pars.Add(new EqualParameter("DialedNumber", dialedNumber.Substring(0, dialedNumber.LastIndexOf('@'))));
            }
            else
            {
                pars.Add(new EqualParameter("DialedContext", Context.Current));
                pars.Add(new EqualParameter("DialedNumber", dialedNumber));
            }

            DirectLine ret  = null;
            Connection conn = ConnectionPoolManager.GetConnection(typeof(DirectLine));
            List <Org.Reddragonit.Dbpro.Structure.Table> tmp = conn.Select(typeof(DirectLine), pars.ToArray());

            conn.CloseConnection();
            if (tmp.Count > 0)
            {
                ret = (DirectLine)tmp[0];
            }
            return(ret);
        }
Beispiel #6
0
        public static ExtensionNumber Load(string number)
        {
            ExtensionNumber        ret  = null;
            List <SelectParameter> pars = new List <SelectParameter>();

            if (number.Contains("@"))
            {
                pars.Add(new EqualParameter("Number", number.Substring(0, number.LastIndexOf('@'))));
                pars.Add(new EqualParameter("Context.Name", number.Substring(number.LastIndexOf('@') + 1)));
            }
            else
            {
                pars.Add(new EqualParameter("Number", number));
                pars.Add(new EqualParameter("Context.Name", Context.Current.Name));
            }
            Connection conn = ConnectionPoolManager.GetConnection(typeof(ExtensionNumber));
            List <Org.Reddragonit.Dbpro.Structure.Table> tmp = conn.Select(typeof(ExtensionNumber), pars.ToArray());

            if (tmp.Count > 0)
            {
                ret = (ExtensionNumber)tmp[0];
            }
            conn.CloseConnection();
            return(ret);
        }
Beispiel #7
0
        internal static CDR Create(string domainName, string callerIDName, string callerIDNumber, string DestinationNumber,
                                   DateTime callStart, DateTime?answerTime, DateTime endTime, long duration, long billableSecs,
                                   Context context, string uniqueID, string coreUUID, string hangupCause, Extension internalExtension, string pin)
        {
            CDR ret = new CDR();

            ret.OwningDomain      = Domain.Load(domainName);
            ret.CallerIDName      = callerIDName;
            ret.CallerIDNumber    = callerIDNumber;
            ret.DestinationNumber = DestinationNumber;
            ret.CallStart         = callStart;
            ret.CallAnswerTime    = answerTime;
            ret.CallEndTime       = endTime;
            ret.Duration          = duration;
            ret.BillableDuration  = billableSecs;
            ret.CallContext       = context;
            ret.UniqueID          = uniqueID;
            ret.CoreUUID          = coreUUID;
            ret.InternalExtension = internalExtension;
            ret.HangupCause       = hangupCause;
            ret.Pin = pin;
            Connection conn = ConnectionPoolManager.GetConnection(typeof(CDR));

            ret = (CDR)conn.Save(ret);
            conn.Commit();
            conn.CloseConnection();
            return(ret);
        }
        // Token: 0x06000595 RID: 1429 RVA: 0x0001EE98 File Offset: 0x0001D098
        internal static ADServerInfo GetServerInfoFromFqdn(string fqdn, ConnectionType connectionType)
        {
            PooledLdapConnection pooledLdapConnection = null;
            string       empty = string.Empty;
            ADServerInfo adserverInfo;

            try
            {
                string partitionFqdn = Globals.IsMicrosoftHostedOnly ? ADServerSettings.GetPartitionFqdnFromADServerFqdn(fqdn) : TopologyProvider.LocalForestFqdn;
                pooledLdapConnection = ConnectionPoolManager.GetConnection(connectionType, partitionFqdn, null, fqdn, (connectionType == ConnectionType.GlobalCatalog) ? TopologyProvider.GetInstance().DefaultGCPort : TopologyProvider.GetInstance().DefaultDCPort);
                string writableNC = pooledLdapConnection.ADServerInfo.WritableNC;
                if (!pooledLdapConnection.SessionOptions.HostName.Equals(fqdn, StringComparison.OrdinalIgnoreCase))
                {
                    throw new ADOperationException(DirectoryStrings.ErrorInvalidServerFqdn(fqdn, pooledLdapConnection.SessionOptions.HostName));
                }
                adserverInfo = pooledLdapConnection.ADServerInfo;
            }
            finally
            {
                if (pooledLdapConnection != null)
                {
                    pooledLdapConnection.ReturnToPool();
                }
            }
            return(adserverInfo);
        }
Beispiel #9
0
        public static bool ExtensionExists(string number)
        {
            Connection conn = ConnectionPoolManager.GetConnection(typeof(ExtensionNumber));
            bool       ret  = conn.SelectCount(typeof(ExtensionNumber), new SelectParameter[] { new EqualParameter("Number", number), new EqualParameter("Context", Context.Current) }) > 0;

            conn.CloseConnection();
            return(ret);
        }
Beispiel #10
0
        public static List <CDR> SearchCDRs(string extension,
                                            string callerID,
                                            string destination,
                                            string callerName,
                                            DateTime?startDate,
                                            DateTime?endDate,
                                            long startIndex,
                                            int pageSize,
                                            out int totalPages)
        {
            totalPages = 0;
            if (User.Current == null)
            {
                return(null);
            }
            if (!User.Current.HasRight(Constants.CDR_RIGHT))
            {
                return(null);
            }
            List <CDR>             ret  = new List <CDR>();
            List <SelectParameter> pars = new List <SelectParameter>();

            if ((extension != null) && (extension.Length > 0))
            {
                pars.Add(new EqualParameter("InternalExtension", Extension.Load(extension, Domain.Current)));
            }
            if ((callerID != null) && (callerID.Length > 0))
            {
                pars.Add(new EqualParameter("CallerIDNumber", callerID));
            }
            if ((callerName != null) && (callerName.Length > 0))
            {
                pars.Add(new EqualParameter("CallerIDName", callerName));
            }
            if ((destination != null) && (destination.Length > 0))
            {
                pars.Add(new EqualParameter("DestinationNumber", destination));
            }
            if (startDate.HasValue)
            {
                pars.Add(new GreaterThanEqualToParameter("CallStart", startDate.Value));
            }
            if (endDate.HasValue)
            {
                pars.Add(new LessThanEqualToParameter("CallStart", endDate.Value));
            }
            pars.Add(new EqualParameter("OwningDomain", Domain.Current));
            Connection conn = ConnectionPoolManager.GetConnection(typeof(CDR));

            totalPages = (int)Math.Ceiling((decimal)conn.SelectCount(typeof(CDR), pars.ToArray()) / (decimal)pageSize);
            foreach (CDR c in conn.SelectPaged(typeof(CDR), pars.ToArray(), (ulong)startIndex, (ulong)pageSize))
            {
                ret.Add(c);
            }
            conn.CloseConnection();
            return(ret);
        }
        public static new List <OutgoingSIPTrunk> LoadAll()
        {
            List <OutgoingSIPTrunk> ret = new List <OutgoingSIPTrunk>();
            Connection conn             = ConnectionPoolManager.GetConnection(typeof(OutgoingSIPTrunk));

            foreach (OutgoingSIPTrunk ost in conn.SelectAll(typeof(OutgoingSIPTrunk)))
            {
                ret.Add(ost);
            }
            conn.CloseConnection();
            return(ret);
        }
        public static List <FreeSwitchModuleFile> LoadAll()
        {
            List <FreeSwitchModuleFile> ret = new List <FreeSwitchModuleFile>();
            Connection conn = ConnectionPoolManager.GetConnection(typeof(FreeSwitchModuleFile));

            foreach (FreeSwitchModuleFile fsmf in conn.SelectAll(typeof(FreeSwitchModuleFile)))
            {
                ret.Add(fsmf);
            }
            conn.CloseConnection();
            return(ret);
        }
Beispiel #13
0
        public static List <Gateway> LoadAll()
        {
            List <Gateway> ret  = new List <Gateway>();
            Connection     conn = ConnectionPoolManager.GetConnection(typeof(Gateway));

            foreach (Gateway gt in conn.SelectAll(typeof(Gateway)))
            {
                ret.Add(gt);
            }
            conn.CloseConnection();
            return(ret);
        }
Beispiel #14
0
        public static List <Context> LoadAll()
        {
            List <Context> ret  = new List <Context>();
            Connection     conn = ConnectionPoolManager.GetConnection(typeof(Context));

            foreach (Context con in conn.SelectAll(typeof(Context)))
            {
                ret.Add(con);
            }
            conn.CloseConnection();
            return(ret);
        }
Beispiel #15
0
        public static List <DirectLine> LoadAll()
        {
            List <DirectLine> ret  = new List <DirectLine>();
            Connection        conn = ConnectionPoolManager.GetConnection(typeof(DirectLine));

            foreach (DirectLine dl in  conn.Select(typeof(DirectLine), new SelectParameter[] { new EqualParameter("DialedContext", Context.Current) }))
            {
                ret.Add(dl);
            }
            conn.CloseConnection();
            return(ret);
        }
Beispiel #16
0
        public static List <PhoneBook> LoadAll()
        {
            List <PhoneBook> ret  = new List <PhoneBook>();
            Connection       conn = ConnectionPoolManager.GetConnection(typeof(PhoneBook));

            foreach (PhoneBook pb in conn.SelectAll(typeof(PhoneBook)))
            {
                ret.Add(pb);
            }
            conn.CloseConnection();
            return(ret);
        }
Beispiel #17
0
        public static List <SipProfile> LoadAll()
        {
            List <SipProfile> ret  = new List <SipProfile>();
            Connection        conn = ConnectionPoolManager.GetConnection(typeof(SipProfile));

            foreach (SipProfile con in conn.SelectAll(typeof(SipProfile)))
            {
                ret.Add(con);
            }
            conn.CloseConnection();
            return(ret);
        }
Beispiel #18
0
        public static List <PhoneBookEntry> LoadAll()
        {
            List <PhoneBookEntry> ret  = new List <PhoneBookEntry>();
            Connection            conn = ConnectionPoolManager.GetConnection(typeof(PhoneBookEntry));

            foreach (Org.Reddragonit.Dbpro.Structure.Table tbl in conn.SelectAll(typeof(PhoneBookEntry)))
            {
                ret.Add((PhoneBookEntry)tbl);
            }
            conn.CloseConnection();
            return(ret);
        }
Beispiel #19
0
        public static ExtensionNumber Load(string number, string context)
        {
            ExtensionNumber ret  = null;
            Connection      conn = ConnectionPoolManager.GetConnection(typeof(ExtensionNumber));
            List <Org.Reddragonit.Dbpro.Structure.Table> tmp = conn.Select(typeof(ExtensionNumber), new SelectParameter[] { new EqualParameter("Number", number), new EqualParameter("Context.Name", context) });

            if (tmp.Count > 0)
            {
                ret = (ExtensionNumber)tmp[0];
            }
            conn.CloseConnection();
            return(ret);
        }
Beispiel #20
0
        public static new List <Extension> LoadAll()
        {
            List <Extension> ret  = new List <Extension>();
            Connection       conn = ConnectionPoolManager.GetConnection(typeof(Extension));

            foreach (Extension ext in conn.Select(typeof(Extension),
                                                  new SelectParameter[] { new EqualParameter("Context", Context.Current) }))
            {
                ret.Add(ext);
            }
            conn.CloseConnection();
            return(ret);
        }
Beispiel #21
0
        public static List <TimedRoute> LoadAll()
        {
            List <TimedRoute> ret  = new List <TimedRoute>();
            Connection        conn = ConnectionPoolManager.GetConnection(typeof(TimedRoute));

            foreach (TimedRoute tr in conn.Select(typeof(TimedRoute),
                                                  new SelectParameter[] { new EqualParameter("RouteContext", Context.Current) }))
            {
                ret.Add(tr);
            }
            conn.CloseConnection();
            return(ret);
        }
        public new static List <VacationRoute> LoadAll()
        {
            List <VacationRoute> ret  = new List <VacationRoute>();
            Connection           conn = ConnectionPoolManager.GetConnection(typeof(VacationRoute));

            foreach (VacationRoute vr in conn.Select(typeof(VacationRoute),
                                                     new SelectParameter[] { new EqualParameter("Context", Context.LoadByName("Internal")) }))
            {
                ret.Add(vr);
            }
            conn.CloseConnection();
            return(ret);
        }
Beispiel #23
0
        public static new List <HuntGroup> LoadAll()
        {
            List <HuntGroup> ret  = new List <HuntGroup>();
            Connection       conn = ConnectionPoolManager.GetConnection(typeof(HuntGroup));

            foreach (HuntGroup ht in conn.Select(typeof(HuntGroup),
                                                 new SelectParameter[] { new EqualParameter("Context", Context.Current) }))
            {
                ret.Add(ht);
            }
            conn.CloseConnection();
            return(ret);
        }
Beispiel #24
0
        public static new List <Intercom> LoadAll()
        {
            List <Intercom> ret  = new List <Intercom>();
            Connection      conn = ConnectionPoolManager.GetConnection(typeof(Intercom));

            foreach (Intercom icom in  conn.Select(typeof(Intercom),
                                                   new SelectParameter[] { new EqualParameter("Context", Context.LoadByName("Internal")) }))
            {
                ret.Add(icom);
            }
            conn.CloseConnection();
            return(ret);
        }
Beispiel #25
0
        public static CDR Load(string id)
        {
            CDR        ret  = null;
            Connection conn = ConnectionPoolManager.GetConnection(typeof(CDR));
            List <Org.Reddragonit.Dbpro.Structure.Table> tmp = conn.Select(typeof(CDR),
                                                                           new SelectParameter[] { new EqualParameter("ID", id) });

            if (tmp.Count > 0)
            {
                ret = (CDR)tmp[0];
            }
            conn.CloseConnection();
            return(ret);
        }
        public static new OutgoingSIPTrunk Load(string name)
        {
            OutgoingSIPTrunk ret  = null;
            Connection       conn = ConnectionPoolManager.GetConnection(typeof(Gateway));
            List <Org.Reddragonit.Dbpro.Structure.Table> tmp = conn.Select(typeof(Gateway),
                                                                           new SelectParameter[] { new EqualParameter("Name", name) });

            if (tmp.Count > 0)
            {
                ret = (OutgoingSIPTrunk)tmp[0];
            }
            conn.CloseConnection();
            return(ret);
        }
Beispiel #27
0
        internal static User LoadByUsername(string username)
        {
            User       ret  = null;
            Connection conn = ConnectionPoolManager.GetConnection(typeof(User));
            List <Org.Reddragonit.Dbpro.Structure.Table> tmp = conn.Select(typeof(User),
                                                                           new SelectParameter[] { new EqualParameter("UserName", username) });

            if (tmp.Count > 0)
            {
                ret = (User)tmp[0];
            }
            conn.CloseConnection();
            return(ret);
        }
        public static List <GatewayRoute> LoadAll()
        {
            List <GatewayRoute> ret  = new List <GatewayRoute>();
            Connection          conn = ConnectionPoolManager.GetConnection(typeof(GatewayRoute));

            foreach (GatewayRoute gr in conn.Select(typeof(GatewayRoute),
                                                    new SelectParameter[] { new EqualParameter("RouteContext", Context.Current) },
                                                    new string[] { "Index" }))
            {
                ret.Add(gr);
            }
            conn.CloseConnection();
            return(ret);
        }
        public new static List <IncomingSIPTrunk> LoadAllAvailable()
        {
            List <IncomingSIPTrunk> ret = new List <IncomingSIPTrunk>();
            Connection conn             = ConnectionPoolManager.GetConnection(typeof(IncomingSIPTrunk));

            foreach (IncomingSIPTrunk ist in conn.Select(typeof(IncomingSIPTrunk),
                                                         new SelectParameter[] { new EqualParameter("Domain", Domain.Current),
                                                                                 new EqualParameter("Context", Context.Current) }))
            {
                ret.Add(ist);
            }
            conn.CloseConnection();
            return(ret);
        }
Beispiel #30
0
        public static SipProfile Load(string name)
        {
            SipProfile ret  = null;
            Connection conn = ConnectionPoolManager.GetConnection(typeof(SipProfile));
            List <Org.Reddragonit.Dbpro.Structure.Table> tmp = conn.Select(typeof(SipProfile),
                                                                           new SelectParameter[] { new EqualParameter("Name", name) });

            if (tmp.Count > 0)
            {
                ret = (SipProfile)tmp[0];
            }
            conn.CloseConnection();
            return(ret);
        }