Beispiel #1
0
 public override void OnAnswerDetectMachine(CallButler.Telecom.TelecomProviderBase telecomProvider, CallButler.Telecom.LineEventArgs e)
 {
     if (dialerPlugin != null)
     {
         dialerPlugin.OnCallStatus(jobID, callID, CallButler.Service.Plugin.CallButlerDialerPlugin.CallStatus.MachineAnswered);
     }
 }
 public override void OnDTMFDigit(CallButler.Telecom.TelecomProviderBase telecomProvider, CallButler.Telecom.CallInputEventArgs e)
 {
     if (!e.InAudio)
     {
         telecomProvider.SendDTMF(extensionTsInterface.LineNumber, e.InputString, Properties.Settings.Default.SendDTMFInAudio);
     }
 }
 public override void OnDTMFDigit(CallButler.Telecom.TelecomProviderBase telecomProvider, CallButler.Telecom.CallInputEventArgs e)
 {
     // If we're making an outbound call, make sure we relay any DTMF on to our remote caller if it is out of band DTMF
     if (!e.InAudio)
     {
         telecomProvider.SendDTMF(outboundTsInterface.LineNumber, e.InputString, Properties.Settings.Default.SendDTMFInAudio);
     }
 }
Beispiel #4
0
        public override void OnCallFailed(CallButler.Telecom.TelecomProviderBase telecomProvider, CallButler.Telecom.LineEventArgs e)
        {
            connected          = true;
            tsInterface.Locked = false;

            if (dialerPlugin != null)
            {
                dialerPlugin.OnCallStatus(jobID, callID, CallButler.Service.Plugin.CallButlerDialerPlugin.CallStatus.Failed);
            }
        }
        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);
            }
        }
Beispiel #6
0
        public override void OnAnswerDetectHuman(CallButler.Telecom.TelecomProviderBase telecomProvider, CallButler.Telecom.LineEventArgs e)
        {
            telecomProvider.EnableAnsweringMachineDetection(tsInterface.LineNumber, false);

            StartScript(scriptLocation);

            if (dialerPlugin != null)
            {
                dialerPlugin.OnCallStatus(jobID, callID, CallButler.Service.Plugin.CallButlerDialerPlugin.CallStatus.HumanAnswered);
            }
        }
 private void ProcessEndCall(CallButler.Telecom.TelecomProviderBase telecomProvider)
 {
     if (outboundTsInterface != null && conferenceID == 0)
     {
         telecomProvider.EndCall(outboundTsInterface.LineNumber);
     }
     else
     {
         telecomProvider.EndConference(conferenceID, true);
     }
 }
        public PBXRegistrarService(CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider /*, ExtensionStateService extStateService*/)
        {
            this.telecomProvider = telecomProvider;
            this.dataProvider    = dataProvider;
            //this.extStateService = extStateService;

            presenceData = new List <PBXPresenceInfo>();

            if (telecomProvider is CallButler.Telecom.inTELIPhoneTelecomProvider)
            {
                ipClient = ((CallButler.Telecom.inTELIPhoneTelecomProvider)telecomProvider).BaseProviderObject;

                ipClient.PreprocessSipRequest += new EventHandler <WOSI.NET.SIP.PreprocessSipRequestEventArgs>(ipClient_PreprocessSipRequest);
            }

            presenceTimeout = new System.Threading.Timer(new System.Threading.TimerCallback(PresenceTimeoutTimerProc), this, 0, 30000);
        }
Beispiel #9
0
        public override void OnCallConnected(CallButler.Telecom.TelecomProviderBase telecomProvider, CallButler.Telecom.LineEventArgs e)
        {
            connected = true;

            if (answeringMachineScriptLocation != null && answeringMachineScriptLocation.Length > 0)
            {
                if (answeringMachineDetectionSettings != null && answeringMachineDetectionSettings.Length > 0)
                {
                    telecomProvider.SetAnsweringMachineDetectionSettings(tsInterface.LineNumber, answeringMachineDetectionSettings);
                }

                telecomProvider.EnableAnsweringMachineDetection(tsInterface.LineNumber, true);
            }

            if (dialerPlugin != null && (answeringMachineScriptLocation == null || answeringMachineScriptLocation.Length == 0))
            {
                dialerPlugin.OnCallStatus(jobID, callID, CallButler.Service.Plugin.CallButlerDialerPlugin.CallStatus.Answered);
            }
        }
        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(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;
                }
                }
            }
        }
        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 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(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), callMakerExtension.ExtensionNumber, false, true);
                    }

                    // Allow this to answer calls again
                    tsInterface.Locked = false;

                    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(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);
        }
