protected void RaiseIncomingCall(CallEventArgs e)
 {
     if (IncomingCall != null)
     {
         IncomingCall(this, e);
     }
 }
 protected void RaiseCallConnected(CallEventArgs e)
 {
     if (CallConnected != null)
     {
         CallConnected(this, e);
     }
 }
 protected void RaiseCallTemporarilyMoved(CallEventArgs e)
 {
     if (CallTemporarilyMoved != null)
     {
         CallTemporarilyMoved(this, e);
     }
 }
 public virtual void OnCallTemporarilyMoved(CallButler.Telecom.TelecomProviderBase telcomProvider, CallEventArgs e)
 {
 }
        void telecomProvider_CallConnected(object sender, CallEventArgs e)
        {
            if (e.LineNumber == lineNumber && scriptProcessor != null)
            {
                LoggingService.AddLogEntry(LogLevel.Basic, "(Line " + e.LineNumber + ") Call Connected", false);

                callStartTime = DateTime.Now;

                // Set our language
                imlInterp.DefaultSpeechVoice = Properties.Settings.Default.DefaultTTSVoice;
                imlInterp.SetLocalVariable("LanguageID", Properties.Settings.Default.DefaultLanguage);

                // Set our volumes
                telecomProvider.SetRecordVolume(e.LineNumber, Properties.Settings.Default.RecordVolume);
                telecomProvider.SetSoundVolume(e.LineNumber, Properties.Settings.Default.SoundVolume);
                telecomProvider.SetSpeechVolume(e.LineNumber, Properties.Settings.Default.SpeechVolume);

                // Set our call info
                imlInterp.CallerDisplayName = e.CallerDisplayName;
                imlInterp.CallerHost = e.CallerMiscInfo;
                imlInterp.CallerUsername = e.CallerPhoneNumber;
                imlInterp.DialedUsername = e.CallingToNumber;
                imlInterp.DialedHost = e.CallingToMiscInfo;

                if (autoRunScript && !imlInterp.ScriptIsRunning)
                {
                    scriptProcessor.StartProcessing(this, telecomProvider, dataProvider);
                }

                imlInterp.SignalCallConnected();

                if (scriptProcessor != null)
                    scriptProcessor.OnCallConnected(telecomProvider, e);

                // Check to see if this is an extension making or receiving a call. If so, update the status of the extension.
                if (Properties.Settings.Default.EnableKinesisServer && this.Extension == null)
                {
                    int extNumber = 0;

                    if (e.Outbound)
                    {
                        if (int.TryParse(e.CallingToNumber, out extNumber))
                        {
                            this.Extension = dataProvider.GetExtensionNumber(Properties.Settings.Default.CustomerID, extNumber);
                        }
                    }
                    else
                    {
                        if (int.TryParse(e.CallerPhoneNumber, out extNumber))
                        {
                            this.Extension = dataProvider.GetExtensionNumber(Properties.Settings.Default.CustomerID, extNumber);
                        }
                    }
                }

                if (callID == null)
                    callID = Guid.NewGuid();

                //UpdateExtensionCallStatus(CallStatus.OnCall);
                //UpdateExtensionCall(e.LineNumber, CallStatus.OnCall, e.CallerDisplayName, e.CallerPhoneNumber);
            }
        }
        void telecomProvider_CallTemporarilyMoved(object sender, CallEventArgs e)
        {
            if (e.LineNumber == lineNumber)
            {
                LoggingService.AddLogEntry(LogLevel.Basic, "(Line " + e.LineNumber + ") Call Temporarily Moved to " + e.CallingToNumber, false);

                if (scriptProcessor != null)
                {
                    scriptProcessor.OnCallTemporarilyMoved(telecomProvider, e);
                }
            }
        }
 protected void RaiseIncomingCall(CallEventArgs e)
 {
     if (IncomingCall != null)
         IncomingCall(this, e);
 }
 protected void RaiseCallTemporarilyMoved(CallEventArgs e)
 {
     if (CallTemporarilyMoved != null)
         CallTemporarilyMoved(this, e);
 }
 protected void RaiseCallConnected(CallEventArgs e)
 {
     if (CallConnected != null)
         CallConnected(this, e);
 }
