Exemplo n.º 1
0
        // get the action text from the entire menu string menu>submenu>submenu>action
        private async Task <MenuActionInfo> GetMenuActionAsync(string menuText)
        {
            string[] s = menuText.Split(new char[] { '>' });
            string   menuString;

            if (s.Length == 0)
            {
                menuString = menuText; // there is just the menu text
            }
            else
            {
                // return remaining menu text
                menuText   = string.Join(">", s.Take(s.Length - 1));
                menuString = s[s.Length - 1];
            }
            menuString = menuString.Trim();
            object obj = await EvaluateVariableAsync(menuString);

            if (obj is string)
            {
                string       text   = (string)obj;
                ModuleAction action = new ModuleAction(null)
                {
                    Category = ModuleAction.ActionCategoryEnum.Read,
                    Location = ModuleAction.ActionLocationEnum.MainMenu,
                    LinkText = text,
                    MenuText = text,
                    Style    = ModuleAction.ActionStyleEnum.Normal,
                };
                return(new MenuActionInfo {
                    Action = action,
                    MenuText = menuText,
                });
            }
            else if (obj is ModuleAction)
            {
                // create a copy with all attributes except queryargs as they can't be serialized, convert to Url instead
                ModuleAction action = new ModuleAction();
                ObjectSupport.CopyData(obj, action);
                action.Url           = action.GetCompleteUrl();
                action.QueryArgs     = null;
                action.QueryArgsHR   = null;
                action.QueryArgsDict = null;
                return(new MenuActionInfo {
                    Action = action,
                    MenuText = menuText,
                });
            }
            else
            {
                throw TemplateError("Unknown menu action {0}", menuString);
            }
        }
Exemplo n.º 2
0
        public async Task <ActionResult> RssFeed(Guid moduleGuid)
        {
            TextModule mod = (TextModule)await ModuleDefinition.LoadAsync(moduleGuid, AllowNone : true);

            if (mod == null || !mod.Feed)
            {
                throw new Error(this.__ResStr("noFeed", "The feed is no longer available"));
            }

            ModuleAction action = await mod.GetAction_RssFeedAwait(mod.ModuleGuid);

            string url = action.GetCompleteUrl();

            SyndicationFeed        feed;
            List <SyndicationItem> items = new List <SyndicationItem>();

            feed = new SyndicationFeed(mod.FeedTitle, mod.FeedSummary,
                                       string.IsNullOrWhiteSpace(mod.FeedMainUrl) ? new Uri(url) : new Uri(Manager.CurrentSite.MakeUrl(mod.FeedMainUrl)),
                                       items);

            action = await mod.GetAction_RssDetailAsync(mod.FeedDetailUrl, mod.ModuleGuid, mod.AnchorId);

            url = action.GetCompleteUrl();
            SyndicationItem sItem = new SyndicationItem(mod.Title, mod.Contents, new Uri(url));

            sItem.PublishDate = mod.FeedPublishDate ?? DateTime.MinValue;
            items.Add(sItem);

            if (mod.FeedImage != null)
            {
                feed.ImageUrl = new Uri(Manager.CurrentSite.MakeUrl(ImageHTML.FormatUrl(YetaWF.Core.Modules.ModuleImageSupport.ImageType, null, mod.FeedImage, CacheBuster: mod.DateUpdated.Ticks.ToString())));
            }
            feed.LastUpdatedTime = mod.FeedUpdateDate ?? DateTime.MinValue;

            return(new RssResult(feed));
        }
