Example #1
0
        protected BasicChannel(EventMessage eventMessage, EventSocket eventSocket)
        {
            Log = LogProvider.GetLogger(GetType());

            UUID = eventMessage.UUID;
            lastEvent = eventMessage;
            this.eventSocket = eventSocket;

            Disposables.Add(
                eventSocket.Events
                           .Where(x => x.UUID == UUID)
                           .Subscribe(
                               e =>
                                   {
                                       lastEvent = e;

                                       if (e.EventName == EventName.ChannelAnswer)
                                       {
                                           Log.Info(() => "Channel [{0}] Answered".Fmt(UUID));
                                       }

                                       if (e.EventName == EventName.ChannelHangup)
                                       {
                                           Log.Info(() => "Channel [{0}] Hangup Detected [{1}]".Fmt(UUID, e.HangupCause));
                                           HangupCallBack(e);
                                       }
                                   }));
        }
Example #2
0
        protected Channel(EventMessage eventMessage, EventSocket eventSocket) : base(eventMessage, eventSocket)
        {
            //populate empty bridge status
            Bridge = new BridgeStatus(false, null);
            ExitOnHangup = true;

            Task.WhenAll(
                new[]
                    {
                        eventSocket.SubscribeEvents(), //subscribe to minimum events
                        eventSocket.Filter(HeaderNames.UniqueId, UUID), //filter for our unique id (in case using full socket mode)
                        eventSocket.Filter(HeaderNames.OtherLegUniqueId, UUID) //filter for channels bridging to our unique id
                    }).ContinueWith(
                        t =>
                            {
                                if (t.IsFaulted && t.Exception != null)
                                {
                                    Log.ErrorException("Channel [{0}] - failed to configure outbound socket for Channel usage".Fmt(UUID), t.Exception.InnerException);
                                    return;
                                }

                                this.InitializeSubscriptions();
                            });
        }
Example #3
0
 protected internal BridgedChannel(EventMessage eventMessage, EventSocket eventSocket) : base(eventMessage, eventSocket)
 {
 }
 private static void LogFailedApplicationResult(EventSocket eventSocket, ApplicationResult result)
 {
     if (result.ChannelData != null)
     {
         LogProvider.GetLogger(eventSocket.GetType())
                    .Error(
                        () =>
                        "Application {0} {1} failed - {2}".Fmt(
                            result.ChannelData.Headers[HeaderNames.Application],
                            result.ChannelData.Headers[HeaderNames.ApplicationData],
                            result.ChannelData.Headers[HeaderNames.ApplicationResponse]));
     }
 }