public async Task <ActionResult> DisplayVoiceMail(int id) { using (VoiceMailDataProvider voiceMailDP = new VoiceMailDataProvider()) { VoiceMailData voiceMail = await voiceMailDP.GetItemByIdentityAsync(id); if (voiceMail == null) { throw new Error(this.__ResStr("notFound", "Voice mail entry with id {0} not found"), id); } voiceMail.Heard = true; await voiceMailDP.UpdateItemAsync(voiceMail); DisplayModel model = new DisplayModel() { Listen = await Module.GetAction_ListenAsync(voiceMail.RecordingUrl) }; model.SetData(voiceMail); return(View(model)); } }
public BrowseItem(BrowseVoiceMailsModule module, DisplayVoiceMailModule displayModule, VoiceMailData data) { Module = module; DisplayModule = displayModule; ObjectSupport.CopyData(data, this); }
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")); }
public void SetData(VoiceMailData data) { ObjectSupport.CopyData(data, this); }