Exemplo n.º 3
0
        public async Task SendNewUserCreatedAsync(UserDefinition user)
        {
            // get the registration module for some defaults
            RegisterModule regMod = (RegisterModule)await ModuleDefinition.CreateUniqueModuleAsync(typeof(RegisterModule));

            ModuleAction reject = await regMod.GetAction_RejectAsync(user.UserName);

            SendEmail sendEmail = new SendEmail();
            object    parms     = new {
                User      = user,
                RejectUrl = reject.GetCompleteUrl(),
            };
            string subject = this.__ResStr("notifyNewUserSubject", "New account for user {0} - site  {1}", user.UserName, Manager.CurrentSite.SiteDomain);
            await sendEmail.PrepareEmailMessageAsync(null, subject, await sendEmail.GetEmailFileAsync(Package.GetCurrentPackage(this), "New Account Created.txt"), Parameters : parms);

            await sendEmail.SendAsync(false);

            SendingEmailAddress = await sendEmail.GetSendingEmailAddressAsync();
        }
Exemplo n.º 4
0
        public async Task SendPasswordResetEmailAsync(UserDefinition user, string ccEmail = null)
        {
            ResetPasswordModule resetMod = (ResetPasswordModule)await ModuleDefinition.CreateUniqueModuleAsync(typeof(ResetPasswordModule));

            ModuleAction reset = resetMod.GetAction_ResetPassword(null, user.UserId, user.ResetKey.ToString());

            SendEmail sendEmail = new SendEmail();
            object    parms     = new {
                User       = user,
                ResetUrl   = reset.GetCompleteUrl(),
                ResetKey   = user.ResetKey.ToString(),
                ValidUntil = Formatting.FormatDateTime(user.ResetValidUntil),
            };
            string subject = this.__ResStr("resetSubject", "Password Reset for {0}", Manager.CurrentSite.SiteDomain);
            await sendEmail.PrepareEmailMessageAsync(user.Email, subject, await sendEmail.GetEmailFileAsync(Package.GetCurrentPackage(this), "Password Reset.txt"), Parameters : parms);

            if (!string.IsNullOrWhiteSpace(ccEmail))
            {
                sendEmail.AddBcc(ccEmail);
            }
            await sendEmail.SendAsync(true);

            SendingEmailAddress = await sendEmail.GetSendingEmailAddressAsync();
        }
