public void LoadData(WOSI.CallButler.Data.CallButlerDataset.ExtensionsDataTable extensions, CallButlerDataset.ExtensionsRow extension, CallButlerDataset.ExtensionContactNumbersDataTable extensionContactTable)
        {
            this.extensions = extensions;
            this.extension = extension;
            ExtensionContactTable = extensionContactTable;

            pnlFlow.Controls.Clear();

            // Create our voicemail shape
            VoicemailDiagramShape vds = new VoicemailDiagramShape();
            vds.Dock = DockStyle.Top;
            pnlFlow.Controls.Add(vds);

            WOSI.CallButler.Data.CallButlerDataset.ExtensionContactNumbersRow[] contactRows = (WOSI.CallButler.Data.CallButlerDataset.ExtensionContactNumbersRow[])ExtensionContactTable.Select("ExtensionID = '" + extension.ExtensionID + "'", "Priority ASC");

            foreach (WOSI.CallButler.Data.CallButlerDataset.ExtensionContactNumbersRow contactRow in contactRows)
            {
                AddContactControl(extensions, contactRow, false);
            }

            cbCallBlast.Checked = extension.UseCallBlast;

            UpdateCallBlast();
        }
        public void PersistVoicemail(CallButlerAuthInfo authInfo, CallButlerDataset.VoicemailsDataTable voicemail)
        {
            if (Authenticate(authInfo) && IsDataValid(authInfo, voicemail))
            {
                List<Guid> extensions = new List<Guid>();

                foreach (CallButlerDataset.VoicemailsRow vRow in voicemail)
                {
                    if (vRow.RowState != DataRowState.Deleted)
                    {
                        dataProvider.PersistVoicemail(vRow);
                        extensions.Add(vRow.ExtensionID);
                    }
                }

                // Send a message waiting notification to our PBX phone
                if (registrarService != null)
                {
                    foreach (Guid extensionID in extensions)
                    {
                        registrarService.SendMessageWaitingNotification(extensionID);
                    }
                }
            }
        }
        public void PersistVoicemailSound(CallButlerAuthInfo authInfo, Guid extensionID, CallButlerDataset.ExtensionsDataTable extensions, byte[] soundBytes)
        {
            if (Authenticate(authInfo))
            {
                CallButlerDataset.ExtensionsDataTable extensionTable = GetExtension(authInfo, extensionID);

                if (extensionTable.Rows.Count > 0)
                {
                    CallButlerDataset.ExtensionsRow extensionRow = (CallButlerDataset.ExtensionsRow)extensionTable.Rows[0];
                    string username = extensionRow.FirstName + " " + extensionRow.LastName;
                    string vmDirectory = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.VoicemailRootDirectory);

                    if (!Directory.Exists(vmDirectory))
                        Directory.CreateDirectory(vmDirectory);

                    string fmt = "{0}\\{1}\\{2}.snd";

                    CallButlerDataset.VoicemailsDataTable voicemailTable = new CallButlerDataset.VoicemailsDataTable();

                    foreach (CallButlerDataset.ExtensionsRow extRow in extensions.Rows)
                    {
                        Guid voicemailID = Guid.NewGuid();
                        string vmFileName = String.Format(fmt, vmDirectory, extRow.ExtensionID, voicemailID);
                        WOSI.Utilities.FileUtils.SaveBytesToFile(vmFileName, soundBytes);

                        CallButlerDataset.VoicemailsRow row = voicemailTable.NewVoicemailsRow();

                        row.CallerDisplayName = username;
                        row.CallerHost = Services.PrivateLabelService.ReplaceProductName("CallButler");
                        row.CallerUsername = extensionRow.ExtensionNumber.ToString();
                        row.ExtensionID = extRow.ExtensionID;
                        row.IsNew = true;
                        row.Timestamp = System.DateTime.Now;
                        row.VoicemailID = voicemailID;

                        voicemailTable.Rows.Add(row);
                    }

                    PersistVoicemail(authInfo, voicemailTable);
                }
            }
        }
        public void PersistProviders(CallButlerAuthInfo authInfo, CallButlerDataset.ProvidersDataTable providers)
        {
            if (Authenticate(authInfo) && IsDataValid(authInfo, providers))
            {
                foreach (CallButlerDataset.ProvidersRow row in providers)
                {
                    if (row.RowState != DataRowState.Deleted)
                    {
                        dataProvider.PersistProvider(row);

                        // Register our provider
                        telecomProvider.Register(row.ProviderID, row);
                    }
                }
            }
        }
 public void PersistScriptSchedule(CallButlerAuthInfo authInfo, CallButlerDataset.ScriptSchedulesDataTable scriptSchedules)
 {
     if (Authenticate(authInfo) && IsDataValid(authInfo, scriptSchedules))
     {
         foreach (WOSI.CallButler.Data.CallButlerDataset.ScriptSchedulesRow sRow in scriptSchedules)
         {
             if (sRow.RowState != DataRowState.Deleted)
             {
                 dataProvider.PersistScriptSchedule(authInfo.CustomerID, sRow);
             }
         }
     }
 }
 public void PersistPersonalizedGreeting(CallButlerAuthInfo authInfo, CallButlerDataset.PersonalizedGreetingsDataTable personalizedGreeting)
 {
     if (Authenticate(authInfo) && IsDataValid(authInfo, personalizedGreeting))
     {
         foreach (CallButlerDataset.PersonalizedGreetingsRow row in personalizedGreeting)
         {
             if (row.RowState != DataRowState.Deleted)
             {
                 dataProvider.PersistPersonalizedGreeting(row);
             }
         }
     }
 }
        public void PersistDepartment(CallButlerAuthInfo authInfo, CallButlerDataset.DepartmentsDataTable department)
        {
            if (Authenticate(authInfo) && IsDataValid(authInfo, department))
            {
                foreach (WOSI.CallButler.Data.CallButlerDataset.DepartmentsRow departmentRow in department)
                {
                    if (departmentRow.RowState != DataRowState.Deleted)
                    {
                        bool added = dataProvider.PersistDepartment(departmentRow);

                        if (!added)
                        {
                            // If this department is not a greeting department, make sure we delete any greetings that may have been associated with it
                            if (departmentRow.Type != (short)WOSI.CallButler.Data.DepartmentTypes.Greeting)
                                DeleteGreeting(authInfo, departmentRow.DepartmentID);
                        }
                    }
                }
            }
        }
