コード例 #1
0
        public void RefreshVoicemails(WOSI.CallButler.Data.CallButlerDataset.VoicemailsDataTable newVoicemailTable)
        {
            if (soundPlayer.Playing == false)
            {
                for (int i = voicemailDataset.Voicemails.Count - 1; i >= 0; i--)
                {
                    CallButlerDataset.VoicemailsRow row = (CallButlerDataset.VoicemailsRow)voicemailDataset.Voicemails[i];
                    if (row.RowState == DataRowState.Deleted)
                    {
                        continue;
                    }
                    if (newVoicemailTable.FindByVoicemailID(row.VoicemailID) == null)
                    {
                        lock (voicemailDataset.Voicemails)
                        {
                            voicemailDataset.Voicemails.RemoveVoicemailsRow(row);
                        }
                    }
                }

                voicemailDataset.Voicemails.Merge(newVoicemailTable);
                voicemailDataset.AcceptChanges();
                RefreshVoicemails();
            }
            else
            {
                fastUpdateTable = newVoicemailTable;
            }
        }
コード例 #2
0
        private void StopSound(bool markAsRead)
        {
            soundPlayer.StopSound();

            progSound.LowerValue = 0;
            progSound.UpperValue = 0;

            btnStop.Enabled = false;
            btnPlay.Enabled = true;

            // If our current voicemail is new, mark it old
            if (markAsRead)
            {
                WOSI.CallButler.Data.CallButlerDataset.VoicemailsRow voicemail = GetSelectedVoicemail();

                if (voicemail != null & voicemail.IsNew)
                {
                    voicemail.IsNew = false;

                    if (VoicemailRead != null)
                    {
                        VoicemailRead(this, new VoicemailEventArgs(voicemail));
                    }
                }
            }

            if (fastUpdateTable != null)
            {
                RefreshVoicemails(fastUpdateTable);
                fastUpdateTable = null;
            }
        }
コード例 #3
0
        public void CreateVoicemail(Guid voicemailID, Guid extensionID, string callerDisplayName, string callerHost, string callerUsername)
        {
            // Get our extension
            WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow extension = dataProvider.GetExtension(Properties.Settings.Default.CustomerID, extensionID);

            if (extension != null)
            {
                // Create a new voicemail record
                WOSI.CallButler.Data.CallButlerDataset.VoicemailsDataTable voicemailsTable = new WOSI.CallButler.Data.CallButlerDataset.VoicemailsDataTable();
                WOSI.CallButler.Data.CallButlerDataset.VoicemailsRow       voicemail       = voicemailsTable.NewVoicemailsRow();
                voicemail.CallerDisplayName = callerDisplayName;
                voicemail.CallerHost        = callerHost;
                voicemail.CallerUsername    = callerUsername;
                voicemail.ExtensionID       = extensionID;
                voicemail.VoicemailID       = voicemailID;
                voicemail.Timestamp         = DateTime.Now;
                voicemailsTable.AddVoicemailsRow(voicemail);

                dataProvider.PersistVoicemail(voicemail);

                // Run the voicemail through any VM plugins
                CallButler.Service.Plugin.CallButlerVoicemailHandlerPlugin[] vmHandlers = pluginManager.GetAllPluginsOfType <CallButler.Service.Plugin.CallButlerVoicemailHandlerPlugin>();
                foreach (CallButler.Service.Plugin.CallButlerVoicemailHandlerPlugin vmHandler in vmHandlers)
                {
                    try
                    {
                        vmHandler.OnNewVoicemail(voicemail.CallerDisplayName, voicemail.CallerHost, voicemail.ExtensionID.ToString(), voicemail.VoicemailID.ToString(), WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.VoicemailRootDirectory) + "\\" + voicemail.ExtensionID.ToString() + "\\" + voicemail.VoicemailID.ToString() + ".snd");
                    }
                    catch (Exception e)
                    {
                        LoggingService.AddLogEntry(WOSI.CallButler.ManagementInterface.LogLevel.ErrorsOnly, string.Format("Voicemail Handler Plugin Failed\r\n\r\n{0} ({1})\r\n\r\n{2}", vmHandler.PluginName, vmHandler.PluginID.ToString(), e.Message), true);
                    }
                }

                // Queue our voicemail Email
                vmMailerService.QueueVoicemailEmail(extension, voicemail);

                // Notify the any PBX phones of a new message
                if (registrarService != null)
                {
                    registrarService.SendMessageWaitingNotification(extension.ExtensionNumber);
                }

                // Notify anyone else of the new message
                WOSI.Utilities.EventUtils.FireAsyncEvent(NewVoicemail, this, new VoicemailEventArgs(voicemail));
            }
        }