Exemplo n.º 5
0
        // Windows RSS Publisher's Guide http://blogs.msdn.com/b/rssteam/archive/2005/08/02/publishersguide.aspx

        public async Task <ActionResult> RssFeed(int?blogCategory)
        {
            BlogConfigData config = await BlogConfigDataProvider.GetConfigAsync();

            if (!config.Feed)
            {
                throw new Error(this.__ResStr("noFeed", "The feed is no longer available"));
            }

            int          categoryIdentity = blogCategory ?? 0;
            BlogCategory category         = null;

            if (categoryIdentity != 0)
            {
                using (BlogCategoryDataProvider categoryDP = new BlogCategoryDataProvider()) {
                    category = await categoryDP.GetItemAsync(categoryIdentity);

                    if (!category.Syndicated)
                    {
                        throw new Error(this.__ResStr("noFeed", "The feed is no longer available"));
                    }
                }
            }

            using (BlogEntryDataProvider dataProvider = new BlogEntryDataProvider()) {
                List <DataProviderSortInfo> sort = new List <DataProviderSortInfo> {
                    new DataProviderSortInfo {
                        Field = nameof(BlogEntry.DatePublished), Order = DataProviderSortInfo.SortDirection.Descending
                    },
                };
                List <DataProviderFilterInfo> filters = new List <DataProviderFilterInfo> {
                    new DataProviderFilterInfo {
                        Field = nameof(BlogEntry.Published), Operator = "==", Value = true
                    },
                };
                if (categoryIdentity != 0)
                {
                    filters = DataProviderFilterInfo.Join(filters, new DataProviderFilterInfo {
                        Field = nameof(BlogEntry.CategoryIdentity), Operator = "==", Value = categoryIdentity
                    });
                }
                DataProviderGetRecords <BlogEntry> data = await dataProvider.GetItemsAsync(0, 0, sort, filters);

                string url = string.IsNullOrWhiteSpace(config.FeedMainUrl) ? Manager.CurrentSite.HomePageUrl : config.FeedMainUrl;

                List <SyndicationItem> items   = new List <SyndicationItem>();
                EntryDisplayModule     dispMod = new EntryDisplayModule();

                DateTime lastUpdated = DateTime.MinValue;
                foreach (BlogEntry blogEntry in data.Data)
                {
                    if (categoryIdentity == 0)
                    {
                        using (BlogCategoryDataProvider categoryDP = new BlogCategoryDataProvider()) {
                            category = await categoryDP.GetItemAsync(blogEntry.CategoryIdentity);

                            if (!category.Syndicated)
                            {
                                continue;
                            }
                        }
                    }
                    ModuleAction viewAction = await dispMod.GetAction_DisplayAsync(blogEntry.Identity);

                    if (viewAction == null)
                    {
                        continue;
                    }
                    SyndicationItem sItem   = new SyndicationItem(blogEntry.Title.ToString(), blogEntry.Text, new Uri(viewAction.GetCompleteUrl()));
                    DateTime        updDate = blogEntry.DateUpdated ?? blogEntry.DateCreated;
                    sItem.LastUpdatedTime = updDate;
                    if (!string.IsNullOrEmpty(category.SyndicationEmail))
                    {
                        sItem.Authors.Add(new SyndicationPerson(category.SyndicationEmail));
                    }
                    sItem.Categories.Add(new SyndicationCategory(category.Category.ToString()));
                    if (!string.IsNullOrEmpty(category.SyndicationCopyright.ToString()))
                    {
                        sItem.Copyright = new TextSyndicationContent(category.SyndicationCopyright.ToString());
                    }
                    sItem.PublishDate = blogEntry.DatePublished;
                    if (!string.IsNullOrEmpty(blogEntry.DisplayableSummary))
                    {
                        sItem.Summary = new TextSyndicationContent(blogEntry.DisplayableSummary);
                    }
                    lastUpdated = updDate > lastUpdated ? updDate : lastUpdated;

                    items.Add(sItem);
                }

                SyndicationFeed feed;
                if (categoryIdentity != 0)
                {
                    feed = new SyndicationFeed(category.Category.ToString(), category.Description.ToString(), new Uri(Manager.CurrentSite.MakeUrl(url)), items);
                }
                else
                {
                    feed = new SyndicationFeed(config.FeedTitle, config.FeedSummary, new Uri(Manager.CurrentSite.MakeUrl(url)), items);
                }
                if (config.FeedImage != null)
                {
                    feed.ImageUrl = new Uri(Manager.CurrentSite.MakeUrl(ImageHTML.FormatUrl(BlogConfigData.ImageType, null, config.FeedImage))); //$$$ caching issue
                }
                if (lastUpdated != DateTime.MinValue)
                {
                    feed.LastUpdatedTime = lastUpdated;
                }
                return(new RssResult(feed));
            }
        }