Example #8
0
 private void SaveProviderRow( CallButlerDataset.ProvidersRow row )
 {
     CallButlerDataset.ProvidersDataTable providerDataTable = Utils.TableUtils<CallButlerDataset.ProvidersDataTable>.CreateTableFromRow(row);
      ManagementInterfaceClient.ManagementInterface.PersistProviders(ManagementInterfaceClient.AuthInfo, providerDataTable);
 }
Example #9
0
        private void EditProvider(CallButlerDataset.ProvidersRow provider)
        {
            // Get the provider editor plugin
            CallButler.Manager.Plugin.CallButlerManagementProviderPlugin providerPlugin = (CallButler.Manager.Plugin.CallButlerManagementProviderPlugin)PluginManager.GetPluginFromID(new Guid(Properties.Settings.Default.DefaultVoIPProviderPluginID));

            /*try
            {
                // Check to see if this provider uses a different plugin
                if(provider.PluginID != null && provider.PluginID.Length > 0)
                    providerPlugin = (CallButler.Manager.Plugin.CallButlerManagementProviderPlugin)PluginManager.GetPluginFromID(new Guid(provider.PluginID));
            }
            catch
            {
            }*/

            if (providerPlugin != null)
            {
                // Copy our provider row into our provider data
                CallButler.Manager.Plugin.ProviderData providerData = new CallButler.Manager.Plugin.ProviderData();

                if (provider.AuthPassword != null && provider.AuthPassword.Length > 0)
                    providerData.AuthPassword = WOSI.Utilities.CryptoUtils.Decrypt(provider.AuthPassword, WOSI.CallButler.Data.Constants.EncryptionPassword);

                providerData.AuthUsername = provider.AuthUsername;
                providerData.DisplayName = provider.DisplayName;
                providerData.Domain = provider.Domain;
                providerData.EnableRegistration = provider.EnableRegistration;
                providerData.Expires = provider.Expires;
                providerData.ExtraData = provider.ExtraData;
                providerData.IsEnabled = provider.IsEnabled;
                providerData.Name = provider.Name;
                providerData.SIPProxy = provider.SIPProxy;
                providerData.SIPRegistrar = provider.SIPRegistrar;
                providerData.Username = provider.Username;
                providerData.SupressOutboundUsername = provider.SupressOutboundUsername;
                providerData.OutboundUsernamePrefix = provider.OutboundUsernamePrefix;

                // Edit the data
                providerData = providerPlugin.EditProvider(providerData);

                if (providerData != null)
                {
                    // Copy the data back into our provider row
                    if (providerData.AuthPassword != null && providerData.AuthPassword.Length > 0)
                        provider.AuthPassword = WOSI.Utilities.CryptoUtils.Encrypt(providerData.AuthPassword, WOSI.CallButler.Data.Constants.EncryptionPassword);

                    provider.AuthUsername = providerData.AuthUsername;
                    provider.DisplayName = providerData.DisplayName;
                    provider.Domain = providerData.Domain;
                    provider.EnableRegistration = providerData.EnableRegistration;
                    provider.Expires = providerData.Expires;
                    provider.ExtraData = providerData.ExtraData;
                    provider.IsEnabled = providerData.IsEnabled;
                    provider.Name = providerData.Name;
                    provider.SIPProxy = providerData.SIPProxy;
                    provider.SIPRegistrar = providerData.SIPRegistrar;
                    provider.Username = providerData.Username;
                    provider.SupressOutboundUsername = providerData.SupressOutboundUsername;
                    provider.OutboundUsernamePrefix = providerData.OutboundUsernamePrefix;

                    SaveProviderRow(provider);
                    LoadData();
                }
            }
        }
Example #10
0
 private void DeleteProvider(CallButlerDataset.ProvidersRow provider)
 {
     Guid providerID = provider.ProviderID;
     callButlerDataset.Providers.RemoveProvidersRow(provider);
     ManagementInterfaceClient.ManagementInterface.DeleteProvider(ManagementInterfaceClient.AuthInfo, providerID);
 }