Beispiel #16
0
        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));
        }
        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));
            }
        }
Beispiel #18
0
        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 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 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 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));
            }
        }
Beispiel #22
0
        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(ScheduleReminderExternalCommands), command))
            {
                ScheduleReminderExternalCommands externalCommand = WOSI.Utilities.EnumUtils <ScheduleReminderExternalCommands> .Parse(command);

                switch (externalCommand)
                {
                case ScheduleReminderExternalCommands.CALLBUTLERINTERNAL_GetNextNumber:
                {
                    // If we have a previous call, end it
                    if (telecomProvider.IsLineInUse(tsInterface.LineNumber))
                    {
                        telecomProvider.EndCall(tsInterface.LineNumber);
                    }

                    extensionNumberIndex++;

                    // Get our extension contact numbers
                    WOSI.CallButler.Data.CallButlerDataset.ExtensionContactNumbersRow[] contactNumbers = (WOSI.CallButler.Data.CallButlerDataset.ExtensionContactNumbersRow[])dataProvider.GetExtensionContactNumbers(extension.ExtensionID).Select("", "Priority ASC");

                    while (extensionNumberIndex < contactNumbers.Length)
                    {
                        WOSI.CallButler.Data.CallButlerDataset.ExtensionContactNumbersRow contactNumber = contactNumbers[extensionNumberIndex];

                        // Is the number online?
                        if (contactNumber.Online)
                        {
                            // Does the number have hours?
                            if (!contactNumber.HasHoursOfOperation || (contactNumber.HasHoursOfOperation && ScriptUtils.IsInHoursOfOperation(contactNumber.HoursOfOperation, contactNumber.HoursOfOperationUTCOffset)))
                            {
                                // If we get here, try the number
                                tsInterface.IMLInterpreter.SetLocalVariable("NumberToCall", contactNumber.ContactNumber);

                                tsInterface.IMLInterpreter.SetLocalVariable("ExtensionTimeout", contactNumber.Timeout.ToString());

                                string introDetails = "You have " + reminders.Length + " upcoming appointment";

                                if (reminders.Length > 1)
                                {
                                    introDetails += "s";
                                }

                                introDetails += ".";

                                tsInterface.IMLInterpreter.SetLocalVariable("IntroDetails", introDetails);

                                tsInterface.IMLInterpreter.SignalEventCallback(eventToken);

                                return;
                            }
                        }

                        extensionNumberIndex++;
                    }

                    if (telecomProvider.IsLineInUse(tsInterface.LineNumber))
                    {
                        telecomProvider.EndCall(tsInterface.LineNumber);
                    }

                    tsInterface.IMLInterpreter.StopScript();
                    break;
                }

                case ScheduleReminderExternalCommands.CALLBUTLERINTERNAL_FetchNextReminder:
                {
                    reminderIndex++;

                    if (reminderIndex < reminders.Length)
                    {
                        OutlookReminder reminder = reminders[reminderIndex];

                        tsInterface.IMLInterpreter.SetLocalVariable("ScheduleDetails", GetReminderDetails(reminder));

                        if (reminderIndex == reminders.Length - 1)
                        {
                            tsInterface.IMLInterpreter.SignalExternalEvent(ScheduleReminderExternalEvents.CALLBUTLERINTERNAL_LastReminder.ToString());
                        }
                        else
                        {
                            tsInterface.IMLInterpreter.SignalEventCallback(eventToken);
                        }
                    }
                    else
                    {
                        tsInterface.IMLInterpreter.SignalExternalEvent(ScheduleReminderExternalEvents.CALLBUTLERINTERNAL_EndOfReminders.ToString());
                    }


                    break;
                }
                }
            }
        }
Beispiel #24
0
        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)
        {
            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 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 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 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);
        }
        public PBXRegistrarService(CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider/*, ExtensionStateService extStateService*/)
        {
            this.telecomProvider = telecomProvider;
            this.dataProvider = dataProvider;
            //this.extStateService = extStateService;

            presenceData = new List<PBXPresenceInfo>();

            if (telecomProvider is CallButler.Telecom.inTELIPhoneTelecomProvider)
            {
                ipClient = ((CallButler.Telecom.inTELIPhoneTelecomProvider)telecomProvider).BaseProviderObject;

                ipClient.PreprocessSipRequest += new EventHandler<WOSI.NET.SIP.PreprocessSipRequestEventArgs>(ipClient_PreprocessSipRequest);
            }

            presenceTimeout = new System.Threading.Timer(new System.Threading.TimerCallback(PresenceTimeoutTimerProc), this, 0, 30000);
        }
Beispiel #30
0
        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));
        }
        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));
            }
        }