Exemplo n.º 6
0
        internal static async Task <string> RenderActionAsync(ModuleAction action, ModuleAction.RenderModeEnum mode, string id,
                                                              ModuleAction.RenderEngineEnum RenderEngine = ModuleAction.RenderEngineEnum.KendoMenu, int BootstrapSmartMenuLevel = 0, bool HasSubmenu = false)
        {
            // check if we're in the right mode
            if (!await action.RendersSomethingAsync())
            {
                return(null);
            }

            await Manager.AddOnManager.AddTemplateFromUIHintAsync("ActionIcons");// this is needed because we're not used by templates

            if (!string.IsNullOrWhiteSpace(action.ConfirmationText) && (action.Style != ModuleAction.ActionStyleEnum.Post && action.Style != ModuleAction.ActionStyleEnum.Nothing))
            {
                throw new InternalError("When using ConfirmationText, the Style property must be set to Post");
            }
            if (!string.IsNullOrWhiteSpace(action.PleaseWaitText) && (action.Style != ModuleAction.ActionStyleEnum.Normal && action.Style != ModuleAction.ActionStyleEnum.Post))
            {
                throw new InternalError("When using PleaseWaitText, the Style property must be set to Normal or Post");
            }
            if (action.CookieAsDoneSignal && action.Style != ModuleAction.ActionStyleEnum.Normal)
            {
                throw new InternalError("When using CookieAsDoneSignal, the Style property must be set to Normal");
            }

            ModuleAction.ActionStyleEnum style = action.Style;
            if (style == ModuleAction.ActionStyleEnum.OuterWindow)
            {
                if (!Manager.IsInPopup)
                {
                    style = ModuleAction.ActionStyleEnum.Normal;
                }
            }

            if (style == ModuleAction.ActionStyleEnum.Popup || style == ModuleAction.ActionStyleEnum.PopupEdit)
            {
                if (Manager.IsInPopup)
                {
                    style = ModuleAction.ActionStyleEnum.NewWindow;
                }
            }

            if (style == ModuleAction.ActionStyleEnum.Popup || style == ModuleAction.ActionStyleEnum.PopupEdit || style == ModuleAction.ActionStyleEnum.ForcePopup)
            {
                await YetaWFCoreRendering.Render.AddPopupsAddOnsAsync();
            }

            bool newWindow = false, outerWindow = false;
            bool popup = false, popupEdit = false;
            bool nothing = false, post = false;

            switch (style)
            {
            default:
            case ModuleAction.ActionStyleEnum.Normal:
                break;

            case ModuleAction.ActionStyleEnum.NewWindow:
                newWindow = true;
                break;

            case ModuleAction.ActionStyleEnum.Popup:
            case ModuleAction.ActionStyleEnum.ForcePopup:
                popup = Manager.CurrentSite.AllowPopups;
                break;

            case ModuleAction.ActionStyleEnum.PopupEdit:
                popup     = Manager.CurrentSite.AllowPopups;
                popupEdit = Manager.CurrentSite.AllowPopups;
                break;

            case ModuleAction.ActionStyleEnum.OuterWindow:
                outerWindow = true;
                break;

            case ModuleAction.ActionStyleEnum.Nothing:
                nothing = true;
                break;

            case ModuleAction.ActionStyleEnum.Post:
                post = true;
                break;
            }

            YTagBuilder tag = new YTagBuilder("a");

            if (!string.IsNullOrWhiteSpace(action.Tooltip))
            {
                tag.MergeAttribute(Basics.CssTooltip, action.Tooltip);
            }
            if (!string.IsNullOrWhiteSpace(action.Name))
            {
                tag.MergeAttribute("data-name", action.Name);
            }
            if (!action.Displayed)
            {
                tag.MergeAttribute("style", "display:none");
            }
            if (HasSubmenu)
            {
                if (RenderEngine == ModuleAction.RenderEngineEnum.BootstrapSmartMenu)
                {
                    tag.AddCssClass("dropdown-toggle");
                    tag.Attributes.Add("data-toggle", "dropdown-toggle");
                }
                tag.Attributes.Add("aria-haspopup", "true");
                tag.Attributes.Add("aria-expanded", "false");
            }
            if (RenderEngine == ModuleAction.RenderEngineEnum.BootstrapSmartMenu)
            {
                tag.AddCssClass(BootstrapSmartMenuLevel <= 1 ? "nav-link" : "dropdown-item");
            }

            if (!string.IsNullOrWhiteSpace(id))
            {
                tag.Attributes.Add("id", id);
            }

            if (!string.IsNullOrWhiteSpace(action.CssClass))
            {
                tag.AddCssClass(Manager.AddOnManager.CheckInvokedCssModule(action.CssClass));
            }
            string extraClass;

            switch (mode)
            {
            default:
            case ModuleAction.RenderModeEnum.Button: extraClass = "y_act_button"; break;

            case ModuleAction.RenderModeEnum.ButtonIcon: extraClass = "y_act_buttonicon"; break;

            case ModuleAction.RenderModeEnum.ButtonOnly: extraClass = "y_act_buttononly"; break;

            case ModuleAction.RenderModeEnum.IconsOnly: extraClass = "y_act_icon"; break;

            case ModuleAction.RenderModeEnum.LinksOnly: extraClass = "y_act_link"; break;

            case ModuleAction.RenderModeEnum.NormalLinks: extraClass = "y_act_normlink"; break;

            case ModuleAction.RenderModeEnum.NormalMenu: extraClass = "y_act_normmenu"; break;
            }
            tag.AddCssClass(Manager.AddOnManager.CheckInvokedCssModule(extraClass));

            string url = action.GetCompleteUrl(OnPage: true);

            if (!string.IsNullOrWhiteSpace(url))
            {
                tag.MergeAttribute("href", Utility.UrlEncodePath(url));
                if (Manager.CurrentPage != null)
                {
                    string currUrl = Manager.CurrentPage.EvaluatedCanonicalUrl;
                    if (!string.IsNullOrWhiteSpace(currUrl) && currUrl != "/")  // this doesn't work on home page because everything matches
                    {
                        if (action.Url == currUrl)
                        {
                            tag.AddCssClass("t_currenturl");
                        }
                        if (currUrl.StartsWith(action.Url))
                        {
                            tag.AddCssClass("t_currenturlpart");
                        }
                    }
                }
            }
            else
            {
                tag.MergeAttribute("href", "javascript:void(0);");
            }

            if (!string.IsNullOrWhiteSpace(action.ConfirmationText))
            {
                if (action.Category == ModuleAction.ActionCategoryEnum.Delete)
                {
                    // confirm deletions?
                    if (UserSettings.GetProperty <bool>("ConfirmDelete"))
                    {
                        tag.MergeAttribute(Basics.CssConfirm, action.ConfirmationText);
                    }
                }
                else
                {
                    // confirm actions?
                    if (UserSettings.GetProperty <bool>("ConfirmActions"))
                    {
                        tag.MergeAttribute(Basics.CssConfirm, action.ConfirmationText);
                    }
                }
            }
            if (!string.IsNullOrWhiteSpace(action.PleaseWaitText))
            {
                tag.MergeAttribute(Basics.CssPleaseWait, action.PleaseWaitText);
            }
            if (action.CookieAsDoneSignal)
            {
                tag.Attributes.Add(Basics.CookieDoneCssAttr, "");
            }
            if (action.SaveReturnUrl)
            {
                tag.Attributes.Add(Basics.CssSaveReturnUrl, "");
                if (!action.AddToOriginList)
                {
                    tag.Attributes.Add(Basics.CssDontAddToOriginList, "");
                }
            }
            if (!string.IsNullOrWhiteSpace(action.ExtraData))
            {
                tag.Attributes.Add(Basics.CssExtraData, action.ExtraData);
            }
            if (action.NeedsModuleContext)
            {
                tag.Attributes.Add(Basics.CssAddModuleContext, "");
            }

            if (post)
            {
                tag.Attributes.Add(Basics.PostAttr, "");
            }
            if (action.DontFollow || action.CookieAsDoneSignal || post || nothing)
            {
                tag.MergeAttribute("rel", "nofollow"); // this is so bots don't follow this assuming it's a simple page (Post actions can't be retrieved with GET/HEAD anyway)
            }
            if (outerWindow)
            {
                tag.Attributes.Add(Basics.CssOuterWindow, "");
            }
            if (!nothing)
            {
                tag.AddCssClass(Manager.AddOnManager.CheckInvokedCssModule(Basics.CssActionLink));
            }
            if (newWindow)
            {
                tag.MergeAttribute("target", "_blank");
                tag.MergeAttribute("rel", "noopener noreferrer");
            }
            if (popup)
            {
                tag.AddCssClass(Manager.AddOnManager.CheckInvokedCssModule(Basics.CssPopupLink));
                if (popupEdit)
                {
                    tag.Attributes.Add(Basics.CssAttrDataSpecialEdit, "");
                }
            }
            if (mode == ModuleAction.RenderModeEnum.Button || mode == ModuleAction.RenderModeEnum.ButtonIcon || mode == ModuleAction.RenderModeEnum.ButtonOnly)
            {
                tag.Attributes.Add(Basics.CssAttrActionButton, "");
            }

            bool   hasText = false, hasImg = false;
            string innerHtml = "";

            if (mode != ModuleAction.RenderModeEnum.LinksOnly && mode != ModuleAction.RenderModeEnum.ButtonOnly && !string.IsNullOrWhiteSpace(action.ImageUrlFinal))
            {
                string text = mode == ModuleAction.RenderModeEnum.NormalMenu ? action.MenuText : action.LinkText;
                if (RenderEngine == ModuleAction.RenderEngineEnum.KendoMenu)
                {
                    innerHtml += ImageHTML.BuildKnownIcon(action.ImageUrlFinal, alt: text, cssClass: Basics.CssNoTooltip + " k-image"); // k-image is needed to align <i> and <img> correctly
                }
                else
                {
                    innerHtml += ImageHTML.BuildKnownIcon(action.ImageUrlFinal, alt: text, cssClass: Basics.CssNoTooltip);
                }
                hasImg = true;
            }
            if (mode != ModuleAction.RenderModeEnum.IconsOnly && mode != ModuleAction.RenderModeEnum.ButtonIcon)
            {
                string text = mode == ModuleAction.RenderModeEnum.NormalMenu ? action.MenuText : action.LinkText;
                if (!string.IsNullOrWhiteSpace(text))
                {
                    innerHtml += Utility.HtmlEncode(text);
                    hasText    = true;
                }
            }
            if (hasText)
            {
                if (hasImg)
                {
                    tag.AddCssClass("y_act_textimg");
                }
                else
                {
                    tag.AddCssClass("y_act_text");
                }
            }
            else
            {
                if (hasImg)
                {
                    tag.AddCssClass("y_act_img");
                }
            }
            if (HasSubmenu && RenderEngine == ModuleAction.RenderEngineEnum.BootstrapSmartMenu)
            {
                innerHtml += " <span class='caret'></span>";
            }

            tag.AddCssClass(Globals.CssModuleNoPrint);
            tag.InnerHtml = innerHtml;

            return(tag.ToString(YTagRenderMode.Normal));
        }
