public CdeCalls(ILogger <CdeApi> logger, ICde cde, IMediator mediator) { this.logger = logger; this.cde = cde; this.mediator = mediator; callStore = new CdeCallStore(); cde.Calling.CallStatusChanged += Calling_CallStatusChanged; cde.Calling.IncomingCall += Calling_IncomingCall; cde.Calling.CallInfo += Calling_CallInfo; }
public CdeCallsThreadSafe(ILogger logger, ICde cde, IMediator mediator) { callStore = new CdeCallStore(); cde.Calling.CallStatusChanged += (sender, e) => { logger.LogInformation("[{EventName}] {@EventArgs}", "CallStatusChanged", e); cdeEvents.Add(new CdeCall { CallStatusChanged = e }); }; cde.Calling.IncomingCall += (sender, e) => { logger.LogInformation("[{EventName}] {@EventArgs}", "IncomingCall", e); cdeEvents.Add(new CdeCall { IncomingCall = e }); }; cde.Calling.CallInfo += (sender, e) => { logger.LogInformation("[{EventName}] {@EventArgs}", "CallInfo", e); cdeEvents.Add(new CdeCall { CallInfo = e }); }; this.logger = logger; this.cde = cde; this.mediator = mediator; Task.Run(StartEventProcessing); }