コード例 #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
        public void ForwardVoicemail(Guid extensionID, Guid voicemailID, Guid toExtensionID)
        {
            CallButlerDataset.VoicemailsRow voicemail = dataProvider.GetVoicemail(extensionID, voicemailID);

            if (voicemail != null)
            {
                Guid newVoicemailID = Guid.NewGuid();

                // Get our original voicemail name
                string origVoicemailFilename = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.VoicemailRootDirectory) + "\\" + voicemail.ExtensionID.ToString() + "\\" + voicemail.VoicemailID + ".snd";
                string newVoicemailDirectory = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.VoicemailRootDirectory) + "\\" + toExtensionID.ToString();
                string newVoicemailFilename  = newVoicemailDirectory + "\\" + newVoicemailID.ToString() + ".snd";

                if (!Directory.Exists(newVoicemailDirectory))
                {
                    Directory.CreateDirectory(newVoicemailDirectory);
                }

                // Copy our voicemail sound file
                File.Copy(origVoicemailFilename, newVoicemailFilename);

                // Create a new voicemail
                CreateVoicemail(newVoicemailID, toExtensionID, voicemail.CallerDisplayName, voicemail.CallerHost, voicemail.CallerUsername);
            }
        }
コード例 #3
0
        public void DeleteVoicemail(Guid extensionID, Guid voicemailID)
        {
            CallButlerDataset.VoicemailsRow vRow = dataProvider.GetVoicemail(extensionID, voicemailID);

            if (vRow != null)
            {
                string voicemailPath = String.Format("{0}\\{1}\\{2}.snd", WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.VoicemailRootDirectory), vRow.ExtensionID.ToString(), voicemailID.ToString());

                dataProvider.DeleteVoicemail(extensionID, voicemailID);

                if (File.Exists(voicemailPath))
                {
                    File.Delete(voicemailPath);
                }

                // Send a message waiting notification to our PBX phone
                if (registrarService != null)
                {
                    registrarService.SendMessageWaitingNotification(extensionID);
                }
            }
        }