Exemplo n.º 7
0
        private async Task <ActionResult> RunEntryAsync(IVRConfig ivrConfig, ScriptData script, string called, string extension, ScriptEntry entry, int errCount)
        {
            string extensionName   = null;
            string extensionSpaced = null;

            if (!string.IsNullOrWhiteSpace(extension))
            {
                extensionSpaced = Spaced(extension);
                Extension e = script.FindExtension(extension);
                if (e != null)
                {
                    extensionName = e.Name;
                }
            }
            string digits;

            TryGetForm("Digits", out digits);

            string actionUrl = Utility.UrlFor(typeof(CallController), nameof(Process));

#if DEBUG
            actionUrl = Manager.CurrentSite.MakeFullUrl(actionUrl, SecurityType: YetaWF.Core.Pages.PageDefinition.PageSecurityType.Any);
#else
            actionUrl = Manager.CurrentSite.MakeFullUrl(actionUrl, SecurityType: YetaWF.Core.Pages.PageDefinition.PageSecurityType.httpsOnly);
#endif

            string token = DateTime.UtcNow.Ticks.ToString();
            string encryptedToken;
            RSACrypto.Encrypt(ivrConfig.PublicKey, token, out encryptedToken);

            object parms = new {
                Url             = actionUrl,
                Caller          = GetForm("Caller"),
                CallerSpaced    = Spaced(GetForm("Caller").TruncateStart("+1")),
                CallerCity      = GetForm("CallerCity"),
                CallerCountry   = GetForm("CallerCountry"),
                Digits          = digits,
                Extension       = extension,
                ExtensionSpaced = extensionSpaced,
                ExtensionName   = extensionName,
                ErrCount        = errCount,
                ErrCountPlus1   = errCount + 1,
                Token           = encryptedToken,
                Voice           = ivrConfig.Voice,
                VoiceInternal   = ivrConfig.VoiceInternal,
            };

            string    text = entry.Text;
            Variables vars = new Variables(Manager, parms)
            {
                EncodingType = Variables.EncodingTypeEnum.XML
            };

            Extension ext = script.FindExtension(digits);
            if (ext != null)
            {
                text = RepeatableNumbers(ext, text);
            }

            if (text.Contains("RECORDVOICEMAIL"))
            {
                text = text.Replace("RECORDVOICEMAIL", "");
                VoiceMailData voiceMail;
                using (VoiceMailDataProvider voiceMailDP = new VoiceMailDataProvider()) {
                    voiceMail = new VoiceMailData {
                        Caller        = GetForm("Caller").Truncate(Globals.MaxPhoneNumber),
                        CallerCity    = GetForm("CallerCity").Truncate(VoiceMailData.MaxCity),
                        CallerState   = GetForm("CallerState").Truncate(VoiceMailData.MaxState),
                        CallerZip     = GetForm("CallerZip").Truncate(VoiceMailData.MaxZip),
                        CallerCountry = GetForm("CallerCountry").Truncate(VoiceMailData.MaxCountry),
                        CallSid       = GetForm("CallSid"),
                        RecordingSid  = GetForm("RecordingSid"),
                        Duration      = ConvertToInt(GetForm("RecordingDuration")),
                        To            = called,
                        Extension     = extension,
                        RecordingUrl  = GetForm("RecordingUrl").Truncate(Globals.MaxUrl)
                    };
                    if (!await voiceMailDP.AddItemAsync(voiceMail))
                    {
                        Logging.AddErrorLog($"Couldn't record voice mail status for call from {GetForm("Caller")}");
                    }
                }
                if (!string.IsNullOrWhiteSpace(extension))
                {
                    ext = script.FindExtension(extension);
                    if (ext != null)
                    {
                        DisplayVoiceMailModule dispMod = (DisplayVoiceMailModule)await ModuleDefinition.LoadAsync(ModuleDefinition.GetPermanentGuid(typeof(DisplayVoiceMailModule)));

                        ModuleAction displayAction = await dispMod.GetAction_DisplayAsync(null, voiceMail.Id);

                        if (displayAction != null)
                        {
                            string viewUrl = displayAction.GetCompleteUrl();
                            foreach (ExtensionNumber extNumber in ext.Numbers)
                            {
                                if (extNumber.SendSMSVoiceMail)
                                {
                                    SendSMS sendSMS = new SendSMS();
                                    await sendSMS.SendMessageAsync(extNumber.Number,
                                                                   this.__ResStr("voiceSMS", "A voice mail was received for extension {0} ({1}) from {2}, {3}, {4}, {5} {6} - {7}",
                                                                                 extension, GetForm("To"), GetForm("Caller"), GetForm("CallerCity"), GetForm("CallerState"), GetForm("CallerZip"), GetForm("CallerCountry"),
                                                                                 viewUrl),
                                                                   ThrowError : false);
                                }
                            }
                        }
                    }
                }
            }

            text = vars.ReplaceVariables(text);
            Logging.AddLog($"{nameof(RunEntryAsync)}: {text}");
            return(Content(text, "text/xml"));
        }