Beispiel #10
0
        void telecomProvider_IncomingCall(object sender, CallEventArgs e)
        {
            UpdatePerformanceCounters();

            // Add a log entry
            LoggingService.AddLogEntry(LogLevel.Basic, "(Line " + e.LineNumber + ") Incoming call from " + e.CallerDisplayName + " " + e.CallerPhoneNumber + " to " + e.CallingToNumber + " " + e.CallingToMiscInfo, false);

            // Check to see if the service is supposed to be running and that we have a valid license.
            if (/*(LicenseService.IsLicensed() || LicenseService.IsTrialLicense() || Properties.Settings.Default.IsFreeVersion) &&*/ Properties.Settings.Default.ServiceEnabled)
            {
                TelecomScriptInterface tsInterface = tsInterfaces[e.LineNumber];

                // Populate our caller variables into the IML Interpreter so they can be used in our script
                tsInterface.IMLInterpreter.CallerDisplayName = e.CallerDisplayName;
                tsInterface.IMLInterpreter.CallerHost = e.CallerMiscInfo;
                tsInterface.IMLInterpreter.CallerUsername = e.CallerPhoneNumber;
                tsInterface.IMLInterpreter.DialedUsername = e.CallingToNumber;
                tsInterface.IMLInterpreter.DialedHost = e.CallingToMiscInfo;

                // Set the profile parameter of our tsInterface. This is usually the profile for the incoming call.
                //tsInterface.Profile = e.Tag;

                // Check to see if this caller is asking for a direct extension number
                WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow extension = null;
                tsInterface.Extension = null;
                int internalCallerExtension = 0;

                // Check to see if this is an internal caller
                if (registrarService != null)
                {
                    try
                    {
                        WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow internalExtensionRow = dataProvider.GetExtensionNumber(Properties.Settings.Default.CustomerID, Convert.ToInt32(e.CallerPhoneNumber));

                        if (internalExtensionRow != null)
                        {
                            tsInterface.Extension = internalExtensionRow;
                            internalCallerExtension = internalExtensionRow.ExtensionNumber;

                            // Update our extension status
                            /*if (Properties.Settings.Default.EnableKinesisServer)
                            {
                                tsInterface.UpdateExtensionCallStatus(CallStatus.Dialing);
                            }*/
                        }
                    }
                    catch(Exception ex)
                    {
                    }
                }

                try
                {
                    int extensionNumber = Convert.ToInt32(e.CallingToNumber);
                    extension = dataProvider.GetExtensionNumber(Properties.Settings.Default.CustomerID, extensionNumber);
                }
                catch
                {
                }

                if (extension != null)
                {
                    // If this extension is calling itself, send it to the voicemail management script, otherwise send it to the extension.
                    if (e.CallerPhoneNumber == e.CallingToNumber)
                    {
                        // Start the voicemail processing script
                        tsInterface.ScriptProcessor = new VoicemailManagementScriptProcessor(extension, registrarService);

                        if (telecomProvider.IsLineInUse(e.LineNumber))
                        {
                            telecomProvider.AnswerCall(e.LineNumber, tsInterface.Extension == null ? false : true);
                        }
                    }
                    else
                    {
                        // Send the caller to the requested extension
                        if (telecomProvider.IsLineInUse(e.LineNumber))
                        {
                            telecomProvider.AnswerCall(e.LineNumber, tsInterface.Extension == null ? false : true);
                        }

                        TransferToExtension(extension.ExtensionNumber.ToString(), tsInterface, true);
                    }

                    return;
                }

                if (tsInterface.Extension != null)
                {
                    // If dialing "*", send the internal caller to the main menu
                    if (e.CallingToNumber == "*" || e.CallingToNumber.Trim() == "")
                    {
                    }
                    // This is an internal caller trying to make an outbound call
                    else if (Properties.Settings.Default.AllowOutboundDialing && e.CallingToNumber.StartsWith(Properties.Settings.Default.OutboundDialingPrefix))
                    {
                        if (MakeOutboundCall(tsInterface, e.CallingToNumber, e.CallerDisplayName, null, null, internalCallerExtension, true, false))
                        {
                            telecomProvider.AnswerCall(e.LineNumber, tsInterface.Extension == null ? false : true);

                            return;
                        }
                    }
                }

                // Should we be trying the receptionist first?
                if (Properties.Settings.Default.TryReceptionistFirst)
                {
                    WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow recepExtension = dataProvider.GetExtension(Properties.Settings.Default.CustomerID, Properties.Settings.Default.ReceptionistExtensionID);

                    if (recepExtension != null)
                    {
                        ReceptionistFinderScriptProcessor recepSp = new ReceptionistFinderScriptProcessor(recepExtension, this);
                        TransferToExtension(recepExtension.ExtensionNumber.ToString(), recepSp, tsInterface, true);
                        return;
                    }
                }

                ProcessAutoAttendantAnswer(e.LineNumber, tsInterface, true);
            }
        }
Beispiel #11
0
 void telecomProvider_CallConnected(object sender, CallEventArgs e)
 {
     PerformanceCounterService.IncrementTotalCalls();
     UpdatePerformanceCounters();
 }