/// <summary> /// Initialize the instance. /// </summary> /// <param name="service">Service instance.</param> /// <param name="logger">Graph logger.</param> internal void Initialize(Service service, IGraphLogger logger) { Validator.IsNull(this.Logger, "Multiple initializations are not allowed."); this.Logger = logger; var builder = new StatefulClientBuilder("AudioVideoPlaybackBot", service.Configuration.AadAppId, this.Logger); var authProvider = new AuthenticationProvider( service.Configuration.AadAppId, service.Configuration.AadAppSecret, this.Logger); builder.SetAuthenticationProvider(authProvider); builder.SetNotificationUrl(service.Configuration.CallControlBaseUrl); builder.SetMediaPlatformSettings(service.Configuration.MediaPlatformSettings); builder.SetServiceBaseUrl(service.Configuration.PlaceCallEndpointUrl); this.Client = builder.Build(); this.Client.Calls().OnIncoming += this.CallsOnIncoming; this.Client.Calls().OnUpdated += this.CallsOnUpdated; this.OnlineMeetings = new OnlineMeetingHelper(authProvider, service.Configuration.PlaceCallEndpointUrl); }
/// <summary> /// Initializes a new instance of the <see cref="Bot"/> class. /// </summary> /// <param name="options">The bot options.</param> /// <param name="graphLogger">The graph logger.</param> /// <param name="serviceContext">Service context.</param> public Bot(BotOptions options, IGraphLogger graphLogger, StatefulServiceContext serviceContext) { this.Options = options; this.logger = graphLogger; var authProvider = new AuthenticationProvider( options.AppId, options.AppSecret, this.logger); var builder = new StatefulClientBuilder("HueBot", options.AppId, this.logger); builder.SetAuthenticationProvider(authProvider); builder.SetNotificationUrl(options.BotBaseUrl.ReplacePort(options.BotBaseUrl.Port + serviceContext.NodeInstance())); builder.SetMediaPlatformSettings(this.MediaInit(options, serviceContext)); builder.SetServiceBaseUrl(options.PlaceCallEndpointUrl); this.Client = builder.Build(); this.Client.Calls().OnIncoming += this.CallsOnIncoming; this.Client.Calls().OnUpdated += this.CallsOnUpdated; this.OnlineMeetings = new OnlineMeetingHelper(authProvider, options.PlaceCallEndpointUrl); }
/// <summary> /// Initializes a new instance of the <see cref="Bot"/> class. /// </summary> /// <param name="options">The bot options</param> /// <param name="loggerFactory">The logger factory</param> public Bot(BotOptions options, IGraphLogger graphLogger) { var instanceNotificationUri = CallAffinityMiddleware.GetWebInstanceCallbackUri(new Uri(options.BotBaseUrl, HttpRouteConstants.OnIncomingRequestRoute)); this.graphLogger = graphLogger; this.baseURL = options.BotBaseUrl; var authProvider = new AuthenticationProvider( options.AppId, options.AppSecret, this.graphLogger); var builder = new StatefulClientBuilder("TeamsIVRBotSample", options.AppId, this.graphLogger); builder.SetAuthenticationProvider(authProvider); builder.SetNotificationUrl(instanceNotificationUri); builder.SetServiceBaseUrl(options.PlaceCallEndpointUrl); this.Client = builder.Build(); this.Client.Calls().OnIncoming += this.CallsOnIncoming; this.Client.Calls().OnUpdated += this.CallsOnUpdated; }
/// <summary> /// Initializes a new instance of the <see cref="Bot" /> class. /// </summary> /// <param name="options">The bot options.</param> /// <param name="graphLogger">The graph logger.</param> public Bot(BotOptions options, IGraphLogger graphLogger) { var instanceNotificationUri = CallAffinityMiddleware.GetWebInstanceCallbackUri(new Uri(options.BotBaseUrl, HttpRouteConstants.OnIncomingRequestRoute)); this.graphLogger = graphLogger; var authProvider = new AuthenticationProvider( options.AppId, options.AppSecret, this.graphLogger); var builder = new StatefulClientBuilder("IcmBot", options.AppId, this.graphLogger); builder.SetAuthenticationProvider(authProvider); builder.SetNotificationUrl(instanceNotificationUri); builder.SetServiceBaseUrl(options.PlaceCallEndpointUrl); this.Client = builder.Build(); this.Client.Calls().OnIncoming += this.CallsOnIncoming; this.Client.Calls().OnUpdated += this.CallsOnUpdated; this.IncidentStatusManager = new IncidentStatusManager(); var audioBaseUri = options.BotBaseUrl; this.MediaMap[Bot.TransferingPromptName] = new MediaPrompt { MediaInfo = new MediaInfo { Uri = new Uri(audioBaseUri, "audio/responder-transfering.wav").ToString(), ResourceId = Guid.NewGuid().ToString(), }, Loop = 1, }; this.MediaMap[Bot.NotificationPromptName] = new MediaPrompt { MediaInfo = new MediaInfo { Uri = new Uri(audioBaseUri, "audio/responder-notification.wav").ToString(), ResourceId = Guid.NewGuid().ToString(), }, Loop = 1, }; this.MediaMap[Bot.BotIncomingPromptName] = new MediaPrompt { MediaInfo = new MediaInfo { Uri = new Uri(audioBaseUri, "audio/bot-incoming.wav").ToString(), ResourceId = Guid.NewGuid().ToString(), }, Loop = 1, }; this.MediaMap[Bot.BotEndpointIncomingPromptName] = new MediaPrompt { MediaInfo = new MediaInfo { Uri = new Uri(audioBaseUri, "audio/bot-endpoint-incoming.wav").ToString(), ResourceId = Guid.NewGuid().ToString(), }, Loop = 1, }; this.OnlineMeetings = new OnlineMeetingHelper(authProvider, options.PlaceCallEndpointUrl); }