コード例 #4
0
        private void StopSound(bool markAsRead)
        {
            soundPlayer.StopSound();

            progSound.LowerValue = 0;
            progSound.UpperValue = 0;

            btnStop.Enabled = false;
            btnPlay.Enabled = true;

            // If our current voicemail is new, mark it old
            if (markAsRead)
            {
                WOSI.CallButler.Data.CallButlerDataset.VoicemailsRow voicemail = GetSelectedVoicemail();

                if (voicemail != null & voicemail.IsNew)
                {
                    voicemail.IsNew = false;

                    if (VoicemailRead != null)
                        VoicemailRead(this, new VoicemailEventArgs(voicemail));
                }
            }

            if (fastUpdateTable != null)
            {
                RefreshVoicemails(fastUpdateTable);
                fastUpdateTable = null;
            }
        }
コード例 #5
0
        public void RefreshVoicemails(WOSI.CallButler.Data.CallButlerDataset.VoicemailsDataTable newVoicemailTable)
        {
            if (soundPlayer.Playing == false)
                {
                    for (int i = voicemailDataset.Voicemails.Count - 1; i >= 0; i--)
                    {
                        CallButlerDataset.VoicemailsRow row = (CallButlerDataset.VoicemailsRow)voicemailDataset.Voicemails[i];
                        if (row.RowState == DataRowState.Deleted)
                        {
                            continue;
                        }
                        if (newVoicemailTable.FindByVoicemailID(row.VoicemailID) == null)
                        {
                            lock (voicemailDataset.Voicemails)
                            {
                                voicemailDataset.Voicemails.RemoveVoicemailsRow(row);
                            }
                        }
                    }

                    voicemailDataset.Voicemails.Merge(newVoicemailTable);
                    voicemailDataset.AcceptChanges();
                    RefreshVoicemails();
                }
                else
                {
                    fastUpdateTable = newVoicemailTable;
                }
        }
コード例 #6
0
        public void CreateVoicemail(Guid voicemailID, Guid extensionID, string callerDisplayName, string callerHost, string callerUsername)
        {
            // Get our extension
            WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow extension = dataProvider.GetExtension(Properties.Settings.Default.CustomerID, extensionID);

            if (extension != null)
            {
                // Create a new voicemail record
                WOSI.CallButler.Data.CallButlerDataset.VoicemailsDataTable voicemailsTable = new WOSI.CallButler.Data.CallButlerDataset.VoicemailsDataTable();
                WOSI.CallButler.Data.CallButlerDataset.VoicemailsRow voicemail = voicemailsTable.NewVoicemailsRow();
                voicemail.CallerDisplayName = callerDisplayName;
                voicemail.CallerHost = callerHost;
                voicemail.CallerUsername = callerUsername;
                voicemail.ExtensionID = extensionID;
                voicemail.VoicemailID = voicemailID;
                voicemail.Timestamp = DateTime.Now;
                voicemailsTable.AddVoicemailsRow(voicemail);

                dataProvider.PersistVoicemail(voicemail);

                // Run the voicemail through any VM plugins
                CallButler.Service.Plugin.CallButlerVoicemailHandlerPlugin[] vmHandlers = pluginManager.GetAllPluginsOfType<CallButler.Service.Plugin.CallButlerVoicemailHandlerPlugin>();
                foreach (CallButler.Service.Plugin.CallButlerVoicemailHandlerPlugin vmHandler in vmHandlers)
                {
                    try
                    {
                        vmHandler.OnNewVoicemail(voicemail.CallerDisplayName, voicemail.CallerHost, voicemail.ExtensionID.ToString(), voicemail.VoicemailID.ToString(), WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.VoicemailRootDirectory) + "\\" + voicemail.ExtensionID.ToString() + "\\" + voicemail.VoicemailID.ToString() + ".snd");
                    }
                    catch (Exception e)
                    {
                        LoggingService.AddLogEntry(WOSI.CallButler.ManagementInterface.LogLevel.ErrorsOnly, string.Format("Voicemail Handler Plugin Failed\r\n\r\n{0} ({1})\r\n\r\n{2}", vmHandler.PluginName, vmHandler.PluginID.ToString(), e.Message), true);
                    }
                }

                // Queue our voicemail Email
                vmMailerService.QueueVoicemailEmail(extension, voicemail);

                // Notify the any PBX phones of a new message
                if (registrarService != null)
                    registrarService.SendMessageWaitingNotification(extension.ExtensionNumber);

                // Notify anyone else of the new message
                WOSI.Utilities.EventUtils.FireAsyncEvent(NewVoicemail, this, new VoicemailEventArgs(voicemail));
            }
        }