Beispiel #1
0
        public Task AriClient_OnPlaybackFinishedEvent(ISipApiClient sipApiClient, PromptPlaybackFinishedEvent e)
        {
            if (e.PlaybackId != _currentPlaybackId)
            {
                return(Task.CompletedTask);
            }
            if (_arkeCall.GetCurrentState() == State.StoppingPlayback)
            {
                return(Task.CompletedTask);
            }

            _arkeCall.CallStateMachine.Fire(
                _promptQueue.Count == 0 ? Trigger.FinishedPrompt : Trigger.PlayNextPrompt);
            return(Task.CompletedTask);
        }
Beispiel #2
0
 public async Task HandlePromptFinishedEvent(ISipApiClient sipApiClient, PromptPlaybackFinishedEvent e)
 {
     if (e.PlaybackId != _currentPlaybackId)
     {
         return;
     }
     if (_asteriskCall.GetCurrentState() == State.StoppingPlayback)
     {
         return;
     }
     if (_promptQueue.Count == 0)
     {
         if (_asteriskCall.GetCurrentState() != State.LanguageInput)
         {
             _asteriskCall.FireStateChange(Trigger.GetLanguageInput);
         }
         _stepProcessor.StartTimeoutTimer();
     }
     else
     {
         await PlayNextPromptInQueue();
     }
 }
Beispiel #3
0
        private async Task AriClient_OnPlaybackFinishedEvent(ISipApiClient sipApiClient, PromptPlaybackFinishedEvent e)
        {
            LogData.Add("PlaybackId", e.PlaybackId);
            if (e.PlaybackId != _currentPlaybackId)
            {
                return;
            }

            await Task.Delay(TimeSpan.FromSeconds(5));

            if (_call.GetCurrentState() != State.OnHold)
            {
                return;
            }

            _currentPlaybackId = await _call.SipBridgingApi.PlayPromptToBridge(_call.CallState.GetBridgeId(), HoldPrompt, "en");

            _call.Logger.Info("Playback finished", LogData);
        }
Beispiel #4
0
        private async Task AriClient_OnPlaybackFinishedAsyncEvent(ISipApiClient sipApiClient, PromptPlaybackFinishedEvent e)
        {
            _call.Logger.Information("Playback finished {PlaybackId} {@Call}", e.PlaybackId, _call.CallState);
            AddPlaybackIdToLogData(e.PlaybackId);

            if (e.PlaybackId != _currentPlaybackId)
            {
                return;
            }
            if (_call.GetCurrentState() == State.InCall)
            {
                return;
            }
            await Task.Delay(TimeSpan.FromSeconds(5));

            if (_call.CallState.Bridge.Id != _holdingBridge.Id)
            {
                return;
            }

            try
            {
                _currentPlaybackId = await _call.SipBridgingApi.PlayPromptToBridgeAsync(_call.CallState.Bridge.Id, _call.CallState.HoldPrompt, _call.CallState.LanguageCode);
            }
            catch (Exception exception)
            {
                _call.Logger.Warning(exception, "Think the call has probably hungup");
                RemoveEventSubscriptions();
            }

            _call.Logger.Information("Playback started {currentPlaybackId}, of prompt {HoldPrompt}, to bridge {BridgeName} {@Call}", _currentPlaybackId, _call.CallState.HoldPrompt, _call.CallState.Bridge.Name, _call.CallState);
        }