Exemplo n.º 1
0
        private async void AriClientOnStasisStartEvent(IAriClient sender, StasisStartEvent e)
        {
            var   callScope = Tracer.Instance.StartActive("NewCall");
            ICall line;

            using (var answerScope = Tracer.Instance.StartActive("AnswerCall"))
            {
                if (e.Args.Contains("dialed") || e.Args.Contains("SnoopChannel"))
                {
                    return;
                }
                callScope.Span.SetTag("ChannelId", e.Channel.Id);
                _logger.Info("Line Offhook", new
                {
                    ChannelId      = e.Channel.Id,
                    CallerIdName   = e.Channel.Caller.Number,
                    CallerIdNumber = e.Channel.Caller.Name
                });
                line = ArkeCallFactory.CreateArkeCall(e.Channel, callScope);
                ConnectedLines.Add(e.Channel.Id, line);
                _logger.Info("Starting Call Script", new
                {
                    ChannelId = e.Channel.Id
                });
            }
            // call answered and started
            await line.RunCallScript();

            _logger.Info("Call Script Complete", new { ChannelId = e.Channel.Id });
            callScope.Close();
        }
Exemplo n.º 2
0
        private async void AriClientOnStasisStartEvent(IAriClient sender, StasisStartEvent e)
        {
            ICall line;

            if (e.Args.Contains("dialed") || e.Args.Contains("SnoopChannel"))
            {
                return;
            }
            _logger.Info("Line Offhook", new
            {
                ChannelId      = e.Channel.Id,
                CallerIdName   = e.Channel.Caller.Number,
                CallerIdNumber = e.Channel.Caller.Name
            });
            line = ArkeCallFactory.CreateArkeCall(e.Channel);
            ConnectedLines.Add(e.Channel.Id, line);
            _logger.Info("Starting Call Script", new
            {
                ChannelId = e.Channel.Id
            });

            // call answered and started
            await line.RunCallScript();

            _logger.Info("Call Script Complete", new { ChannelId = e.Channel.Id });
        }
Exemplo n.º 3
0
        private async void AriClientOnStasisStartEvent(IAriClient sender, StasisStartEvent e)
        {
            _logger.Debug($"Line Connecting: {e.Channel.Name}");

            if (e.Args.Contains("dialed") || e.Args.Contains("SnoopChannel"))
            {
                return;
            }
            _logger.Information("Line Offhook", new
            {
                ChannelId      = e.Channel.Id,
                CallerIdName   = e.Channel.Caller.Number,
                CallerIdNumber = e.Channel.Caller.Name
            });
            var line = ArkeCallFactory.CreateArkeCall(e.Channel);

            ConnectedLines.Add(e.Channel.Id, line);
            _logger.Information("Starting Call Script", new
            {
                ChannelId = e.Channel.Id
            });

            // call answered and started
            await line.RunCallScriptAsync(_cancellationToken);

            await Task.Delay(1000, _cancellationToken);

            _logger.Information("Call Script Complete", new { ChannelId = e.Channel.Id });
        }