private void EditPersonalizedGreeting(WOSI.CallButler.Data.CallButlerDataset.PersonalizedGreetingsRow pgRow)
        {
            // Get our localized greeting
            WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsDataTable lgTable = ManagementInterfaceClient.ManagementInterface.GetLocalizedGreetingInDefaultLanguage(ManagementInterfaceClient.AuthInfo, pgRow.PersonalizedGreetingID);

            if (lgTable.Count == 0)
            {
                // If no localized greeting exists, add a new one
                WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsRow lgRow = lgTable.NewLocalizedGreetingsRow();
                lgRow.LocalizedGreetingID = Guid.NewGuid();
                lgRow.GreetingID          = pgRow.PersonalizedGreetingID;
                lgRow.LanguageID          = ManagementInterfaceClient.ManagementInterface.GetDefaultLanguage(ManagementInterfaceClient.AuthInfo);
                lgRow.Type = (short)WOSI.CallButler.Data.GreetingType.SoundGreeting;
                lgTable.AddLocalizedGreetingsRow(lgRow);
            }

            Forms.PersonalizedGreetingForm pgForm = new CallButler.Manager.Forms.PersonalizedGreetingForm(pgRow, callButlerDataset.Extensions);

            pgForm.GreetingControl.LoadGreeting(lgTable[0], WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingsSoundCache));

            if (pgForm.ShowDialog(this) == DialogResult.OK)
            {
                pgForm.GreetingControl.SaveGreeting(WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingsSoundCache));

                // Persist remotely
                ManagementInterfaceClient.ManagementInterface.PersistPersonalizedGreeting(ManagementInterfaceClient.AuthInfo, Utils.TableUtils <WOSI.CallButler.Data.CallButlerDataset.PersonalizedGreetingsDataTable> .CreateTableFromRow(pgRow));
                ManagementInterfaceClient.ManagementInterface.PersistLocalizedGreeting(ManagementInterfaceClient.AuthInfo, lgTable);

                // Send our localized greeting sound file
                Utils.GreetingUtils.PersistLocalizedGreetingSound(lgTable[0]);

                callButlerDataset.AcceptChanges();
            }
        }
        private void DeletePersonalizedGreeting(WOSI.CallButler.Data.CallButlerDataset.PersonalizedGreetingsRow prRow)
        {
            if (MessageBox.Show(this, CallButler.Manager.Utils.PrivateLabelUtils.ReplaceProductName(Properties.LocalizedStrings.PersonalizedGreetingView_ConfirmDelete), CallButler.Manager.Utils.PrivateLabelUtils.ReplaceProductName(Properties.LocalizedStrings.Common_ConfirmDelete), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                ManagementInterfaceClient.ManagementInterface.DeletePersonalizedGreeting(ManagementInterfaceClient.AuthInfo, prRow.PersonalizedGreetingID);

                // Delete our local row
                prRow.Delete();

                callButlerDataset.AcceptChanges();
            }
        }
        public PersonalizedGreetingForm(WOSI.CallButler.Data.CallButlerDataset.PersonalizedGreetingsRow personalizedGreeting, WOSI.CallButler.Data.CallButlerDataset.ExtensionsDataTable extensions)
        {
            InitializeComponent();

            this.personalizedGreeting = personalizedGreeting;

            LoadData();

            wizard.PageIndex = 0;

            txtCallerID.Select();

            rbScript.Visible = true;
            lblScript.Visible = true;
            btnImportOutlook.Enabled = Utilities.ContactManagement.ContactManagerFactory.CreateContactManager(Utilities.ContactManagement.ContactType.Outlook).IsInstalled;

            Utils.PrivateLabelUtils.ReplaceProductNameControl(this);
        }
        public PersonalizedGreetingForm(WOSI.CallButler.Data.CallButlerDataset.PersonalizedGreetingsRow personalizedGreeting, WOSI.CallButler.Data.CallButlerDataset.ExtensionsDataTable extensions)
        {
            InitializeComponent();

            this.personalizedGreeting = personalizedGreeting;

            LoadData();

            wizard.PageIndex = 0;

            txtCallerID.Select();

            rbScript.Visible         = true;
            lblScript.Visible        = true;
            btnImportOutlook.Enabled = Utilities.ContactManagement.ContactManagerFactory.CreateContactManager(Utilities.ContactManagement.ContactType.Outlook).IsInstalled;

            Utils.PrivateLabelUtils.ReplaceProductNameControl(this);
        }
        internal void AddPersonalizedGreeting()
        {
            // Create a new personalized greeting row and table
            WOSI.CallButler.Data.CallButlerDataset.PersonalizedGreetingsDataTable pgTable = new WOSI.CallButler.Data.CallButlerDataset.PersonalizedGreetingsDataTable();
            WOSI.CallButler.Data.CallButlerDataset.PersonalizedGreetingsRow       pgRow   = pgTable.NewPersonalizedGreetingsRow();
            pgRow.PersonalizedGreetingID = Guid.NewGuid();
            pgRow.Type = (short)WOSI.CallButler.Data.PersonalizedGreetingType.Continue;
            pgTable.AddPersonalizedGreetingsRow(pgRow);

            // Create a new localized greeting row and table
            WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsDataTable lgTable = new WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsDataTable();
            WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsRow       lgRow   = lgTable.NewLocalizedGreetingsRow();
            lgRow.LocalizedGreetingID = Guid.NewGuid();
            lgRow.GreetingID          = pgRow.PersonalizedGreetingID;
            lgRow.LanguageID          = ManagementInterfaceClient.ManagementInterface.GetDefaultLanguage(ManagementInterfaceClient.AuthInfo);
            lgRow.Type = (short)WOSI.CallButler.Data.GreetingType.SoundGreeting;
            lgTable.AddLocalizedGreetingsRow(lgRow);

            Forms.PersonalizedGreetingForm pgForm = new CallButler.Manager.Forms.PersonalizedGreetingForm(pgRow, callButlerDataset.Extensions);

            pgForm.GreetingControl.LoadGreeting(lgRow, WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingsSoundCache));

            if (pgForm.ShowDialog(this) == DialogResult.OK)
            {
                pgForm.GreetingControl.SaveGreeting(WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingsSoundCache));

                // Add remotely
                ManagementInterfaceClient.ManagementInterface.PersistPersonalizedGreeting(ManagementInterfaceClient.AuthInfo, pgTable);
                ManagementInterfaceClient.ManagementInterface.PersistLocalizedGreeting(ManagementInterfaceClient.AuthInfo, lgTable);

                // Send our localized greeting sound file
                Utils.GreetingUtils.PersistLocalizedGreetingSound(lgRow);

                // Add locally
                callButlerDataset.PersonalizedGreetings.ImportRow(pgRow);

                callButlerDataset.AcceptChanges();
            }
        }
