示例#1
0
        public AriClient(
            IActionConsumer actionConsumer,
            IEventProducer eventProducer,
            string application,
            bool subscribeAllEvents = false,
            bool ssl = false)
        {
            _actionConsumer          = actionConsumer;
            _eventProducer           = eventProducer;
            EventDispatchingStrategy = DefaultEventDispatchingStrategy;

            // Setup Action Properties
            Asterisk     = new AsteriskActions(_actionConsumer);
            Applications = new ApplicationsActions(_actionConsumer);
            Bridges      = new BridgesActions(_actionConsumer);
            Channels     = new ChannelsActions(_actionConsumer);
            DeviceStates = new DeviceStatesActions(_actionConsumer);
            Endpoints    = new EndpointsActions(_actionConsumer);
            Events       = new EventsActions(_actionConsumer);
            Mailboxes    = new MailboxesActions(_actionConsumer);
            Playbacks    = new PlaybacksActions(_actionConsumer);
            Recordings   = new RecordingsActions(_actionConsumer);
            Sounds       = new SoundsActions(_actionConsumer);
            // Setup Event Handlers
            _eventProducer.OnMessageReceived        += _eventProducer_OnMessageReceived;
            _eventProducer.OnConnectionStateChanged += _eventProducer_OnConnectionStateChanged;

            _subscribeAllEvents = subscribeAllEvents;
            _ssl = ssl;
        }
        public BrokerSession(AriBrokerClient client,
                             string dialogueId,
                             string serverId,
                             IConsumer eventQueue,
                             IConsumer actionResponseQueue,
                             IProducer actionRequestQueue)
        {
            _client             = client;
            DialogueId          = dialogueId;
            ServerId            = serverId;
            EventQueue          = eventQueue;
            ActionResponseQueue = actionResponseQueue;
            ActionRequestQueue  = actionRequestQueue;

            InternalEvent += ARIClient_internalEvent;

            // Create Action Consumer for Session
            _dialogueActionConsumer = new ActionConsumer(actionRequestQueue, actionResponseQueue);

            // Init Actions
            Asterisk     = new AsteriskActions(_dialogueActionConsumer);
            Applications = new ApplicationsActions(_dialogueActionConsumer);
            Bridges      = new BridgesActions(_dialogueActionConsumer);
            Channels     = new ChannelsActions(_dialogueActionConsumer);
            DeviceStates = new DeviceStatesActions(_dialogueActionConsumer);
            Endpoints    = new EndpointsActions(_dialogueActionConsumer);
            Events       = new EventsActions(_dialogueActionConsumer);
            Playbacks    = new PlaybacksActions(_dialogueActionConsumer);
            Recordings   = new RecordingsActions(_dialogueActionConsumer);
            Sounds       = new SoundsActions(_dialogueActionConsumer);
        }