|
|
@@ -1,8 +1,11 @@ |
|
|
|
using JT1078.Gateway.Services; |
|
|
|
using JT1078.Gateway.Abstractions; |
|
|
|
using JT1078.Gateway.Services; |
|
|
|
using JT1078.Gateway.Sessions; |
|
|
|
using Microsoft.Extensions.Hosting; |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Diagnostics.CodeAnalysis; |
|
|
|
using System.Text; |
|
|
|
using System.Text.Json; |
|
|
|
using System.Threading; |
|
|
@@ -15,12 +18,15 @@ namespace JT1078.Gateway.Jobs |
|
|
|
{ |
|
|
|
private readonly ILogger logger; |
|
|
|
private JT1078SessionNoticeService SessionNoticeService; |
|
|
|
private JT1078HttpSessionManager HttpSessionManager; |
|
|
|
public JT1078SessionNoticeJob( |
|
|
|
JT1078SessionNoticeService sessionNoticeService, |
|
|
|
ILoggerFactory loggerFactory) |
|
|
|
ILoggerFactory loggerFactory, |
|
|
|
[AllowNull]JT1078HttpSessionManager jT1078HttpSessionManager=null) |
|
|
|
{ |
|
|
|
logger = loggerFactory.CreateLogger<JT1078SessionNoticeJob>(); |
|
|
|
SessionNoticeService = sessionNoticeService; |
|
|
|
HttpSessionManager = jT1078HttpSessionManager; |
|
|
|
} |
|
|
|
|
|
|
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken) |
|
|
@@ -34,6 +40,14 @@ namespace JT1078.Gateway.Jobs |
|
|
|
{ |
|
|
|
logger.LogInformation($"[Notice]:{notice.TerminalPhoneNo}-{notice.ProtocolType}-{notice.SessionType}"); |
|
|
|
} |
|
|
|
if(JT1078GatewayConstants.SessionOffline== notice.SessionType) |
|
|
|
{ |
|
|
|
if (HttpSessionManager != null) |
|
|
|
{ |
|
|
|
//当1078设备主动断开的情况下,需要关闭所有再观看的连接 |
|
|
|
HttpSessionManager.TryRemoveBySim(notice.TerminalPhoneNo); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
catch |
|
|
|