Beispiel #6
0
        public static bool ProcessPersonalizedGreeting(WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider, ref WOSI.IVR.IML.Classes.ScriptPage scriptPage, int customerID, string callerDisplayName, string callerPhoneNumber, string callerHost, string dialedPhoneNumber)
        {
            // Loop through our personalized greetings and see if we can find one that matches our caller
            WOSI.CallButler.Data.CallButlerDataset.PersonalizedGreetingsDataTable personalGreetings    = dataProvider.GetPersonalizedGreetings(customerID);
            WOSI.CallButler.Data.CallButlerDataset.PersonalizedGreetingsRow       personalizedGreeting = null;

            foreach (WOSI.CallButler.Data.CallButlerDataset.PersonalizedGreetingsRow pgRow in personalGreetings)
            {
                string matchExpression = "";

                // Try our dialed number first
                if (pgRow.DialedUsername.Length > 0)
                {
                    if (!pgRow.UseRegex)
                    {
                        matchExpression = pgRow.DialedUsername.Replace("*", ".*");
                    }
                    else
                    {
                        matchExpression = pgRow.DialedUsername;
                    }

                    if (Regex.IsMatch(dialedPhoneNumber, matchExpression, RegexOptions.IgnoreCase))
                    {
                        personalizedGreeting = pgRow;
                        break;
                    }
                }

                // Next try our caller username/phone number
                if (pgRow.CallerUsername.Length > 0)
                {
                    if (!pgRow.UseRegex)
                    {
                        matchExpression = pgRow.CallerUsername.Replace("*", ".*");
                    }
                    else
                    {
                        matchExpression = pgRow.CallerUsername;
                    }

                    // First find by the caller number
                    if (Regex.IsMatch(callerPhoneNumber, matchExpression, RegexOptions.IgnoreCase))
                    {
                        personalizedGreeting = pgRow;
                        break;
                    }
                }

                // Next try the host
                if (pgRow.CallerHost.Length > 0)
                {
                    if (!pgRow.UseRegex)
                    {
                        matchExpression = pgRow.CallerHost.Replace("*", ".*");
                    }
                    else
                    {
                        matchExpression = pgRow.CallerHost;
                    }

                    if (Regex.IsMatch(callerHost, matchExpression, RegexOptions.IgnoreCase))
                    {
                        personalizedGreeting = pgRow;
                        break;
                    }
                }

                // Next try the caller id/name
                if (pgRow.CallerDisplayName.Length > 0)
                {
                    if (!pgRow.UseRegex)
                    {
                        matchExpression = pgRow.CallerDisplayName.Replace("*", ".*");
                    }
                    else
                    {
                        matchExpression = pgRow.CallerDisplayName;
                    }

                    if (Regex.IsMatch(callerDisplayName, matchExpression, RegexOptions.IgnoreCase))
                    {
                        personalizedGreeting = pgRow;
                        break;
                    }
                }
            }

            // If we have a personalized greeting, tell the interpreter to play it
            if (personalizedGreeting != null && (!personalizedGreeting.PlayOnce || (personalizedGreeting.PlayOnce && !personalizedGreeting.HasPlayed)))
            {
                scriptPage.Actions.Add(ScriptUtils.CreateGreetingExternalAction(personalizedGreeting.PersonalizedGreetingID));

                switch (personalizedGreeting.Type)
                {
                case (short)WOSI.CallButler.Data.PersonalizedGreetingType.CustomScript:
                    GotoPage gotoCustomScript = new GotoPage();
                    gotoCustomScript.Location = personalizedGreeting.Data;
                    scriptPage.Actions.Add(gotoCustomScript);
                    break;

                case (short)WOSI.CallButler.Data.PersonalizedGreetingType.Hangup:
                    scriptPage.Actions.Add(new HangupCall());
                    break;

                case (short)WOSI.CallButler.Data.PersonalizedGreetingType.SendToExtension:
                    // Get the proper extension
                    WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow extension = dataProvider.GetExtension(customerID, new Guid(personalizedGreeting.Data));

                    if (extension != null)
                    {
                        TransferCall transferCall = new TransferCall();
                        transferCall.TransferTo  = extension.ExtensionNumber.ToString();
                        transferCall.IsExtension = true;

                        scriptPage.Actions.Add(transferCall);
                    }

                    break;

                case (short)WOSI.CallButler.Data.PersonalizedGreetingType.Module:

                    ExternalAction moduleAction = new ExternalAction();

                    moduleAction.Async         = false;
                    moduleAction.Action        = BaseExternalCommands.CALLBUTLERINTERNAL_StartAddonModule.ToString();
                    moduleAction.ParameterData = personalizedGreeting.Data;

                    scriptPage.Actions.Add(moduleAction);

                    break;
                }

                if (personalizedGreeting.PlayOnce)
                {
                    personalizedGreeting.HasPlayed = true;
                    dataProvider.PersistPersonalizedGreeting(personalizedGreeting);
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }