예제 #1
0
        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;
        }
        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;
        }