Exemple #1
0
 public VoicemailScriptProcessor(WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow extension, VoicemailService vmService, PBXRegistrarService registrarService, Utilities.PluginManagement.PluginManager pluginManager)
 {
     this.extension        = extension;
     this.vmService        = vmService;
     this.registrarService = registrarService;
     this.pluginManager    = pluginManager;
 }
 public TransferConferenceScriptProcessor(int conferenceID, ScriptService scriptService, ScriptProcessing.TelecomScriptInterface callerTsInterface, PBXRegistrarService pbxRegistrar, WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow extension, VoicemailMailerService vmMailerService)
 {
     this.callerTsInterface = callerTsInterface;
     this.vmMailerService   = vmMailerService;
     this.scriptService     = scriptService;
     this.conferenceID      = conferenceID;
     this.pbxRegistrar      = pbxRegistrar;
     this.extension         = extension;
 }
 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;
 }
Exemple #4
0
 public StandardScriptProcessor(Utilities.PluginManagement.PluginManager pluginManager, PBXRegistrarService pbxRegistrar)
 {
     this.pluginManager = pluginManager;
     this.pbxRegistrar  = pbxRegistrar;
 }
        private void DeInitialize()
        {
            if (mnuMain.InvokeRequired)
            {
                mnuMain.Invoke(clearMenuItemsHandler);
            }
            else
            {
                mnuServiceOptions.DropDownItems.Clear();
            }

            /*if (extStateService != null)
             * {
             *  extStateService.ClearState();
             *  extStateService = null;
             * }
             *
             * if (emService != null)
             * {
             *  emService.Stop();
             *  emService.Dispose();
             *  emService = null;
             * }*/

            if (pluginManager != null)
            {
                // Unload our plugins
                foreach (CallButler.Service.Plugin.CallButlerServicePlugin plugin in pluginManager.Plugins)
                {
                    plugin.Unload();
                }

                pluginManager.UnloadPlugins();
                pluginManager = null;
            }

            if (scriptService != null)
            {
                scriptService.Shutdown();
                scriptService = null;
            }

            if (vmMailerService != null)
            {
                vmMailerService = null;
            }

            if (vmService != null)
            {
                vmService = null;
            }

            dataProvider = null;

            if (CallButlerService.DialPlanManager != null)
            {
                CallButlerService.DialPlanManager = null;
            }

            if (pbxRegistrar != null)
            {
                pbxRegistrar.Shutdown();
                pbxRegistrar = null;
            }

            if (telecomProvider != null)
            {
                telecomProvider.Shutdown();
                telecomProvider = null;
            }

            if (tcpManagementDataServer != null)
            {
                tcpManagementDataServer.StopServer();
            }

            GC.Collect();
        }
        private void Initialize()
        {
            if (Properties.Settings.Default.ProductID != null && Properties.Settings.Default.ProductID.Length > 0)
            {
                lastErrorMessage = null;

                notifyIcon.Text = Properties.Settings.Default.ProductDescription;

                // Load our application permissions
                //Licensing.Management.AppPermissions.LoadPermissionData(Properties.Settings.Default.ProductID, Properties.Resources.Permissions);

                // Load our dataprovider
                System.Collections.Specialized.NameValueCollection settings = new System.Collections.Specialized.NameValueCollection();

                switch (Properties.Settings.Default.DataProviderType)
                {
                case LocalCallButlerDataProviderTypes.XmlDataProvider:
                    // Create our settings
                    settings["RootDataDirectory"]          = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.XmlDataRootDirectory);
                    settings["RootGreetingSoundDirectory"] = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingSoundRootDirectory);

                    dataProvider = new CallButlerXmlDataProvider();
                    dataProvider.Connect(settings);
                    break;

                    /*case LocalCallButlerDataProviderTypes.SqlServerDataProvider:
                     *
                     *  settings["RootDataDirectory"] = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.XmlDataRootDirectory);
                     *  settings["RootGreetingSoundDirectory"] = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingSoundRootDirectory);
                     *  settings["ConnectionString"] = Properties.Settings.Default.SqlConnectionString;
                     *
                     *  dataProvider = new CallButlerSQLServerDataProvider();
                     *  dataProvider.Connect(settings);
                     *  break;*/
                }

                /*if (Properties.Settings.Default.EnableKinesisServer)
                 * {
                 *  extStateService = new ExtensionStateService(dataProvider);
                 * }*/

                // Create our telecom provider
                int lineCount = /*Math.Min(*/ Properties.Settings.Default.LineCount; /*, Licensing.Management.AppPermissions.StatGetPermissionScalar("MaxLineCount"));*/

                switch (Properties.Settings.Default.TelecomProviderType)
                {
                case TelecomProviders.inTELIPhoneTelecomProvider:
                {
                    telecomProvider = new inTELIPhoneTelecomProvider(mnuServiceOptions, notifyIcon, lineCount, Properties.Settings.Default.UseStun, Properties.Settings.Default.StunServer, Properties.Settings.Default.SipPort, Properties.Settings.Default.UseInternalAddressForSIPMessages);

                    // Register all of our profiles
                    //if (Licensing.Management.AppPermissions.StatIsPermitted("Providers"))
                    //{
                    WOSI.CallButler.Data.CallButlerDataset.ProvidersDataTable providers = dataProvider.GetProviders(Properties.Settings.Default.CustomerID);

                    foreach (WOSI.CallButler.Data.CallButlerDataset.ProvidersRow provider in providers)
                    {
                        if (provider.IsEnabled)
                        {
                            telecomProvider.Register(provider.ProviderID, provider);
                        }
                    }
                    //}

                    // Start our PBX registrar engine
                    if (Properties.Settings.Default.EnablePBX /*&& Licensing.Management.AppPermissions.StatIsPermitted("PBX.Registrar")*/)
                    {
                        pbxRegistrar = new PBXRegistrarService(telecomProvider, dataProvider /*, extStateService*/);
                    }

                    break;
                }
                }

                // Initialize our codecs
                if (Properties.Settings.Default.AudioCodecs != null && Properties.Settings.Default.AudioCodecs.Length > 0)
                {
                    telecomProvider.SetAudioCodecs(Properties.Settings.Default.AudioCodecs);
                }

                // Create our plugin manager object
                pluginManager = new Utilities.PluginManagement.PluginManager();

                // Create our voicemail mailer service
                vmMailerService = new VoicemailMailerService();

                // Initialize our voicemail service
                vmService = new VoicemailService(dataProvider, pbxRegistrar, pluginManager, vmMailerService);

                // Create our script server
                scriptService = new ScriptService(telecomProvider, dataProvider, vmService, vmMailerService, pluginManager, pbxRegistrar /*, extStateService*/);

                // Load our plugins
                CallButler.Service.Plugin.CallButlerServiceContext serviceContext = new CallButler.Service.Plugin.CallButlerServiceContext(scriptService);
                pluginManager.LoadPlugins(WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.PluginDirectory), "*.dll", true, typeof(CallButler.Service.Plugin.CallButlerServicePlugin));

                foreach (CallButler.Service.Plugin.CallButlerServicePlugin plugin in pluginManager.Plugins)
                {
                    try
                    {
                        plugin.Load(serviceContext);
                    }
                    catch
                    {
                    }
                }

                try
                {
                    mnuPlugins.Visible    = false;
                    mnuSeparator4.Visible = false;
                }
                catch
                {
                }

                // Initialize our management interface
                managementInterfaceServer.Initialize(this, dataProvider, telecomProvider, scriptService, pluginManager, pbxRegistrar, vmService);

                // Create our default greetings if this the first time we've run
                if (Properties.Settings.Default.FirstTimeRun)
                {
                    WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsDataTable lgTable = new CallButlerDataset.LocalizedGreetingsDataTable();
                    WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsRow       lgRow;

                    if (dataProvider.GetGreeting(Properties.Settings.Default.CustomerID, WOSI.CallButler.Data.Constants.WelcomeGreetingGuid) == null)
                    {
                        lgRow = lgTable.NewLocalizedGreetingsRow();

                        lgRow.GreetingID          = WOSI.CallButler.Data.Constants.WelcomeGreetingGuid;
                        lgRow.LanguageID          = "en";
                        lgRow.LocalizedGreetingID = Guid.NewGuid();
                        lgRow.Type = (short)WOSI.CallButler.Data.GreetingType.SoundGreeting;

                        lgTable.AddLocalizedGreetingsRow(lgRow);
                    }

                    if (dataProvider.GetGreeting(Properties.Settings.Default.CustomerID, WOSI.CallButler.Data.Constants.MainMenuGreetingGuid) == null)
                    {
                        lgRow = lgTable.NewLocalizedGreetingsRow();

                        lgRow.GreetingID          = WOSI.CallButler.Data.Constants.MainMenuGreetingGuid;
                        lgRow.LanguageID          = "en";
                        lgRow.LocalizedGreetingID = Guid.NewGuid();
                        lgRow.Type = (short)WOSI.CallButler.Data.GreetingType.SoundGreeting;

                        lgTable.AddLocalizedGreetingsRow(lgRow);
                    }

                    managementInterfaceServer.PersistLocalizedGreeting(Properties.Settings.Default.CustomerID, lgTable);

                    Properties.Settings.Default.FirstTimeRun = false;
                    Properties.Settings.Default.Save();
                }

                // Setup our default language
                if (Properties.Settings.Default.DefaultLanguage.Length == 0)
                {
                    Properties.Settings.Default.DefaultLanguage = System.Globalization.CultureInfo.CurrentCulture.IetfLanguageTag;
                    Properties.Settings.Default.Save();
                }

                telecomProvider.Startup();

                CallButlerService.DialPlanManager = new DialPlanManagerService(pbxRegistrar, dataProvider, telecomProvider);

                if (tcpManagementDataServer != null)
                {
                    tcpManagementDataServer.StartServer();
                }

                // Create our extension management service

                /*if (Properties.Settings.Default.EnableKinesisServer)
                 * {
                 *  emService = new KinesisService(dataProvider, extStateService, scriptService, vmService);
                 *  emService.Start();
                 * }*/
            }
        }
        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);
                }
            }
        }
 public VoicemailManagementScriptProcessor(WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow extension, PBXRegistrarService pbxRegistrar)
 {
     this.extension    = extension;
     this.pbxRegistrar = pbxRegistrar;
 }
        public TelecomScriptInterface(CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider, Utilities.PluginManagement.PluginManager pluginManager, PBXRegistrarService pbxRegistrar /*, ExtensionStateService extStateService*/, int lineNumber)
        {
            this.telecomProvider = telecomProvider;
            this.dataProvider    = dataProvider;
            this.lineNumber      = lineNumber;
            this.pluginManager   = pluginManager;
            this.pbxRegistrar    = pbxRegistrar;
            //this.extStateService = extStateService;

            // Attach to our telecom provider events
            telecomProvider.CallEnded            += new EventHandler <LineEventArgs>(telecomProvider_CallEnded);
            telecomProvider.DTMFToneRecognized   += new EventHandler <CallInputEventArgs>(telecomProvider_DTMFToneRecognized);
            telecomProvider.FinishedSpeaking     += new EventHandler <LineEventArgs>(telecomProvider_FinishedSpeaking);
            telecomProvider.SoundFinishedPlaying += new EventHandler <LineEventArgs>(telecomProvider_SoundFinishedPlaying);
            telecomProvider.TransferFailed       += new EventHandler <LineEventArgs>(telecomProvider_TransferFailed);
            telecomProvider.TransferSucceeded    += new EventHandler <LineEventArgs>(telecomProvider_TransferSucceeded);
            telecomProvider.CallConnected        += new EventHandler <CallEventArgs>(telecomProvider_CallConnected);
            telecomProvider.CallFailed           += new EventHandler <CallFailureEventArgs>(telecomProvider_CallFailed);
            telecomProvider.FaxToneDetected      += new EventHandler <LineEventArgs>(telecomProvider_FaxToneDetected);
            telecomProvider.RemoteOnHold         += new EventHandler <LineEventArgs>(telecomProvider_RemoteOnHold);
            telecomProvider.RemoteOffHold        += new EventHandler <LineEventArgs>(telecomProvider_RemoteOffHold);
            telecomProvider.SpeechRecognized     += new EventHandler <CallInputEventArgs>(telecomProvider_SpeechRecognized);
            telecomProvider.IncomingTransfer     += new EventHandler <CallButler.Telecom.TransferEventArgs>(telecomProvider_IncomingTransfer);
            telecomProvider.CallTemporarilyMoved += new EventHandler <CallEventArgs>(telecomProvider_CallTemporarilyMoved);
            telecomProvider.AnswerDetectHuman    += new EventHandler <LineEventArgs>(telecomProvider_AnswerDetectHuman);
            telecomProvider.AnswerDetectMachine  += new EventHandler <LineEventArgs>(telecomProvider_AnswerDetectMachine);
            telecomProvider.AnswerDetectMachineGreetingFinished += new EventHandler <LineEventArgs>(telecomProvider_AnswerDetectMachineGreetingFinished);

            imlInterp = new WOSI.IVR.IML.IMLInterpreter(WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.ImlPluginsFolder));

            // Attach to our interpreter events
            imlInterp.AsyncExternalAction += new EventHandler <AsyncExternalActionEventArgs>(imlInterp_AsyncExternalAction);
            imlInterp.DeleteLastRecording += new EventHandler(imlInterp_DeleteLastRecording);
            imlInterp.CopyLastRecording   += new EventHandler <SoundFileEventArgs>(imlInterp_CopyLastRecording);
            imlInterp.HangUp             += new EventHandler(imlInterp_HangUp);
            imlInterp.PlaySound          += new EventHandler <PlaySoundEventArgs>(imlInterp_PlaySound);
            imlInterp.ScriptError        += new EventHandler <ScriptErrorEventArgs>(imlInterp_ScriptError);
            imlInterp.ScriptFinished     += new EventHandler(imlInterp_ScriptFinished);
            imlInterp.SpeakText          += new EventHandler <SpeakTextEventArgs>(imlInterp_SpeakText);
            imlInterp.StartRecording     += new EventHandler <SoundFileEventArgs>(imlInterp_StartRecording);
            imlInterp.StopRecording      += new EventHandler <StopRecordingEventArgs>(imlInterp_StopRecording);
            imlInterp.SyncExternalAction += new EventHandler <SyncExternalActionEventArgs>(imlInterp_SyncExternalAction);
            imlInterp.TransferCall       += new EventHandler <WOSI.IVR.IML.TransferEventArgs>(imlInterp_TransferCall);
            imlInterp.Call             += new EventHandler <TelephoneNumberEventArgs>(imlInterp_Call);
            imlInterp.StopAllSounds    += new EventHandler(imlInterp_StopAllSounds);
            imlInterp.ScriptStarted    += new EventHandler(imlInterp_ScriptStarted);
            imlInterp.NewSpeechPhrases += new EventHandler <SpeechPhraseEventArgs>(imlInterp_NewSpeechPhrases);
            imlInterp.TraceMessage     += new EventHandler <TraceEventArgs>(imlInterp_TraceMessage);
            imlInterp.JoinConference   += new EventHandler <ConferenceEventArgs>(imlInterp_JoinConference);
            imlInterp.LeaveConference  += new EventHandler(imlInterp_LeaveConference);

            // Create our default internal provider
            WOSI.CallButler.Data.CallButlerDataset.ProvidersDataTable defaultInternalProviderTable = new WOSI.CallButler.Data.CallButlerDataset.ProvidersDataTable();

            defaultInternalProvider = defaultInternalProviderTable.NewProvidersRow();

            defaultInternalProvider.CustomerID              = Properties.Settings.Default.CustomerID;
            defaultInternalProvider.AutoDetectAudio         = true;
            defaultInternalProvider.EnableRegistration      = false;
            defaultInternalProvider.SupressOutboundUsername = false;

            if (Properties.Settings.Default.InternalSIPDomain != null && Properties.Settings.Default.InternalSIPDomain.Length > 0)
            {
                defaultInternalProvider.Domain = Properties.Settings.Default.InternalSIPDomain;
            }
            else
            {
                // Get the IP of this machine
                try
                {
                    System.Net.IPHostEntry ipEntry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName());

                    defaultInternalProvider.Domain = telecomProvider.LocalIPAddress;
                }
                catch
                {
                    defaultInternalProvider.Domain = Environment.MachineName;
                }
            }

            defaultInternalProvider.IsDefault = false;
        }