/// <summary>
        /// Boots this instance.
        /// </summary>
        public void Boot()
        {
            DotNetEnv.Env.Load(new DotNetEnv.Env.LoadOptions(parseVariables: false));

            var builder = new ConfigurationBuilder();

            // tell the builder to look for the appsettings.json file
            builder
            .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
            .AddEnvironmentVariables();

            var configuration = builder.Build();

            ServiceCollection = new ServiceCollection();
            ServiceCollection.AddCoreServices(configuration);

            ServiceProvider = ServiceCollection.BuildServiceProvider();

            _logger = Resolve <IGraphLogger>();

            try
            {
                _settings = Resolve <IOptions <AzureSettings> >().Value;
                _settings.Initialize();
                Resolve <IEventPublisher>();
                _botService = Resolve <IBotService>();
            }
            catch (Exception e)
            {
                _logger.Error(e, "Unhandled exception in Boot()");
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="BotMediaStream" /> class.
        /// </summary>
        /// <param name="mediaSession">he media session.</param>
        /// <param name="callId">The call identity</param>
        /// <param name="logger">The logger.</param>
        /// <param name="eventPublisher">Event Publisher</param>
        /// <param name="settings">Azure settings</param>
        /// <exception cref="InvalidOperationException">A mediaSession needs to have at least an audioSocket</exception>
        public BotMediaStream(
            ILocalMediaSession mediaSession,
            string callId,
            IGraphLogger logger,
            IEventPublisher eventPublisher,
            IAzureSettings settings
            )
            : base(logger)
        {
            ArgumentVerifier.ThrowOnNullArgument(mediaSession, nameof(mediaSession));
            ArgumentVerifier.ThrowOnNullArgument(logger, nameof(logger));
            ArgumentVerifier.ThrowOnNullArgument(settings, nameof(settings));

            this.participants = new List <IParticipant>();

            _eventPublisher = eventPublisher;
            _callId         = callId;
            _mediaStream    = new MediaStream(
                settings,
                logger,
                mediaSession.MediaSessionId.ToString()
                );

            // Subscribe to the audio media.
            this._audioSocket = mediaSession.AudioSocket;
            if (this._audioSocket == null)
            {
                throw new InvalidOperationException("A mediaSession needs to have at least an audioSocket");
            }

            this._audioSocket.AudioMediaReceived += this.OnAudioMediaReceived;
        }
Example #3
0
 public AsyncBlobRepositoryFactory(IConnectionStringProvider connectionStringProvider,
                                   ILoggerFactory loggerFactory,
                                   IAzureSettings azureSettings)
 {
     _connectionStringProvider = connectionStringProvider;
     _loggerFactory            = loggerFactory;
     _azureSettings            = azureSettings;
 }
Example #4
0
 public QueueFactory(IQueueSerializer queueSerializer,
                     ILoggerFactory loggerFactory,
                     IConnectionStringProvider connectionStringProvider,
                     IAzureSettings azureSettings)
 {
     _queueSerializer          = queueSerializer ?? throw new ArgumentNullException(nameof(queueSerializer));
     _loggerFactory            = loggerFactory;
     _connectionStringProvider = connectionStringProvider;
     _azureSettings            = azureSettings;
 }
Example #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BotService" /> class.

        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="eventPublisher">The event publisher.</param>
        /// <param name="settings">The settings.</param>
        public BotService(
            IGraphLogger logger,
            IEventPublisher eventPublisher,
            IAzureSettings settings

            )
        {
            _logger         = logger;
            _eventPublisher = eventPublisher;
            _settings       = (AzureSettings)settings;
        }
Example #6
0
 public TableStorageRepositoryFactory(
     ITableStorageQueryBuilder tableStorageQueryBuilder,
     ITableContinuationTokenSerializer tableContinuationTokenSerializer,
     IConnectionStringProvider connectionStringProvider,
     ILoggerFactory loggerFactory,
     IAzureSettings azureSettings)
 {
     _tableStorageQueryBuilder         = tableStorageQueryBuilder;
     _tableContinuationTokenSerializer = tableContinuationTokenSerializer;
     _connectionStringProvider         = connectionStringProvider;
     _loggerFactory = loggerFactory;
     _azureSettings = azureSettings;
 }
        public AzureDeliveryService(IPathService pathService, IAzureSettings azureSettings)
        {
            if (String.IsNullOrEmpty(azureSettings.Authority) ||
                String.IsNullOrEmpty(azureSettings.ClientId) ||
                String.IsNullOrEmpty(azureSettings.ClientSecret) ||
                String.IsNullOrEmpty(azureSettings.EndpointName) ||
                String.IsNullOrEmpty(azureSettings.ProfileName) ||
                String.IsNullOrEmpty(azureSettings.ResourceGroupName) ||
                String.IsNullOrEmpty(azureSettings.SubscriptionId))
            {
                throw new ArgumentException($"{nameof(azureSettings)} is not fully instantiated.");
            }

            this.pathService   = pathService;
            this.azureSettings = azureSettings;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CallHandler" /> class.
        /// </summary>
        /// <param name="statefulCall">The stateful call.</param>
        /// <param name="settings">The settings.</param>
        /// <param name="eventPublisher">The event publisher.</param>
        public CallHandler(
            ICall statefulCall,
            IAzureSettings settings,
            IEventPublisher eventPublisher
            )
            : base(TimeSpan.FromMinutes(10), statefulCall?.GraphLogger)
        {
            _settings       = (AzureSettings)settings;
            _eventPublisher = eventPublisher;

            this.Call            = statefulCall;
            this.Call.OnUpdated += this.CallOnUpdated;
            this.Call.Participants.OnUpdated += this.ParticipantsOnUpdated;

            this.BotMediaStream = new BotMediaStream(this.Call.GetLocalMediaSession(), this.Call.Id, this.GraphLogger, eventPublisher, _settings);

            if (_settings.CaptureEvents)
            {
                var path = Path.Combine(Path.GetTempPath(), BotConstants.DefaultOutputFolder, _settings.EventsFolder, statefulCall.GetLocalMediaSession().MediaSessionId.ToString(), "participants");
                _capture = new CaptureEvents(path);
            }
        }
 public LearningAimsClient(IAzureSettings settings)
     : base(settings.SearchServiceName, AzureIndexes.LearningDeliveryIndex, new SearchCredentials(settings.SearchServiceAdminApiKey))
 {
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="JoinCallController" /> class.

        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="eventPublisher">The event publisher.</param>
        /// <param name="botService">The bot service.</param>
        /// <param name="settings">The settings.</param>
        public JoinCallController(IGraphLogger logger, IEventPublisher eventPublisher, IBotService botService, IAzureSettings settings)
        {
            _logger         = logger;
            _botService     = botService;
            _settings       = (AzureSettings)settings;
            _eventPublisher = eventPublisher;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="MediaStream" /> class.

        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="logger">The logger.</param>
        /// <param name="mediaId">The media identifier.</param>
        public MediaStream(IAzureSettings settings, IGraphLogger logger, string mediaId)
        {
            _settings = (AzureSettings)settings;
            _logger   = logger;
            _mediaId  = mediaId;
        }
Example #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AudioProcessor" /> class.
 /// </summary>
 /// <param name="settings">The settings.</param>
 public AudioProcessor(IAzureSettings settings)
 {
     _processorId = Guid.NewGuid().ToString();
     _settings    = (AzureSettings)settings;
 }
Example #13
0
 private static void InitialiseAsLightBlue()
 {
     _azureSettings = new StandaloneAzureSettings(LightBlueConfiguration.StandaloneConfiguration);
     _azureLocalResources = new StandaloneAzureLocalResourceSource(LightBlueConfiguration.StandaloneConfiguration, StandaloneEnvironment.LightBlueDataDirectory);
     _azureBlobContainerFactory = uri => new StandaloneAzureBlobContainer(uri);
 }
Example #14
0
 private static void InitialiseAsHosted()
 {
     _azureSettings = new HostedAzureSettings();
     _azureLocalResources = new HostedAzureLocalResourceSource();
     _azureBlobContainerFactory = uri => new HostedAzureBlobContainer(uri);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="MySTT"/> class.
        /// </summary>
        /// <param name="aCallId">Name.</param>
        /// <param name="aWho">Name..</param>
        /// <param name="aWhoId">Name...</param>
        public MySTT(string aCallId, string aWho, string aWhoId, IGraphLogger logger, IEventPublisher eventPublisher, IAzureSettings settings)
        {
            try
            {
                _eventPublisher = eventPublisher;
                _settings       = (AzureSettings)settings;

                this.mCallId = aCallId;
                this.mWho    = aWho;
                this.mWhoId  = aWhoId;

                this.SetupTranscriptionAndTranslationService();
                this.SetupPersistanceEndPoint();
            }
            catch (Exception ex)
            {
                _eventPublisher.Publish("MySTT Instantiation - Failed", $"{ex.Message}");
            }
        }
Example #16
0
 public AzureService(IAzureSettings azureSettings, ISessionDetailRepository sessionDetailRepository, IUserSessionRepository userSessionRepository)
 {
     _azureSettings           = azureSettings;
     _sessionDetailRepository = sessionDetailRepository;
     _userSessionRepository   = userSessionRepository;
 }
 public StorageQueue(IAzureSettings settings)
 {
     LogTo.Debug("Connecting to Azure Storage");
     this.account = CloudStorageAccount.Parse(settings.ConnectionString);
 }
 public FrameworkClient(IAzureSettings settings)
     : base(settings.SearchServiceName, AzureIndexes.FrameworkIndex, new SearchCredentials(settings.SearchServiceAdminApiKey))
 {
 }
Example #19
0
 public UnitsClient(IAzureSettings settings)
     : base(settings.SearchServiceName, AzureIndexes.UnitIndex, new SearchCredentials(settings.SearchServiceAdminApiKey))
 {
 }