protected override void OnStartProcessing(TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { string scriptLocation = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory) + "\\Outbound Call.xml"; if (File.Exists(scriptLocation)) { IMLScript imlScript = IMLScript.OpenScript(scriptLocation); tsInterface.IMLInterpreter.SetLocalVariable("HoldMusicLocation", WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.HoldMusicRootDirectory)); tsInterface.IMLInterpreter.StartScript(imlScript, WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory)); WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow extension = dataProvider.GetExtensionNumber(Properties.Settings.Default.CustomerID, outboundExtensionNumber); // If the outbound ts interface is null, then this means we don't have any available lines to make outbound calls. // Also check to see if this extension is allowed to make outbound calls if (outboundTsInterface == null || (outboundExtensionNumber >= 0 && extension != null && !extension.EnableOutboundCalls)) { tsInterface.IMLInterpreter.SignalCallFailure(); outboundTsInterface.Locked = false; } else { // Link to our outbound script processor and start it outboundTsInterface.ScriptProcessor.LinkScriptProcessor(this); outboundTsInterface.ScriptProcessor.StartProcessing(outboundTsInterface, telecomProvider, dataProvider); } } }
protected override void OnStartProcessing(TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { string callFlowScriptLocation = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory) + "\\Call Flow.xml"; IMLScript imlScript = new IMLScript(); ScriptPage introPage = new ScriptPage(); introPage.ID = Guid.NewGuid().ToString(); if (Properties.Settings.Default.WelcomeGreetingDelay > 0) { Delay welcomeDelay = new Delay(); welcomeDelay.DelayTime = Properties.Settings.Default.WelcomeGreetingDelay.ToString(); introPage.Actions.Add(welcomeDelay); } /*if (LicenseService.IsTrialLicense()) * { * introPage.Actions.Add(ScriptCompilers.ScriptUtils.CreateExternalAction(ScriptCompilers.BaseExternalCommands.CALLBUTLERINTERNAL_PlayLicenseIntroGreeting.ToString(), "")); * }*/ ScriptCompilers.ScriptUtils.ProcessPersonalizedGreeting(dataProvider, ref introPage, Properties.Settings.Default.CustomerID, tsInterface.IMLInterpreter.CallerDisplayName, tsInterface.IMLInterpreter.CallerUsername, tsInterface.IMLInterpreter.CallerHost, tsInterface.IMLInterpreter.DialedUsername); if (File.Exists(callFlowScriptLocation)) { GotoPage gotoPage = new GotoPage(); gotoPage.Location = callFlowScriptLocation; introPage.Actions.Add(gotoPage); imlScript.Pages.Add(introPage); } tsInterface.IMLInterpreter.StartScript(imlScript, WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory)); }
public Click2CallScriptProcessor(ScriptService scriptService, string numberToDial, WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow callMakerExtension, TelecomScriptInterface callMakerInterface) { this.callMakerExtension = callMakerExtension; this.scriptService = scriptService; this.numberToDial = numberToDial; this.callMakerInterface = callMakerInterface; }
protected override void OnStartProcessing(TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { LoggingService.AddLogEntry(LogLevel.Extended, "(Line " + tsInterface.LineNumber + ") Executing custom script at " + customScriptLocation, false); IMLScript imlScript = new IMLScript(); ScriptPage introPage = new ScriptPage(); introPage.ID = Guid.NewGuid().ToString(); /*if (LicenseService.IsTrialLicense()) * { * if (Properties.Settings.Default.WelcomeGreetingDelay > 0) * { * Delay welcomeDelay = new Delay(); * welcomeDelay.DelayTime = Properties.Settings.Default.WelcomeGreetingDelay.ToString(); * introPage.Actions.Add(welcomeDelay); * } * * introPage.Actions.Add(ScriptCompilers.ScriptUtils.CreateExternalAction(ScriptCompilers.BaseExternalCommands.CALLBUTLERINTERNAL_PlayLicenseIntroGreeting.ToString(), "")); * }*/ ScriptCompilers.ScriptUtils.ProcessPersonalizedGreeting(dataProvider, ref introPage, Properties.Settings.Default.CustomerID, tsInterface.IMLInterpreter.CallerDisplayName, tsInterface.IMLInterpreter.CallerUsername, tsInterface.IMLInterpreter.CallerHost, tsInterface.IMLInterpreter.DialedUsername); GotoPage gotoPage = new GotoPage(); gotoPage.Location = customScriptLocation; introPage.Actions.Add(gotoPage); imlScript.Pages.Add(introPage); tsInterface.IMLInterpreter.StartScript(imlScript, System.IO.Path.GetDirectoryName(customScriptLocation)); }
public TransferConferenceParticipantScriptProcessor(int conferenceID, TelecomScriptInterface extensionTsInterface, WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow extension, VoicemailMailerService vmMailerService) { this.extensionTsInterface = extensionTsInterface; this.vmMailerService = vmMailerService; this.conferenceID = conferenceID; this.extension = extension; }
protected override void OnStartProcessing(TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { LoggingService.AddLogEntry(LogLevel.Extended, "(Line " + tsInterface.LineNumber + ") Executing custom script at " + customScriptLocation, false); IMLScript imlScript = new IMLScript(); ScriptPage introPage = new ScriptPage(); introPage.ID = Guid.NewGuid().ToString(); /*if (LicenseService.IsTrialLicense()) { if (Properties.Settings.Default.WelcomeGreetingDelay > 0) { Delay welcomeDelay = new Delay(); welcomeDelay.DelayTime = Properties.Settings.Default.WelcomeGreetingDelay.ToString(); introPage.Actions.Add(welcomeDelay); } introPage.Actions.Add(ScriptCompilers.ScriptUtils.CreateExternalAction(ScriptCompilers.BaseExternalCommands.CALLBUTLERINTERNAL_PlayLicenseIntroGreeting.ToString(), "")); }*/ ScriptCompilers.ScriptUtils.ProcessPersonalizedGreeting(dataProvider, ref introPage, Properties.Settings.Default.CustomerID, tsInterface.IMLInterpreter.CallerDisplayName, tsInterface.IMLInterpreter.CallerUsername, tsInterface.IMLInterpreter.CallerHost, tsInterface.IMLInterpreter.DialedUsername); GotoPage gotoPage = new GotoPage(); gotoPage.Location = customScriptLocation; introPage.Actions.Add(gotoPage); imlScript.Pages.Add(introPage); tsInterface.IMLInterpreter.StartScript(imlScript, System.IO.Path.GetDirectoryName(customScriptLocation)); }
private void SetupScriptForCall(TelecomScriptInterface tsInterface, string timeout) { string callFrom = ""; if (Properties.Settings.Default.CustomCallScreeningPrompt != null && Properties.Settings.Default.CustomCallScreeningPrompt.Length > 0) { callFrom = Properties.Settings.Default.CustomCallScreeningPrompt; } else { if (onholdTsInterface.IMLInterpreter.CallerDisplayName.Length > 0) { callFrom = WOSI.Utilities.StringUtils.FormatPhoneNumber(onholdTsInterface.IMLInterpreter.CallerDisplayName); } else if (onholdTsInterface.IMLInterpreter.CallerUsername.Length > 0) { callFrom = WOSI.Utilities.StringUtils.FormatPhoneNumber(onholdTsInterface.IMLInterpreter.CallerUsername); } else { callFrom = "An Unknown Caller."; } } tsInterface.IMLInterpreter.SetLocalVariable("CallFrom", callFrom); tsInterface.IMLInterpreter.SetLocalVariable("ExtensionTimeout", timeout); // Set our call element to autodial or not if (callScriptElement != null) { callScriptElement.RequestAutoAnswer = autoAnswer; } }
protected override void OnStartProcessing(TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { string voicemailScriptLocation = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory) + "\\Voicemail.xml"; if (File.Exists(voicemailScriptLocation)) { IMLScript imlScript = IMLScript.OpenScript(voicemailScriptLocation); // Set our script variables tsInterface.IMLInterpreter.SetLocalVariable("ExtensionID", extension.ExtensionID.ToString()); //if (Licensing.Management.AppPermissions.StatIsPermitted("Settings.MusicSettings")) //{ tsInterface.IMLInterpreter.SetLocalVariable("HoldMusicLocation", WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.HoldMusicRootDirectory)); //} /*else * { * tsInterface.IMLInterpreter.SetLocalVariable("HoldMusicLocation", ""); * }*/ tsInterface.IMLInterpreter.SetLocalVariable("VoicemailRootFolder", WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.VoicemailRootDirectory)); tsInterface.IMLInterpreter.StartScript(imlScript, WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory)); } }
private void TryContactNumber(TelecomScriptInterface tsInterface, string numberToCall, string fromCallerID, string fromCallerNumber, string callProfile, string timeout, string eventToken) { // If we get here, try the number tsInterface.IMLInterpreter.SetLocalVariable("NumberToCall", numberToCall); if (Properties.Settings.Default.CustomIncomingCallerID != null && Properties.Settings.Default.CustomIncomingCallerID.Length > 0) { tsInterface.IMLInterpreter.SetLocalVariable("FromCallerID", Properties.Settings.Default.CustomIncomingCallerID); } else { tsInterface.IMLInterpreter.SetLocalVariable("FromCallerID", fromCallerID); } if (Properties.Settings.Default.CustomIncomingCallerNumber != null && Properties.Settings.Default.CustomIncomingCallerNumber.Length > 0) { tsInterface.IMLInterpreter.SetLocalVariable("FromNumber", Properties.Settings.Default.CustomIncomingCallerNumber); } else { tsInterface.IMLInterpreter.SetLocalVariable("FromNumber", fromCallerNumber); } tsInterface.IMLInterpreter.SetLocalVariable("CallProfile", callProfile); SetupScriptForCall(tsInterface, timeout); tsInterface.IMLInterpreter.SignalEventCallback(eventToken); }
protected override void OnStartProcessing(TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { telecomProvider.EnableAnsweringMachineDetection(tsInterface.LineNumber, false); if (answeringMachineScriptLocation == null || answeringMachineScriptLocation.Length == 0) { StartScript(scriptLocation); } }
public void StartFromMainMenu(TelecomScriptInterface tsInterface) { string callFlowScriptLocation = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory) + "\\Call Flow.xml"; if (File.Exists(callFlowScriptLocation)) { IMLScript imlScript = IMLScript.OpenScript(callFlowScriptLocation); tsInterface.IMLInterpreter.StartScript(imlScript, "MainMenuPage", WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory)); } }
public override void OnIncomingTransfer(CallButler.Telecom.TelecomProviderBase telcomProvider, CallButler.Telecom.TransferEventArgs e) { if (e.ReplacementLineNumber != 0) { // Find the ts interface for the call from this extension to our remote caller TelecomScriptInterface remoteTsInterface = scriptService.TelecomScriptInterfaces[e.ReplacementLineNumber]; // Find the ts interface for the remote caller if (remoteTsInterface.ScriptProcessor is TransferConferenceScriptProcessor) { TransferConferenceScriptProcessor remoteProcessor = (TransferConferenceScriptProcessor)remoteTsInterface.ScriptProcessor; int remoteLineNumber = remoteProcessor.callerTsInterface.LineNumber; remoteProcessor.callerTsInterface = null; if (scriptService.TelecomScriptInterfaces[remoteLineNumber].ScriptProcessor is TransferConferenceScriptProcessor) { remoteTsInterface = scriptService.TelecomScriptInterfaces[remoteLineNumber]; remoteProcessor = (TransferConferenceScriptProcessor)remoteTsInterface.ScriptProcessor; // Conference the two lines together remoteProcessor.callerTsInterface = callerTsInterface; if (callerTsInterface.ScriptProcessor is TransferConferenceScriptProcessor) { ((TransferConferenceScriptProcessor)callerTsInterface.ScriptProcessor).callerTsInterface = remoteProcessor.tsInterface; } remoteProcessor.conferenceID = conferenceID; telcomProvider.AddLineToConference(conferenceID, remoteProcessor.tsInterface.LineNumber); telcomProvider.RemoveLineFromConference(tsInterface.LineNumber); // Tell the other caller to stop hold music callerTsInterface.IMLInterpreter.SignalExternalEvent(TransferConferenceExternalEvents.CALLBUTLERINTERNAL_UnholdCall.ToString()); //this.conferenceID = 0; this.callerTsInterface = null; telcomProvider.EndCall(e.ReplacementLineNumber); telcomProvider.EndCall(tsInterface.LineNumber); return; } } callerTsInterface.IMLInterpreter.SignalTransferFailure(); } else { TransferCaller(telcomProvider, e.CallingToNumber); } }
public ExtensionScriptProcessor(ScriptService scriptService, TelecomScriptInterface onholdTsInterface, WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow extension, VoicemailMailerService vmMailerService, PBXRegistrarService registrarService /*, ExtensionStateService extStateService*/, bool disableCallScreening, bool autoConnect, bool autoAnswer) { this.autoAnswer = autoAnswer; this.scriptService = scriptService; this.registrarService = registrarService; this.onholdTsInterface = onholdTsInterface; this.extension = extension; this.vmMailerService = vmMailerService; //this.extStateService = extStateService; this.disableCallScreening = disableCallScreening; this.autoConnect = autoConnect; }
public ExtensionScriptProcessor(ScriptService scriptService, TelecomScriptInterface onholdTsInterface, WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow extension, VoicemailMailerService vmMailerService, PBXRegistrarService registrarService/*, ExtensionStateService extStateService*/, bool disableCallScreening, bool autoConnect, bool autoAnswer) { this.autoAnswer = autoAnswer; this.scriptService = scriptService; this.registrarService = registrarService; this.onholdTsInterface = onholdTsInterface; this.extension = extension; this.vmMailerService = vmMailerService; //this.extStateService = extStateService; this.disableCallScreening = disableCallScreening; this.autoConnect = autoConnect; }
protected override void OnStartProcessing(TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { string scheduleReminderScriptLocation = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory) + "\\Schedule Reminder.xml"; if (File.Exists(scheduleReminderScriptLocation)) { IMLScript imlScript = IMLScript.OpenScript(scheduleReminderScriptLocation); extensionNumberIndex = -1; tsInterface.IMLInterpreter.StartScript(imlScript, WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory)); } }
protected override void OnStartProcessing(TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { string scriptLocation = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory) + "\\Transfer Conference Participant.xml"; if (File.Exists(scriptLocation)) { IMLScript imlScript = IMLScript.OpenScript(scriptLocation); tsInterface.IMLInterpreter.SetLocalVariable("HoldMusicLocation", WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.HoldMusicRootDirectory)); tsInterface.IMLInterpreter.StartScript(imlScript, WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory)); } }
protected override void OnStartProcessing(TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { string scriptLocation = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory) + "\\Receptionist Finder.xml"; if (File.Exists(scriptLocation)) { IMLScript imlScript = IMLScript.OpenScript(scriptLocation); // Set our script variables tsInterface.IMLInterpreter.SetLocalVariable("ExtensionID", extension.ExtensionID.ToString()); tsInterface.IMLInterpreter.StartScript(imlScript, WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory)); } }
public AutoDialerProcessor(Telecom.TelecomProviderBase telecomProvider, TelecomScriptInterface tsInterface, string jobID, string callID, string scriptToRun, string answeringMachineScriptToRun, string answeringMachineDetectionSettings, int timeout, System.Collections.Specialized.NameValueCollection scriptVariables, CallButler.Service.Plugin.CallButlerDialerPlugin dialerPlugin) { this.callID = callID; this.jobID = jobID; this.scriptLocation = scriptToRun; this.answeringMachineScriptLocation = answeringMachineScriptToRun; this.answeringMachineDetectionSettings = answeringMachineDetectionSettings; this.scriptVariables = scriptVariables; this.dialerPlugin = dialerPlugin; this.tsInterface = tsInterface; this.telecomProvider = telecomProvider; timeoutTimer = new System.Threading.Timer(new System.Threading.TimerCallback(TimeoutTimerProc), this, timeout * 1000, System.Threading.Timeout.Infinite); }
protected override void OnStartProcessing(TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { tsInterface.IMLInterpreter.CallerDisplayName = string.Format("Calling {0}", numberToDial); tsInterface.IMLInterpreter.CallerHost = ""; tsInterface.IMLInterpreter.CallerUsername = ""; tsInterface.IMLInterpreter.DialedHost = ""; tsInterface.IMLInterpreter.DialedUsername = ""; string click2CallScriptLocation = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory) + "\\Click2Call Handler.xml"; if (System.IO.File.Exists(click2CallScriptLocation)) { IMLScript imlScript = IMLScript.OpenScript(click2CallScriptLocation); tsInterface.IMLInterpreter.StartScript(imlScript, WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory)); } }
protected override void OnStartProcessing(TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { string scriptLocation = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory) + "\\Outbound Callee.xml"; if (File.Exists(scriptLocation)) { IMLScript imlScript = IMLScript.OpenScript(scriptLocation); tsInterface.IMLInterpreter.SetLocalVariable("HoldMusicLocation", WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.HoldMusicRootDirectory)); tsInterface.IMLInterpreter.SetLocalVariable("NumberToCall", numberToCall); tsInterface.IMLInterpreter.SetLocalVariable("FromCallerID", fromCallerID); tsInterface.IMLInterpreter.SetLocalVariable("CallProfile", ""); tsInterface.IMLInterpreter.StartScript(imlScript, WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory)); } }
protected override void OnStartProcessing(TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { IMLScript imlScript; string moduleData = addonModule.OnStartScript(new CallButler.Service.Plugin.CallButlerScriptContext(tsInterface.IMLInterpreter)); if (addonModule.ModuleReturnsScriptPath) { imlScript = IMLScript.OpenScript(moduleData); } else { imlScript = IMLScript.LoadFromXML(moduleData); } tsInterface.IMLInterpreter.StartScript(imlScript, WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory)); }
protected override void OnStartProcessing(TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { this.tsInterface = tsInterface; string scriptLocation = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory) + "\\Transfer Conference.xml"; if (File.Exists(scriptLocation)) { IMLScript imlScript = IMLScript.OpenScript(scriptLocation); tsInterface.IMLInterpreter.SetLocalVariable("HoldMusicLocation", WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.HoldMusicRootDirectory)); // Set our recording path tsInterface.IMLInterpreter.SetLocalVariable("RecordingPath", WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.CallRecordingSoundPath)); tsInterface.IMLInterpreter.SetLocalVariable("ExtensionID", extension.ExtensionID.ToString()); tsInterface.IMLInterpreter.StartScript(imlScript, WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory)); } }
protected override void OnStartProcessing(TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { tsInterface.IMLInterpreter.DefaultSpeechVoice = Properties.Settings.Default.DefaultTTSVoice; // Set our volumes telecomProvider.SetRecordVolume(tsInterface.LineNumber, Properties.Settings.Default.RecordVolume); telecomProvider.SetSoundVolume(tsInterface.LineNumber, Properties.Settings.Default.SoundVolume); telecomProvider.SetSpeechVolume(tsInterface.LineNumber, Properties.Settings.Default.SpeechVolume); string extensionFinderScriptLocation = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory) + "\\Extension Finder.xml"; if (File.Exists(extensionFinderScriptLocation)) { onholdTsInterface.IMLInterpreter.SyncExternalAction += new EventHandler <WOSI.IVR.IML.SyncExternalActionEventArgs>(IMLInterpreter_SyncExternalAction); IMLScript imlScript = IMLScript.OpenScript(extensionFinderScriptLocation); // Get our call script element ScriptElement[] callElements = imlScript.GetAllElementsOfType(typeof(Call)); if (callElements != null && callElements.Length > 0) { callScriptElement = (Call)callElements[0]; } extensionNumberIndex = -1; this.tsInterface = tsInterface; // Copy our variables tsInterface.IMLInterpreter.MergeLocalVariables(onholdTsInterface.IMLInterpreter); tsInterface.IMLInterpreter.SetLocalVariable("ExtensionTimeout", "20"); tsInterface.IMLInterpreter.StartScript(imlScript, WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory)); // Tell our extension that they have an incoming call //CallInfo callInfo = new CallInfo(tsInterface.CurrentCallID, tsInterface.LineNumber, CallStatus.Incoming, onholdTsInterface.IMLInterpreter.CallerDisplayName, onholdTsInterface.IMLInterpreter.CallerUsername); //extStateService.UpdateCallState(extension.ExtensionID, callInfo); } }
public void StartProcessing(TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { OnStartProcessing(tsInterface, telecomProvider, dataProvider); }
protected override void OnExternalCommand(string command, string commandData, string eventToken, TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { // Parse out our external event action if (Enum.IsDefined(typeof(TransferConferenceParticipantExternalCommands), command)) { TransferConferenceParticipantExternalCommands externalCommand = WOSI.Utilities.EnumUtils <TransferConferenceParticipantExternalCommands> .Parse(command); switch (externalCommand) { case TransferConferenceParticipantExternalCommands.CALLBUTLERINTERNAL_EndConference: telecomProvider.EndConference(conferenceID, true); break; case TransferConferenceParticipantExternalCommands.CALLBUTLERINTERNAL_MainMenu: break; } } tsInterface.IMLInterpreter.SignalEventCallback(eventToken); }
protected override void OnStartProcessing(TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { string scriptLocation = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory) + "\\Outbound Callee.xml"; if (File.Exists(scriptLocation)) { IMLScript imlScript = IMLScript.OpenScript(scriptLocation); tsInterface.IMLInterpreter.SetLocalVariable("HoldMusicLocation", WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.HoldMusicRootDirectory)); tsInterface.IMLInterpreter.SetLocalVariable("NumberToCall", numberToCall); tsInterface.IMLInterpreter.SetLocalVariable("FromCallerID", fromCallerID); tsInterface.IMLInterpreter.SetLocalVariable("FromCallerNumber", fromCallerNumber); tsInterface.IMLInterpreter.SetLocalVariable("CallProfile", outboundProfileName); tsInterface.IMLInterpreter.StartScript(imlScript, WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory)); } }
protected virtual void OnStartProcessing(TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { }
protected virtual void OnLinkedExternalCommand(string command, string commandData, string eventToken, TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { }
private void TryCallBlast(CallButler.Telecom.TelecomProviderBase telecomProvider, TelecomScriptInterface tsInterface, string[] numbersToCall, string[] profileNames, string fromCallerID, string fromCallerNumber, string timeout) { List<WOSI.CallButler.Data.CallButlerDataset.ProvidersRow> providers = new List<WOSI.CallButler.Data.CallButlerDataset.ProvidersRow>(); foreach (string profileName in profileNames) { providers.Add(tsInterface.FindProvider(profileName)); } if (Properties.Settings.Default.CustomIncomingCallerID != null && Properties.Settings.Default.CustomIncomingCallerID.Length > 0) { fromCallerID = Properties.Settings.Default.CustomIncomingCallerID; } if (Properties.Settings.Default.CustomIncomingCallerNumber != null && Properties.Settings.Default.CustomIncomingCallerNumber.Length > 0) { fromCallerNumber = Properties.Settings.Default.CustomIncomingCallerNumber; } telecomProvider.CallBlast(tsInterface.LineNumber, numbersToCall, fromCallerID, fromCallerNumber, providers.ToArray()); SetupScriptForCall(tsInterface, timeout); }
protected override void OnExternalCommand(string command, string commandData, string eventToken, TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { // Parse out our external event action if (Enum.IsDefined(typeof(OutboundCalleeScriptProcessor.OutboundCallExternalCommands), command)) { OutboundCalleeScriptProcessor.OutboundCallExternalCommands externalCommand = WOSI.Utilities.EnumUtils<OutboundCalleeScriptProcessor.OutboundCallExternalCommands>.Parse(command); switch (externalCommand) { case OutboundCalleeScriptProcessor.OutboundCallExternalCommands.CALLBUTLERINTERNAL_CallEnded: ProcessEndCall(telecomProvider); break; case OutboundCalleeScriptProcessor.OutboundCallExternalCommands.CALLBUTLERINTERNAL_HoldCaller: // Remove this call from the conference tsInterface.ProcessOnHold(conferenceID, true); // Tell the other caller to play hold music outboundTsInterface.IMLInterpreter.SignalExternalEvent(OutboundCalleeScriptProcessor.OutboundCallExternalCommands.CALLBUTLERINTERNAL_HoldCaller.ToString()); break; case OutboundCalleeScriptProcessor.OutboundCallExternalCommands.CALLBUTLERINTERNAL_UnholdCaller: // Add this caller back into the conference tsInterface.ProcessOnHold(conferenceID, false); // Tell the other caller to stop hold music outboundTsInterface.IMLInterpreter.SignalExternalEvent(OutboundCalleeScriptProcessor.OutboundCallExternalCommands.CALLBUTLERINTERNAL_UnholdCaller.ToString()); break; case OutboundCalleeScriptProcessor.OutboundCallExternalCommands.CALLBUTLERINTERNAL_TransferCaller: TransferCaller(telecomProvider, commandData); break; } } tsInterface.IMLInterpreter.SignalEventCallback(eventToken); }
protected override void OnExternalCommand(string command, string commandData, string eventToken, TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { // Parse out our external event action if (Enum.IsDefined(typeof(VoicemailExternalCommands), command)) { VoicemailExternalCommands externalCommand = WOSI.Utilities.EnumUtils <VoicemailExternalCommands> .Parse(command); switch (externalCommand) { case VoicemailExternalCommands.CALLBUTLERINTERNAL_AuthenticatePasscode: { // Check to make sure our passcode matches our extension string enteredPasscodeHash = WOSI.Utilities.CryptoUtils.CreateMD5Hash(commandData); if (enteredPasscodeHash != extension.Password) { tsInterface.IMLInterpreter.SignalExternalEvent(VoicemailExternalEvents.CALLBUTLERINTERNAL_InvalidPasscode.ToString()); } else { // Get our new voicemail count int newVoicemailCount = dataProvider.GetNewVoicemailCount(extension.ExtensionID); tsInterface.IMLInterpreter.SetLocalVariable("NewVoicemailCount", newVoicemailCount.ToString()); tsInterface.IMLInterpreter.SignalExternalEvent(VoicemailExternalEvents.CALLBUTLERINTERNAL_ValidPasscode.ToString()); } break; } case VoicemailExternalCommands.CALLBUTLERINTERNAL_SaveNewGreeting: { WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsRow voicemailGreeting = dataProvider.GetLocalizedGreeting(Properties.Settings.Default.CustomerID, extension.ExtensionID, Properties.Settings.Default.DefaultLanguage); string tmpGreetingFilename = commandData; if (File.Exists(tmpGreetingFilename) && voicemailGreeting != null) { // Change our voicemail greeting to a sound file voicemailGreeting.Type = (short)WOSI.CallButler.Data.GreetingType.SoundGreeting; // Move our greeting sound over string greetingDirectory = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingSoundRootDirectory) + "\\" + Properties.Settings.Default.DefaultLanguage; string greetingFilename = greetingDirectory + "\\" + voicemailGreeting.GreetingID.ToString() + ".snd"; if (!Directory.Exists(greetingDirectory)) { Directory.CreateDirectory(greetingDirectory); } File.Copy(tmpGreetingFilename, greetingFilename, true); File.Delete(tmpGreetingFilename); voicemailGreeting.Data = WOSI.Utilities.CryptoUtils.GetFileChecksum(greetingFilename); dataProvider.PersistLocalizedGreeting(Properties.Settings.Default.CustomerID, voicemailGreeting); } tsInterface.IMLInterpreter.SignalEventCallback(eventToken); break; } case VoicemailExternalCommands.CALLBUTLERINTERNAL_FetchNextVoicemail: { // Get our voicemail rows WOSI.CallButler.Data.CallButlerDataset.VoicemailsRow[] voicemails = (WOSI.CallButler.Data.CallButlerDataset.VoicemailsRow[])dataProvider.GetVoicemails(extension.ExtensionID).Select("", "Timestamp DESC"); // Get our voicemail message index int voicemailIndex = Convert.ToInt32(tsInterface.IMLInterpreter.GetLocalVariable("VoicemailIndex")); voicemailIndex++; if (voicemailIndex < voicemails.Length) { WOSI.CallButler.Data.CallButlerDataset.VoicemailsRow voicemail = voicemails[voicemailIndex]; // Create our voicemail intro string voicemailIntro = ""; if (voicemailIndex == 0) { voicemailIntro = "First "; } else { voicemailIntro = "Next "; } if (voicemail.IsNew) { voicemailIntro += "New "; } voicemailIntro += "Message received on " + voicemail.Timestamp.ToShortDateString() + " " + voicemail.Timestamp.ToShortTimeString(); tsInterface.IMLInterpreter.SetLocalVariable("VoicemailIntro", voicemailIntro); string voicemailFilename = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.VoicemailRootDirectory) + "\\" + voicemail.ExtensionID.ToString() + "\\" + voicemail.VoicemailID + ".snd"; tsInterface.IMLInterpreter.SetLocalVariable("VoicemailSound", voicemailFilename); tsInterface.IMLInterpreter.SetLocalVariable("VoicemailIndex", voicemailIndex.ToString()); // Mark the voicemail as read dataProvider.MarkVoicemailRead(voicemail.ExtensionID, voicemail.VoicemailID); if (pbxRegistrar != null) { pbxRegistrar.SendMessageWaitingNotification(voicemail.ExtensionID); } tsInterface.IMLInterpreter.SignalEventCallback(eventToken); } else { tsInterface.IMLInterpreter.SignalExternalEvent(VoicemailExternalEvents.CALLBUTLERINTERNAL_EndOfMessages.ToString()); } break; } case VoicemailExternalCommands.CALLBUTLERINTERNAL_DeleteVoicemail: { // Get our voicemail rows WOSI.CallButler.Data.CallButlerDataset.VoicemailsRow[] voicemails = (WOSI.CallButler.Data.CallButlerDataset.VoicemailsRow[])dataProvider.GetVoicemails(extension.ExtensionID).Select("", "Timestamp DESC"); // Get our voicemail message index int voicemailIndex = Convert.ToInt32(tsInterface.IMLInterpreter.GetLocalVariable("VoicemailIndex")); if (voicemailIndex < voicemails.Length) { WOSI.CallButler.Data.CallButlerDataset.VoicemailsRow voicemail = voicemails[voicemailIndex]; // Delete our voicemail dataProvider.DeleteVoicemail(voicemail.ExtensionID, voicemail.VoicemailID); // Delete our voicemail sound string voicemailFilename = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.VoicemailRootDirectory) + "\\" + voicemail.ExtensionID.ToString() + "\\" + voicemail.VoicemailID + ".snd"; if (File.Exists(voicemailFilename)) { File.Delete(voicemailFilename); } voicemailIndex--; tsInterface.IMLInterpreter.SetLocalVariable("VoicemailIndex", voicemailIndex.ToString()); if (pbxRegistrar != null) { pbxRegistrar.SendMessageWaitingNotification(voicemail.ExtensionID); } } tsInterface.IMLInterpreter.SignalEventCallback(eventToken); break; } } } }
private void SetupScriptForCall(TelecomScriptInterface tsInterface, string timeout) { string callFrom = ""; if (Properties.Settings.Default.CustomCallScreeningPrompt != null && Properties.Settings.Default.CustomCallScreeningPrompt.Length > 0) { callFrom = Properties.Settings.Default.CustomCallScreeningPrompt; } else { if (onholdTsInterface.IMLInterpreter.CallerDisplayName.Length > 0) callFrom = WOSI.Utilities.StringUtils.FormatPhoneNumber(onholdTsInterface.IMLInterpreter.CallerDisplayName); else if (onholdTsInterface.IMLInterpreter.CallerUsername.Length > 0) callFrom = WOSI.Utilities.StringUtils.FormatPhoneNumber(onholdTsInterface.IMLInterpreter.CallerUsername); else callFrom = "An Unknown Caller."; } tsInterface.IMLInterpreter.SetLocalVariable("CallFrom", callFrom); tsInterface.IMLInterpreter.SetLocalVariable("ExtensionTimeout", timeout); // Set our call element to autodial or not if (callScriptElement != null) { callScriptElement.RequestAutoAnswer = autoAnswer; } }
protected override void OnExternalCommand(string command, string commandData, string eventToken, TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { // Parse out our external event action if (callerTsInterface != null && Enum.IsDefined(typeof(TransferConferenceExternalCommands), command)) { TransferConferenceExternalCommands externalCommand = WOSI.Utilities.EnumUtils<TransferConferenceExternalCommands>.Parse(command); switch (externalCommand) { case TransferConferenceExternalCommands.CALLBUTLERINTERNAL_EndConference: telecomProvider.EndConference(conferenceID, true); break; case TransferConferenceExternalCommands.CALLBUTLERINTERNAL_RecordingStarted: // Notify the other caller that recording has started callerTsInterface.IMLInterpreter.SignalExternalEvent(TransferConferenceExternalEvents.CALLBUTLERINTERNAL_RecordingStarted.ToString()); break; case TransferConferenceExternalCommands.CALLBUTLERINTERNAL_RecordingFinished: // Notify the other caller that recording has finished callerTsInterface.IMLInterpreter.SignalExternalEvent(TransferConferenceExternalEvents.CALLBUTLERINTERNAL_RecordingFinished.ToString()); vmMailerService.QueueVoicemailEmail(extension, "Your Call Recording", "Call Recording", tsInterface.IMLInterpreter.GetLocalVariable("RecordingFilename")); break; case TransferConferenceExternalCommands.CALLBUTLERINTERNAL_TransferCaller: TransferCaller(telecomProvider, commandData); break; case TransferConferenceExternalCommands.CALLBUTLERINTERNAL_HoldCaller: // Remove this call from the conference tsInterface.ProcessOnHold(conferenceID, true); // Tell the other caller to play hold music callerTsInterface.IMLInterpreter.SignalExternalEvent(TransferConferenceExternalEvents.CALLBUTLERINTERNAL_HoldCall.ToString()); break; case TransferConferenceExternalCommands.CALLBUTLERINTERNAL_UnholdCaller: // Add this caller back into the conference tsInterface.ProcessOnHold(conferenceID, false); // Tell the other caller to stop hold music callerTsInterface.IMLInterpreter.SignalExternalEvent(TransferConferenceExternalEvents.CALLBUTLERINTERNAL_UnholdCall.ToString()); break; } } tsInterface.IMLInterpreter.SignalEventCallback(eventToken); }
protected override void OnExternalCommand(string command, string commandData, string eventToken, TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { // Parse out our external event action if (callerTsInterface != null && Enum.IsDefined(typeof(TransferConferenceExternalCommands), command)) { TransferConferenceExternalCommands externalCommand = WOSI.Utilities.EnumUtils <TransferConferenceExternalCommands> .Parse(command); switch (externalCommand) { case TransferConferenceExternalCommands.CALLBUTLERINTERNAL_EndConference: telecomProvider.EndConference(conferenceID, true); break; case TransferConferenceExternalCommands.CALLBUTLERINTERNAL_RecordingStarted: // Notify the other caller that recording has started callerTsInterface.IMLInterpreter.SignalExternalEvent(TransferConferenceExternalEvents.CALLBUTLERINTERNAL_RecordingStarted.ToString()); break; case TransferConferenceExternalCommands.CALLBUTLERINTERNAL_RecordingFinished: // Notify the other caller that recording has finished callerTsInterface.IMLInterpreter.SignalExternalEvent(TransferConferenceExternalEvents.CALLBUTLERINTERNAL_RecordingFinished.ToString()); vmMailerService.QueueVoicemailEmail(extension, "Your Call Recording", "Call Recording", tsInterface.IMLInterpreter.GetLocalVariable("RecordingFilename")); break; case TransferConferenceExternalCommands.CALLBUTLERINTERNAL_TransferCaller: TransferCaller(telecomProvider, commandData); break; case TransferConferenceExternalCommands.CALLBUTLERINTERNAL_HoldCaller: // Remove this call from the conference tsInterface.ProcessOnHold(conferenceID, true); // Tell the other caller to play hold music callerTsInterface.IMLInterpreter.SignalExternalEvent(TransferConferenceExternalEvents.CALLBUTLERINTERNAL_HoldCall.ToString()); break; case TransferConferenceExternalCommands.CALLBUTLERINTERNAL_UnholdCaller: // Add this caller back into the conference tsInterface.ProcessOnHold(conferenceID, false); // Tell the other caller to stop hold music callerTsInterface.IMLInterpreter.SignalExternalEvent(TransferConferenceExternalEvents.CALLBUTLERINTERNAL_UnholdCall.ToString()); break; } } tsInterface.IMLInterpreter.SignalEventCallback(eventToken); }
protected override void OnExternalCommand(string command, string commandData, string eventToken, TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { // Parse out our external event action if (Enum.IsDefined(typeof(StandardExternalCommands), command)) { StandardExternalCommands externalCommand = WOSI.Utilities.EnumUtils <StandardExternalCommands> .Parse(command); switch (externalCommand) { case StandardExternalCommands.CALLBUTLERINTERNAL_ChooseLanguage: { if (!Properties.Settings.Default.Multilingual) { tsInterface.IMLInterpreter.SignalExternalEvent(StandardExternalEvents.CALLBUTLERINTERNAL_NotMultilingual.ToString()); } else { tsInterface.IMLInterpreter.SignalEventCallback(eventToken); } break; } case StandardExternalCommands.CALLBUTLERINTERNAL_SetLanguageID: { List <string> languages = new List <string>(); languages.Add(Properties.Settings.Default.DefaultLanguage); languages.AddRange(Properties.Settings.Default.Languages.Split(';')); int languageNumber = Convert.ToInt32(commandData); if (languageNumber > 0 && languageNumber <= languages.Count) { // Set our language ID variable tsInterface.IMLInterpreter.SetLocalVariable("LanguageID", languages[languageNumber - 1]); tsInterface.IMLInterpreter.SignalEventCallback(eventToken); } else { tsInterface.IMLInterpreter.SignalExternalEvent(StandardExternalEvents.CALLBUTLERINTERNAL_InvalidLanguage.ToString()); } break; } case StandardExternalCommands.CALLBUTLERINTERNAL_ProcessMainMenuOption: { WOSI.CallButler.Data.CallButlerDataset.DepartmentsDataTable departments = dataProvider.GetDepartments(Properties.Settings.Default.CustomerID); WOSI.CallButler.Data.CallButlerDataset.DepartmentsRow[] choosenDepartments = (WOSI.CallButler.Data.CallButlerDataset.DepartmentsRow[])departments.Select("OptionNumber = " + commandData); if (choosenDepartments.Length > 0) { WOSI.CallButler.Data.CallButlerDataset.DepartmentsRow choosenDepartment = choosenDepartments[0]; switch (choosenDepartment.Type) { case (short)WOSI.CallButler.Data.DepartmentTypes.Greeting: tsInterface.IMLInterpreter.SetLocalVariable("MainMenuOptionGreetingID", choosenDepartment.DepartmentID.ToString()); tsInterface.IMLInterpreter.SignalExternalEvent(StandardExternalEvents.CALLBUTLERINTERNAL_GreetingMenuOption.ToString()); break; case (short)WOSI.CallButler.Data.DepartmentTypes.Extension: // Find our extension number try { WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow extension = dataProvider.GetExtension(Properties.Settings.Default.CustomerID, new Guid(choosenDepartment.Data1)); if (extension != null) { tsInterface.IMLInterpreter.SetLocalVariable("Extension", extension.ExtensionNumber.ToString()); } } catch { } tsInterface.IMLInterpreter.SignalExternalEvent(StandardExternalEvents.CALLBUTLERINTERNAL_ExtensionMenuOption.ToString()); break; case (short)WOSI.CallButler.Data.DepartmentTypes.Script: tsInterface.IMLInterpreter.SetLocalVariable("CustomScriptPath", choosenDepartment.Data1); tsInterface.IMLInterpreter.SignalExternalEvent(StandardExternalEvents.CALLBUTLERINTERNAL_ScriptMenuOption.ToString()); break; case (short)WOSI.CallButler.Data.DepartmentTypes.Number: tsInterface.IMLInterpreter.SetLocalVariable("TransferToNumber", choosenDepartment.Data1); tsInterface.IMLInterpreter.SignalExternalEvent(StandardExternalEvents.CALLBUTLERINTERNAL_NumberTransferMenuOption.ToString()); break; case (short)WOSI.CallButler.Data.DepartmentTypes.Module: tsInterface.IMLInterpreter.SetLocalVariable("AddonModuleID", choosenDepartment.Data1); tsInterface.IMLInterpreter.SignalExternalEvent(StandardExternalEvents.CALLBUTLERINTERNAL_AddonModuleMenuOption.ToString()); break; } } else { tsInterface.IMLInterpreter.SignalExternalEvent(StandardExternalEvents.CALLBUTLERINTERNAL_InvalidMenuOption.ToString()); } break; } case StandardExternalCommands.CALLBUTLERINTERNAL_DialByNameSearch: // Find our extensions for this search string WOSI.CallButler.Data.CallButlerDataset.ExtensionsDataTable extensions = dataProvider.GetExtensions(Properties.Settings.Default.CustomerID); WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow[] matchingExtensions = (WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow[])extensions.Select("SearchNumber LIKE '" + commandData + "*' AND EnableSearch = True"); // Get our extension search index int searchIndex = Convert.ToInt32(tsInterface.IMLInterpreter.GetLocalVariable("ExtensionSearchIndex")); searchIndex++; if (matchingExtensions.Length > 0 && searchIndex < matchingExtensions.Length) { tsInterface.IMLInterpreter.SetLocalVariable("Extension", matchingExtensions[searchIndex].ExtensionNumber.ToString()); tsInterface.IMLInterpreter.SetLocalVariable("ExtensionName", matchingExtensions[searchIndex].FirstName + " " + matchingExtensions[searchIndex].LastName); tsInterface.IMLInterpreter.SetLocalVariable("ExtensionSearchIndex", searchIndex.ToString()); } else { tsInterface.IMLInterpreter.SignalExternalEvent(StandardExternalEvents.CALLBUTLERINTERNAL_ExtensionNotFound.ToString()); } tsInterface.IMLInterpreter.SignalEventCallback(eventToken); break; case StandardExternalCommands.CALLBUTLERINTERNAL_VoicemailManagement: { try { WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow extension = dataProvider.GetExtensionNumber(Properties.Settings.Default.CustomerID, Convert.ToInt32(tsInterface.IMLInterpreter.GetLocalVariable("Extension"))); if (extension != null) { tsInterface.ScriptProcessor = new VoicemailManagementScriptProcessor(extension, pbxRegistrar); tsInterface.ScriptProcessor.StartProcessing(tsInterface, telecomProvider, dataProvider); break; } } catch { } tsInterface.IMLInterpreter.SignalTransferFailure(); break; } /*case StandardExternalCommands.CALLBUTLERINTERNAL_StartAddonModule: * { * CallButler.Service.Plugin.CallButlerAddonModulePlugin[] addonModules = pluginManager.GetAllPluginsOfType<CallButler.Service.Plugin.CallButlerAddonModulePlugin>(); * * foreach (CallButler.Service.Plugin.CallButlerAddonModulePlugin addonModule in addonModules) * { * if (addonModule.PluginID.ToString() == commandData) * { * try * { * // Make sure the module is licensed * if (!addonModule.IsLicensed) * break; * * // We found our module and we should load the script it uses * tsInterface.ScriptProcessor = new AddonModuleScriptProcessor(addonModule); * tsInterface.ScriptProcessor.StartProcessing(tsInterface, telecomProvider, dataProvider); * return; * * } * catch (Exception e) * { * LoggingService.AddLogEntry(WOSI.CallButler.ManagementInterface.LogLevel.ErrorsOnly, "Failed to load Addon-Module '" + addonModule.PluginName + "'\r\n\r\n" + e.Message + "\r\n\r\n" + e.StackTrace, true); * } * } * } * * tsInterface.ScriptProcessor = this; * tsInterface.IMLInterpreter.SignalExternalEvent(StandardExternalEvents.CALLBUTLERINTERNAL_AddonModuleFailed.ToString()); * * break; * }*/ } } }
protected override void OnLinkedExternalCommand(string command, string commandData, string eventToken, TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { // Parse out our external event action if (Enum.IsDefined(typeof(OutboundCalleeScriptProcessor.OutboundCallExternalCommands), command)) { OutboundCalleeScriptProcessor.OutboundCallExternalCommands externalCommand = WOSI.Utilities.EnumUtils<OutboundCalleeScriptProcessor.OutboundCallExternalCommands>.Parse(command); switch (externalCommand) { case OutboundCalleeScriptProcessor.OutboundCallExternalCommands.CALLBUTLERINTERNAL_CallFailed: { this.thisTsInterface.IMLInterpreter.SignalCallFailure(); break; } case OutboundCalleeScriptProcessor.OutboundCallExternalCommands.CALLBUTLERINTERNAL_CallConnected: { // Conference the two callers conferenceID = telecomProvider.ConferenceLines(this.thisTsInterface.LineNumber, tsInterface.LineNumber); this.thisTsInterface.IMLInterpreter.SignalExternalEvent(OutboundCallExternalEvents.CALLBUTLERINTERNAL_ConferenceStarted.ToString()); break; } case OutboundCalleeScriptProcessor.OutboundCallExternalCommands.CALLBUTLERINTERNAL_CallEnded: { ProcessEndCall(telecomProvider); break; } } } //tsInterface.IMLInterpreter.SignalEventCallback(eventToken); }
protected override void OnExternalCommand(string command, string commandData, string eventToken, TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { // Parse out our external event action if (Enum.IsDefined(typeof(OutboundCallExternalCommands), command)) { OutboundCallExternalCommands externalCommand = WOSI.Utilities.EnumUtils<OutboundCallExternalCommands>.Parse(command); switch (externalCommand) { case OutboundCallExternalCommands.CALLBUTLERINTERNAL_Reset: { tsInterface.Locked = false; break; } } } tsInterface.IMLInterpreter.SignalEventCallback(eventToken); }
protected override void OnStartProcessing(TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { string scriptLocation = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory) + "\\Outbound Call.xml"; if (File.Exists(scriptLocation)) { IMLScript imlScript = IMLScript.OpenScript(scriptLocation); tsInterface.IMLInterpreter.SetLocalVariable("HoldMusicLocation", WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.HoldMusicRootDirectory)); tsInterface.IMLInterpreter.StartScript(imlScript, WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory)); WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow extension = dataProvider.GetExtensionNumber(Properties.Settings.Default.CustomerID, outboundExtensionNumber); // If the outbound ts interface is null, then this means we don't have any available lines to make outbound calls. // Also check to see if this extension is allowed to make outbound calls if (outboundTsInterface == null || (outboundExtensionNumber >=0 && extension != null && !extension.EnableOutboundCalls)) { tsInterface.IMLInterpreter.SignalCallFailure(); outboundTsInterface.Locked = false; } else { // Link to our outbound script processor and start it outboundTsInterface.ScriptProcessor.LinkScriptProcessor(this); outboundTsInterface.ScriptProcessor.StartProcessing(outboundTsInterface, telecomProvider, dataProvider); } } }
public OutboundScriptProcessor(TelecomScriptInterface tsInterface, TelecomScriptInterface outboundTsInterface, int outboundExtensionNumber) { this.thisTsInterface = tsInterface; this.outboundTsInterface = outboundTsInterface; this.outboundExtensionNumber = outboundExtensionNumber; }
public void ProcessExternalCommand(string command, string commandData, string eventToken, TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider, Utilities.PluginManagement.PluginManager pluginManager, PBXRegistrarService pbxRegistrar) { // Parse out our external event action if (Enum.IsDefined(typeof(BaseExternalCommands), command)) { BaseExternalCommands externalCommand = WOSI.Utilities.EnumUtils <BaseExternalCommands> .Parse(command); string languageID = "en"; switch (externalCommand) { case BaseExternalCommands.CALLBUTLERINTERNAL_StartAddonModule: CallButler.Service.Plugin.CallButlerAddonModulePlugin[] addonModules = pluginManager.GetAllPluginsOfType <CallButler.Service.Plugin.CallButlerAddonModulePlugin>(); foreach (CallButler.Service.Plugin.CallButlerAddonModulePlugin addonModule in addonModules) { if (addonModule.PluginID.ToString() == commandData) { try { // Make sure the module is licensed if (!addonModule.IsLicensed) { break; } // We found our module and we should load the script it uses tsInterface.ScriptProcessor = new AddonModuleScriptProcessor(addonModule); tsInterface.ScriptProcessor.StartProcessing(tsInterface, telecomProvider, dataProvider); return; } catch (Exception e) { LoggingService.AddLogEntry(WOSI.CallButler.ManagementInterface.LogLevel.ErrorsOnly, "Failed to load Addon-Module '" + addonModule.PluginName + "'\r\n\r\n" + e.Message + "\r\n\r\n" + e.StackTrace, true); } } } break; case BaseExternalCommands.CALLBUTLERINTERNAL_ReturnToCallFlowMainMenu: // Return to the Call flow main menu. tsInterface.ScriptProcessor = new StandardScriptProcessor(pluginManager, pbxRegistrar); ((StandardScriptProcessor)tsInterface.ScriptProcessor).StartFromMainMenu(tsInterface); break; case BaseExternalCommands.CALLBUTLERINTERNAL_PlayLicenseIntroGreeting: // If the line isn't in use, don't do anything if (!telecomProvider.IsLineInUse(tsInterface.LineNumber)) { tsInterface.IMLInterpreter.SignalEventCallback(eventToken); break; } // Read our intro sound bytes byte[] introSoundBytes = null; if (telecomProvider.AudioInputRate == 8000) { introSoundBytes = new byte[Properties.Resources.powered_by_8khz.Length]; Properties.Resources.powered_by_8khz.Read(introSoundBytes, 0, introSoundBytes.Length); } else if (telecomProvider.AudioInputRate == 16000) { introSoundBytes = new byte[Properties.Resources.powered_by_16khz.Length]; Properties.Resources.powered_by_16khz.Read(introSoundBytes, 0, introSoundBytes.Length); } // Play our license intro sound if (introSoundBytes != null) { telecomProvider.PlaySound(tsInterface.LineNumber, introSoundBytes); } break; case BaseExternalCommands.CALLBUTLERINTERNAL_PlaySystemSound: // If the line isn't in use, don't do anything if (!telecomProvider.IsLineInUse(tsInterface.LineNumber)) { tsInterface.IMLInterpreter.SignalEventCallback(eventToken); break; } // Get the sound with the current language languageID = tsInterface.IMLInterpreter.GetLocalVariable("LanguageID"); string soundFilename = GetSoundFileForLanguage(languageID, commandData); if (soundFilename == null) { // If we don't get a sound with the current language, try the default language soundFilename = GetSoundFileForLanguage(Properties.Settings.Default.DefaultLanguage, commandData); if (soundFilename == null) { // If we don't get a sound file with the default language, try english soundFilename = GetSoundFileForLanguage("en", commandData); if (soundFilename == null) { if (!File.Exists(soundFilename)) { // If the sound still doesn't exist, tell the IML interpreter to move on tsInterface.IMLInterpreter.SignalEventCallback(eventToken); break; } } } } // If we get here, our system sound should exist and we should play it. if (string.Compare(commandData, "ring.snd", true) == 0) { telecomProvider.PlaySound(tsInterface.LineNumber, soundFilename, true); } else { telecomProvider.PlaySound(tsInterface.LineNumber, soundFilename, false); } LoggingService.AddLogEntry(LogLevel.Extended, "(Line " + tsInterface.LineNumber + ") Playing sound at " + soundFilename, false); break; case BaseExternalCommands.CALLBUTLERINTERNAL_PlayGreeting: // If the line isn't in use, don't do anything if (!telecomProvider.IsLineInUse(tsInterface.LineNumber)) { tsInterface.IMLInterpreter.SignalEventCallback(eventToken); break; } // Get our current language languageID = tsInterface.IMLInterpreter.GetLocalVariable("LanguageID"); // Create our greetingID Guid greetingID = new Guid(commandData); // Get the greeting in our selected language WOSI.CallButler.Data.CallButlerDataset.GreetingsRow greeting = dataProvider.GetGreeting(Properties.Settings.Default.CustomerID, greetingID); if (greeting != null) { // Get the greeting for our specified language WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsRow localizedGreeting = dataProvider.GetLocalizedGreeting(Properties.Settings.Default.CustomerID, greetingID, languageID); if (localizedGreeting == null) { // If the greeting doesn't exist in the current language, try using the default language localizedGreeting = dataProvider.GetLocalizedGreeting(Properties.Settings.Default.CustomerID, greetingID, Properties.Settings.Default.DefaultLanguage); if (localizedGreeting == null) { // If the greeting doesn't exist in the default language, heck just return the first one that exists WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsRow[] localizedGreetings = greeting.GetLocalizedGreetingsRows(); if (localizedGreetings.Length > 0) { localizedGreeting = localizedGreetings[0]; } } } if (localizedGreeting != null) { // Determine how we should play this greeting WOSI.CallButler.Data.GreetingType greetingType = (WOSI.CallButler.Data.GreetingType)localizedGreeting.Type; switch (greetingType) { case WOSI.CallButler.Data.GreetingType.SoundGreeting: // Create our sound file path string soundFilePath = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingSoundRootDirectory) + "\\" + localizedGreeting.LanguageID + "\\" + greetingID.ToString() + ".snd"; if (File.Exists(soundFilePath)) { telecomProvider.PlaySound(tsInterface.LineNumber, soundFilePath, false); LoggingService.AddLogEntry(LogLevel.Extended, "(Line " + tsInterface.LineNumber + ") Playing sound at " + soundFilePath, false); } else { tsInterface.IMLInterpreter.SignalEventCallback(eventToken); } break; case WOSI.CallButler.Data.GreetingType.TextGreeting: // Speak our text string textToSpeak = tsInterface.IMLInterpreter.ParseVariableTokens(localizedGreeting.Data); // Take out any XML if (!WOSI.Utilities.StringUtils.IsWellFormedXml(textToSpeak)) { textToSpeak = WOSI.Utilities.StringUtils.XmlEncodeString(textToSpeak); } if (textToSpeak.Length > 0) { if (!localizedGreeting.IsVoiceNull() && localizedGreeting.Voice.Length > 0) { textToSpeak = "<voice required=\"Name=" + localizedGreeting.Voice + "\">" + textToSpeak + "</voice>"; } else if (Properties.Settings.Default.DefaultTTSVoice != null && Properties.Settings.Default.DefaultTTSVoice.Length > 0) { textToSpeak = "<voice required=\"Name=" + Properties.Settings.Default.DefaultTTSVoice + "\">" + textToSpeak + "</voice>"; } telecomProvider.SpeakText(tsInterface.LineNumber, textToSpeak); LoggingService.AddLogEntry(LogLevel.Extended, "(Line " + tsInterface.LineNumber + ") Speaking '" + textToSpeak + "'", false); } else { tsInterface.IMLInterpreter.SignalEventCallback(eventToken); } break; } } else { // If no greeting is found in the right language, tell the interpreter to move on tsInterface.IMLInterpreter.SignalEventCallback(eventToken); } } // If the greeting isn't found, tell the interpreter to go on else { tsInterface.IMLInterpreter.SignalEventCallback(eventToken); } break; } } else { OnExternalCommand(command, commandData, eventToken, tsInterface, telecomProvider, dataProvider); if (linkedScriptProcessor != null) { linkedScriptProcessor.OnLinkedExternalCommand(command, commandData, eventToken, tsInterface, telecomProvider, dataProvider); } } }
protected override void OnStartProcessing(TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { tsInterface.IMLInterpreter.DefaultSpeechVoice = Properties.Settings.Default.DefaultTTSVoice; // Set our volumes telecomProvider.SetRecordVolume(tsInterface.LineNumber, Properties.Settings.Default.RecordVolume); telecomProvider.SetSoundVolume(tsInterface.LineNumber, Properties.Settings.Default.SoundVolume); telecomProvider.SetSpeechVolume(tsInterface.LineNumber, Properties.Settings.Default.SpeechVolume); string extensionFinderScriptLocation = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory) + "\\Extension Finder.xml"; if (File.Exists(extensionFinderScriptLocation)) { onholdTsInterface.IMLInterpreter.SyncExternalAction += new EventHandler<WOSI.IVR.IML.SyncExternalActionEventArgs>(IMLInterpreter_SyncExternalAction); IMLScript imlScript = IMLScript.OpenScript(extensionFinderScriptLocation); // Get our call script element ScriptElement[] callElements = imlScript.GetAllElementsOfType(typeof(Call)); if (callElements != null && callElements.Length > 0) { callScriptElement = (Call)callElements[0]; } extensionNumberIndex = -1; this.tsInterface = tsInterface; // Copy our variables tsInterface.IMLInterpreter.MergeLocalVariables(onholdTsInterface.IMLInterpreter); tsInterface.IMLInterpreter.SetLocalVariable("ExtensionTimeout", "20"); tsInterface.IMLInterpreter.StartScript(imlScript, WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory)); // Tell our extension that they have an incoming call //CallInfo callInfo = new CallInfo(tsInterface.CurrentCallID, tsInterface.LineNumber, CallStatus.Incoming, onholdTsInterface.IMLInterpreter.CallerDisplayName, onholdTsInterface.IMLInterpreter.CallerUsername); //extStateService.UpdateCallState(extension.ExtensionID, callInfo); } }
protected override void OnExternalCommand(string command, string commandData, string eventToken, TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { // Parse out our external event action if (Enum.IsDefined(typeof(ReceptionistFinderExternalCommands), command)) { ReceptionistFinderExternalCommands externalCommand = WOSI.Utilities.EnumUtils<ReceptionistFinderExternalCommands>.Parse(command); switch (externalCommand) { case ReceptionistFinderExternalCommands.CALLBUTLERINTERNAL_SendToAutoAttendant: { scriptService.ProcessAutoAttendantAnswer(tsInterface.LineNumber, tsInterface, false); break; } case ReceptionistFinderExternalCommands.CALLBUTLERINTERNAL_AnswerCall: { if (telecomProvider.IsLineInUse(tsInterface.LineNumber)) { if (tsInterface.Extension != null) telecomProvider.AnswerCall(tsInterface.LineNumber, true); else telecomProvider.AnswerCall(tsInterface.LineNumber, false); } break; } } } }
protected override void OnExternalCommand(string command, string commandData, string eventToken, TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { // Parse out our external event action if (Enum.IsDefined(typeof(VoicemailExternalCommands), command)) { VoicemailExternalCommands externalCommand = WOSI.Utilities.EnumUtils <VoicemailExternalCommands> .Parse(command); switch (externalCommand) { case VoicemailExternalCommands.CALLBUTLERINTERNAL_NewVoicemail: { // Create a new voicemail record vmService.CreateVoicemail(new Guid(commandData), new Guid(tsInterface.IMLInterpreter.GetLocalVariable("ExtensionID")), tsInterface.IMLInterpreter.CallerDisplayName, tsInterface.IMLInterpreter.CallerHost, tsInterface.IMLInterpreter.CallerUsername); break; } case VoicemailExternalCommands.CALLBUTLERINTERNAL_VoicemailManagement: { tsInterface.ScriptProcessor = new VoicemailManagementScriptProcessor(extension, registrarService); tsInterface.ScriptProcessor.StartProcessing(tsInterface, telecomProvider, dataProvider); break; } } tsInterface.IMLInterpreter.SignalEventCallback(eventToken); } }
protected override void OnStartProcessing(TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { string callFlowScriptLocation = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory) + "\\Call Flow.xml"; IMLScript imlScript = new IMLScript(); ScriptPage introPage = new ScriptPage(); introPage.ID = Guid.NewGuid().ToString(); if (Properties.Settings.Default.WelcomeGreetingDelay > 0) { Delay welcomeDelay = new Delay(); welcomeDelay.DelayTime = Properties.Settings.Default.WelcomeGreetingDelay.ToString(); introPage.Actions.Add(welcomeDelay); } /*if (LicenseService.IsTrialLicense()) { introPage.Actions.Add(ScriptCompilers.ScriptUtils.CreateExternalAction(ScriptCompilers.BaseExternalCommands.CALLBUTLERINTERNAL_PlayLicenseIntroGreeting.ToString(), "")); }*/ ScriptCompilers.ScriptUtils.ProcessPersonalizedGreeting(dataProvider, ref introPage, Properties.Settings.Default.CustomerID, tsInterface.IMLInterpreter.CallerDisplayName, tsInterface.IMLInterpreter.CallerUsername, tsInterface.IMLInterpreter.CallerHost, tsInterface.IMLInterpreter.DialedUsername); if (File.Exists(callFlowScriptLocation)) { GotoPage gotoPage = new GotoPage(); gotoPage.Location = callFlowScriptLocation; introPage.Actions.Add(gotoPage); imlScript.Pages.Add(introPage); } tsInterface.IMLInterpreter.StartScript(imlScript, WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory)); }
public void ProcessExternalCommand(string command, string commandData, string eventToken, TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider, Utilities.PluginManagement.PluginManager pluginManager, PBXRegistrarService pbxRegistrar) { // Parse out our external event action if (Enum.IsDefined(typeof(BaseExternalCommands), command)) { BaseExternalCommands externalCommand = WOSI.Utilities.EnumUtils<BaseExternalCommands>.Parse(command); string languageID = "en"; switch (externalCommand) { case BaseExternalCommands.CALLBUTLERINTERNAL_StartAddonModule: CallButler.Service.Plugin.CallButlerAddonModulePlugin[] addonModules = pluginManager.GetAllPluginsOfType<CallButler.Service.Plugin.CallButlerAddonModulePlugin>(); foreach (CallButler.Service.Plugin.CallButlerAddonModulePlugin addonModule in addonModules) { if (addonModule.PluginID.ToString() == commandData) { try { // Make sure the module is licensed if (!addonModule.IsLicensed) break; // We found our module and we should load the script it uses tsInterface.ScriptProcessor = new AddonModuleScriptProcessor(addonModule); tsInterface.ScriptProcessor.StartProcessing(tsInterface, telecomProvider, dataProvider); return; } catch (Exception e) { LoggingService.AddLogEntry(WOSI.CallButler.ManagementInterface.LogLevel.ErrorsOnly, "Failed to load Addon-Module '" + addonModule.PluginName + "'\r\n\r\n" + e.Message + "\r\n\r\n" + e.StackTrace, true); } } } break; case BaseExternalCommands.CALLBUTLERINTERNAL_ReturnToCallFlowMainMenu: // Return to the Call flow main menu. tsInterface.ScriptProcessor = new StandardScriptProcessor(pluginManager, pbxRegistrar); ((StandardScriptProcessor)tsInterface.ScriptProcessor).StartFromMainMenu(tsInterface); break; case BaseExternalCommands.CALLBUTLERINTERNAL_PlayLicenseIntroGreeting: // If the line isn't in use, don't do anything if (!telecomProvider.IsLineInUse(tsInterface.LineNumber)) { tsInterface.IMLInterpreter.SignalEventCallback(eventToken); break; } // Read our intro sound bytes byte[] introSoundBytes = null; if (telecomProvider.AudioInputRate == 8000) { introSoundBytes = new byte[Properties.Resources.powered_by_8khz.Length]; Properties.Resources.powered_by_8khz.Read(introSoundBytes, 0, introSoundBytes.Length); } else if (telecomProvider.AudioInputRate == 16000) { introSoundBytes = new byte[Properties.Resources.powered_by_16khz.Length]; Properties.Resources.powered_by_16khz.Read(introSoundBytes, 0, introSoundBytes.Length); } // Play our license intro sound if (introSoundBytes != null) { telecomProvider.PlaySound(tsInterface.LineNumber, introSoundBytes); } break; case BaseExternalCommands.CALLBUTLERINTERNAL_PlaySystemSound: // If the line isn't in use, don't do anything if (!telecomProvider.IsLineInUse(tsInterface.LineNumber)) { tsInterface.IMLInterpreter.SignalEventCallback(eventToken); break; } // Get the sound with the current language languageID = tsInterface.IMLInterpreter.GetLocalVariable("LanguageID"); string soundFilename = GetSoundFileForLanguage(languageID, commandData); if (soundFilename == null) { // If we don't get a sound with the current language, try the default language soundFilename = GetSoundFileForLanguage(Properties.Settings.Default.DefaultLanguage, commandData); if (soundFilename == null) { // If we don't get a sound file with the default language, try english soundFilename = GetSoundFileForLanguage("en", commandData); if (soundFilename == null) { if (!File.Exists(soundFilename)) { // If the sound still doesn't exist, tell the IML interpreter to move on tsInterface.IMLInterpreter.SignalEventCallback(eventToken); break; } } } } // If we get here, our system sound should exist and we should play it. if(string.Compare(commandData, "ring.snd", true) == 0) telecomProvider.PlaySound(tsInterface.LineNumber, soundFilename, true); else telecomProvider.PlaySound(tsInterface.LineNumber, soundFilename, false); LoggingService.AddLogEntry(LogLevel.Extended, "(Line " + tsInterface.LineNumber + ") Playing sound at " + soundFilename, false); break; case BaseExternalCommands.CALLBUTLERINTERNAL_PlayGreeting: // If the line isn't in use, don't do anything if (!telecomProvider.IsLineInUse(tsInterface.LineNumber)) { tsInterface.IMLInterpreter.SignalEventCallback(eventToken); break; } // Get our current language languageID = tsInterface.IMLInterpreter.GetLocalVariable("LanguageID"); // Create our greetingID Guid greetingID = new Guid(commandData); // Get the greeting in our selected language WOSI.CallButler.Data.CallButlerDataset.GreetingsRow greeting = dataProvider.GetGreeting(Properties.Settings.Default.CustomerID, greetingID); if (greeting != null) { // Get the greeting for our specified language WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsRow localizedGreeting = dataProvider.GetLocalizedGreeting(Properties.Settings.Default.CustomerID, greetingID, languageID); if (localizedGreeting == null) { // If the greeting doesn't exist in the current language, try using the default language localizedGreeting = dataProvider.GetLocalizedGreeting(Properties.Settings.Default.CustomerID, greetingID, Properties.Settings.Default.DefaultLanguage); if (localizedGreeting == null) { // If the greeting doesn't exist in the default language, heck just return the first one that exists WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsRow[] localizedGreetings = greeting.GetLocalizedGreetingsRows(); if (localizedGreetings.Length > 0) localizedGreeting = localizedGreetings[0]; } } if (localizedGreeting != null) { // Determine how we should play this greeting WOSI.CallButler.Data.GreetingType greetingType = (WOSI.CallButler.Data.GreetingType)localizedGreeting.Type; switch (greetingType) { case WOSI.CallButler.Data.GreetingType.SoundGreeting: // Create our sound file path string soundFilePath = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingSoundRootDirectory) + "\\" + localizedGreeting.LanguageID + "\\" + greetingID.ToString() + ".snd"; if (File.Exists(soundFilePath)) { telecomProvider.PlaySound(tsInterface.LineNumber, soundFilePath, false); LoggingService.AddLogEntry(LogLevel.Extended, "(Line " + tsInterface.LineNumber + ") Playing sound at " + soundFilePath, false); } else tsInterface.IMLInterpreter.SignalEventCallback(eventToken); break; case WOSI.CallButler.Data.GreetingType.TextGreeting: // Speak our text string textToSpeak = tsInterface.IMLInterpreter.ParseVariableTokens(localizedGreeting.Data); // Take out any XML if (!WOSI.Utilities.StringUtils.IsWellFormedXml(textToSpeak)) textToSpeak = WOSI.Utilities.StringUtils.XmlEncodeString(textToSpeak); if (textToSpeak.Length > 0) { if (!localizedGreeting.IsVoiceNull() && localizedGreeting.Voice.Length > 0) textToSpeak = "<voice required=\"Name=" + localizedGreeting.Voice + "\">" + textToSpeak + "</voice>"; else if(Properties.Settings.Default.DefaultTTSVoice != null && Properties.Settings.Default.DefaultTTSVoice.Length > 0) textToSpeak = "<voice required=\"Name=" + Properties.Settings.Default.DefaultTTSVoice + "\">" + textToSpeak + "</voice>"; telecomProvider.SpeakText(tsInterface.LineNumber, textToSpeak); LoggingService.AddLogEntry(LogLevel.Extended, "(Line " + tsInterface.LineNumber + ") Speaking '" + textToSpeak + "'", false); } else { tsInterface.IMLInterpreter.SignalEventCallback(eventToken); } break; } } else { // If no greeting is found in the right language, tell the interpreter to move on tsInterface.IMLInterpreter.SignalEventCallback(eventToken); } } // If the greeting isn't found, tell the interpreter to go on else { tsInterface.IMLInterpreter.SignalEventCallback(eventToken); } break; } } else { OnExternalCommand(command, commandData, eventToken, tsInterface, telecomProvider, dataProvider); if (linkedScriptProcessor != null) linkedScriptProcessor.OnLinkedExternalCommand(command, commandData, eventToken, tsInterface, telecomProvider, dataProvider); } }
protected override void OnExternalCommand(string command, string commandData, string eventToken, TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { // Parse out our external event action if (Enum.IsDefined(typeof(ExtensionExternalCommands), command)) { ExtensionExternalCommands externalCommand = WOSI.Utilities.EnumUtils<ExtensionExternalCommands>.Parse(command); switch (externalCommand) { case ExtensionExternalCommands.CALLBUTLERINTERNAL_ForwardCall: { onholdTsInterface.IMLInterpreter.SetLocalVariable("TransferNumber", commandData); onholdTsInterface.IMLInterpreter.SignalExternalEvent(VoicemailExternalEvents.CALLBUTLERINTERNAL_CallForwarded.ToString()); break; } case ExtensionExternalCommands.CALLBUTLERINTERNAL_ConfirmingTransfer: { if (disableCallScreening || !extension.EnableCallScreening) { tsInterface.IMLInterpreter.SignalExternalEvent(ExtensionExternalEvents.CALLBUTLERINTERNAL_SkipConfirmation.ToString()); } else { tsInterface.IMLInterpreter.SignalEventCallback(eventToken); } break; } case ExtensionExternalCommands.CALLBUTLERINTERNAL_GetNextNumber: { string callerID = onholdTsInterface.IMLInterpreter.CallerDisplayName; string callerNumber = onholdTsInterface.IMLInterpreter.CallerUsername; if (callerID == null || callerID.Length == 0) callerID = "Unknown Caller"; if (callerNumber == null || callerNumber.Length == 0) callerNumber = ""; // If we have a previous call, end it if (telecomProvider.IsLineInUse(tsInterface.LineNumber)) { telecomProvider.EndCall(tsInterface.LineNumber); } else { // Get our extension contact numbers List<WOSI.CallButler.Data.CallButlerDataset.ExtensionContactNumbersRow> contactNumbers = new List<WOSI.CallButler.Data.CallButlerDataset.ExtensionContactNumbersRow>((WOSI.CallButler.Data.CallButlerDataset.ExtensionContactNumbersRow[])dataProvider.GetExtensionContactNumbers(extension.ExtensionID).Select("", "Priority ASC")); if (extensionNumberIndex + 1 >= contactNumbers.Count && parentExtension != null) { extensionNumberIndex = parentExtensionIndex; parentExtensionIndex = -1; extension = parentExtension; parentExtension = null; contactNumbers.Clear(); contactNumbers.AddRange((WOSI.CallButler.Data.CallButlerDataset.ExtensionContactNumbersRow[])dataProvider.GetExtensionContactNumbers(extension.ExtensionID).Select("", "Priority ASC")); } extensionNumberIndex++; List<string> callBlastNumbers = new List<string>(); List<string> callBlastProfiles = new List<string>(); int callBlastTimeout = Properties.Settings.Default.CallBlastTimeout; while (extensionNumberIndex < contactNumbers.Count) { WOSI.CallButler.Data.CallButlerDataset.ExtensionContactNumbersRow contactNumber = contactNumbers[extensionNumberIndex]; // Is the number online? if (contactNumber.Online) { // Does the number have hours? TimeSpan utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now); if (!contactNumber.IsHoursOfOperationUTCOffsetNull()) utcOffset = contactNumber.HoursOfOperationUTCOffset; if (!contactNumber.HasHoursOfOperation || (contactNumber.HasHoursOfOperation && ScriptUtils.IsInHoursOfOperation(contactNumber.HoursOfOperation, utcOffset))) { // Check to see if this number is a PBX IP line if ((contactNumber.CallPBXPhone || (WOSI.CallButler.Data.ExtensionContactNumberType)contactNumber.Type == WOSI.CallButler.Data.ExtensionContactNumberType.IPPhone) && registrarService != null) { int extNumber = extension.ExtensionNumber; // If this was filled in from another extension, we'll need to check the status of that extension if (contactNumber.ExtensionID != extension.ExtensionID) { WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow tmpExtension = dataProvider.GetExtension(Properties.Settings.Default.CustomerID, contactNumber.ExtensionID); if (tmpExtension != null) extNumber = tmpExtension.ExtensionNumber; } // Check to see if this pbx phone is online PBXPresenceInfo[] presInfos = registrarService.GetPresenceInfoForExtension(extNumber); if (presInfos != null && presInfos.Length > 0) { foreach (PBXPresenceInfo presInfo in presInfos) { if (presInfo.Status == PBXPresenceStatus.Online) { if (presInfos.Length > 1 || extension.UseCallBlast) { if (contactNumbers.Count == 1) callBlastTimeout = contactNumber.Timeout; string callBlastNumber = string.Format("sip:{0}@{1}:{2}", presInfo.ExtensionNumber, presInfo.RemoteAddress, presInfo.RemotePort); if (!callBlastNumbers.Contains(callBlastNumber)) { callBlastNumbers.Add(callBlastNumber); callBlastProfiles.Add(TelecomScriptInterface.InternalProviderProfileName); } } else { TryContactNumber(tsInterface, string.Format("sip:{0}@{1}:{2}", presInfo.ExtensionNumber, presInfo.RemoteAddress, presInfo.RemotePort), callerID, callerNumber, TelecomScriptInterface.InternalProviderProfileName, contactNumber.Timeout.ToString(), eventToken); return; } } } if (!extension.UseCallBlast && callBlastNumbers.Count > 0) break; } } else if ((WOSI.CallButler.Data.ExtensionContactNumberType)contactNumber.Type == WOSI.CallButler.Data.ExtensionContactNumberType.TelephoneNumber) { if (extension.UseCallBlast) { if (!callBlastNumbers.Contains(contactNumber.ContactNumber)) { callBlastNumbers.Add(contactNumber.ContactNumber); callBlastProfiles.Add(""); } } else { TryContactNumber(tsInterface, contactNumber.ContactNumber, callerID, callerNumber, "", contactNumber.Timeout.ToString(), eventToken); return; } } else if ((WOSI.CallButler.Data.ExtensionContactNumberType)contactNumber.Type == WOSI.CallButler.Data.ExtensionContactNumberType.Extension && parentExtension == null) { try { // Get our new extension WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow newExtension = dataProvider.GetExtension(Properties.Settings.Default.CustomerID, new Guid(contactNumber.ContactNumber)); if (newExtension != null) { if (extension.UseCallBlast) { WOSI.CallButler.Data.CallButlerDataset.ExtensionContactNumbersRow[] newContacts = (WOSI.CallButler.Data.CallButlerDataset.ExtensionContactNumbersRow[])dataProvider.GetExtensionContactNumbers(newExtension.ExtensionID).Select("Type <> " + (int)WOSI.CallButler.Data.ExtensionContactNumberType.Extension, "Priority ASC"); contactNumbers.AddRange(newContacts); } else { parentExtension = extension; parentExtensionIndex = extensionNumberIndex; extensionNumberIndex = -1; extension = newExtension; tsInterface.IMLInterpreter.SignalExternalEvent(ExtensionExternalEvents.CALLBUTLERINTERNAL_GetNextNumber.ToString()); return; } } } catch { } } } } extensionNumberIndex++; } if (callBlastNumbers.Count > 0) { TryCallBlast(telecomProvider, tsInterface, callBlastNumbers.ToArray(), callBlastProfiles.ToArray(), callerID, callerNumber, callBlastTimeout.ToString()); return; } else { tsInterface.IMLInterpreter.SignalExternalEvent(ExtensionExternalEvents.CALLBUTLERINTERNAL_NoMoreNumbers.ToString()); } } break; } case ExtensionExternalCommands.CALLBUTLERINTERNAL_SendToVoicemail: { onholdTsInterface.IMLInterpreter.SyncExternalAction -= IMLInterpreter_SyncExternalAction; // Allow this line to answer calls again tsInterface.Locked = false; if (telecomProvider.IsLineInUse(onholdTsInterface.LineNumber)) { telecomProvider.SendingToVoicemail(onholdTsInterface.LineNumber); } onholdTsInterface.IMLInterpreter.SignalExternalEvent(VoicemailExternalEvents.CALLBUTLERINTERNAL_ExtensionNotAvailable.ToString()); tsInterface.IMLInterpreter.SignalEventCallback(eventToken); break; } case ExtensionExternalCommands.CALLBUTLERINTERNAL_ConnectCalls: { onholdTsInterface.IMLInterpreter.SyncExternalAction -= IMLInterpreter_SyncExternalAction; onholdTsInterface.IMLInterpreter.SignalExternalEvent(ExtensionExternalCommands.CALLBUTLERINTERNAL_ConnectCalls.ToString()); // Allow this line to answer calls again tsInterface.Locked = false; if (autoConnect) { if (telecomProvider.IsLineInUse(tsInterface.LineNumber) && telecomProvider.IsLineInUse(onholdTsInterface.LineNumber)) { if (extension.IsUseConferenceTransferNull() || !extension.UseConferenceTransfer /*|| !Licensing.Management.AppPermissions.StatIsPermitted("Handoff")*/) { telecomProvider.TransferCallAttended(onholdTsInterface.LineNumber, tsInterface.LineNumber, Properties.Settings.Default.UseBridgedTransfers); tsInterface.IMLInterpreter.SignalEventCallback(eventToken); } else { telecomProvider.StopSound(tsInterface.LineNumber); telecomProvider.StopSound(onholdTsInterface.LineNumber); int conferenceID = telecomProvider.ConferenceLines(tsInterface.LineNumber, onholdTsInterface.LineNumber); // Check to see if the person calling is an internal extension if (onholdTsInterface.Extension != null) { onholdTsInterface.ScriptProcessor = new TransferConferenceScriptProcessor(conferenceID, scriptService, tsInterface, registrarService, extension, vmMailerService); } else { onholdTsInterface.ScriptProcessor = new TransferConferenceParticipantScriptProcessor(conferenceID, tsInterface, extension, vmMailerService); } tsInterface.ScriptProcessor = new TransferConferenceScriptProcessor(conferenceID, scriptService, onholdTsInterface, registrarService, extension, vmMailerService); onholdTsInterface.ScriptProcessor.StartProcessing(onholdTsInterface, telecomProvider, dataProvider); tsInterface.ScriptProcessor.StartProcessing(tsInterface, telecomProvider, dataProvider); } } else { tsInterface.IMLInterpreter.SignalEventCallback(eventToken); } } break; } } } }
protected override void OnExternalCommand(string command, string commandData, string eventToken, TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { // Parse out our external event action if (Enum.IsDefined(typeof(Click2CallExternalCommands), command)) { Click2CallExternalCommands externalCommand = WOSI.Utilities.EnumUtils<Click2CallExternalCommands>.Parse(command); switch (externalCommand) { case Click2CallExternalCommands.CALLBUTLERINTERNAL_ExtensionNotAvailable: // Allow this to answer calls again tsInterface.Locked = false; break; case Click2CallExternalCommands.CALLBUTLERINTERNAL_ConnectCalls: // Check to see if this is a call to another extension int extensionNumber = 0; bool disableCallScreening = callMakerExtension == null ? false : true; if (int.TryParse(numberToDial, out extensionNumber)) { // If we're calling our own extension, send us to the voicemail management menu if (extensionNumber == callMakerExtension.ExtensionNumber) { callMakerInterface.ScriptProcessor = new VoicemailManagementScriptProcessor(callMakerExtension, scriptService.registrarService); callMakerInterface.ScriptProcessor.StartProcessing(callMakerInterface, telecomProvider, dataProvider); // Allow this to answer calls again tsInterface.Locked = false; break; } else { WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow extension = dataProvider.GetExtensionNumber(Properties.Settings.Default.CustomerID, extensionNumber); if (extension != null) { scriptService.TransferToExtension(extensionNumber.ToString(), callMakerInterface, disableCallScreening); // Allow this to answer calls again tsInterface.Locked = false; break; } } } // Send the caller to main menu if (numberToDial == "*") { scriptService.SetupAutoAttendantAnswer(callMakerInterface.LineNumber, callMakerInterface); callMakerInterface.ScriptProcessor.StartProcessing(callMakerInterface, telecomProvider, dataProvider); // Allow this to answer calls again tsInterface.Locked = false; break; } // If we get here, we make an outbound call to an external number if(callMakerExtension != null) scriptService.MakeOutboundCall(callMakerInterface, numberToDial, string.Format("{0} {1}", callMakerExtension.FirstName, callMakerExtension.LastName), null, null, callMakerExtension.ExtensionNumber, false, true); // Allow this to answer calls again tsInterface.Locked = false; break; } tsInterface.IMLInterpreter.SignalEventCallback(eventToken); } }
protected override void OnStartProcessing(TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { string voicemailScriptLocation = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory) + "\\Voicemail.xml"; if (File.Exists(voicemailScriptLocation)) { IMLScript imlScript = IMLScript.OpenScript(voicemailScriptLocation); // Set our script variables tsInterface.IMLInterpreter.SetLocalVariable("ExtensionID", extension.ExtensionID.ToString()); //if (Licensing.Management.AppPermissions.StatIsPermitted("Settings.MusicSettings")) //{ tsInterface.IMLInterpreter.SetLocalVariable("HoldMusicLocation", WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.HoldMusicRootDirectory)); //} /*else { tsInterface.IMLInterpreter.SetLocalVariable("HoldMusicLocation", ""); }*/ tsInterface.IMLInterpreter.SetLocalVariable("VoicemailRootFolder", WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.VoicemailRootDirectory)); tsInterface.IMLInterpreter.StartScript(imlScript, WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.SystemScriptsRootDirectory)); } }
protected override void OnExternalCommand(string command, string commandData, string eventToken, TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider) { // Parse out our external event action if (Enum.IsDefined(typeof(VoicemailExternalCommands), command)) { VoicemailExternalCommands externalCommand = WOSI.Utilities.EnumUtils<VoicemailExternalCommands>.Parse(command); switch (externalCommand) { case VoicemailExternalCommands.CALLBUTLERINTERNAL_NewVoicemail: { // Create a new voicemail record vmService.CreateVoicemail(new Guid(commandData), new Guid(tsInterface.IMLInterpreter.GetLocalVariable("ExtensionID")), tsInterface.IMLInterpreter.CallerDisplayName, tsInterface.IMLInterpreter.CallerHost, tsInterface.IMLInterpreter.CallerUsername); break; } case VoicemailExternalCommands.CALLBUTLERINTERNAL_VoicemailManagement: { tsInterface.ScriptProcessor = new VoicemailManagementScriptProcessor(extension, registrarService); tsInterface.ScriptProcessor.StartProcessing(tsInterface, telecomProvider, dataProvider); break; } } tsInterface.IMLInterpreter.SignalEventCallback(eventToken); } }