|  |  |  | 
|---|
|  |  |  | import org.springframework.scheduling.annotation.Scheduled; | 
|---|
|  |  |  | import org.springframework.stereotype.Component; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.sip.*; | 
|---|
|  |  |  | import javax.sip.DialogTerminatedEvent; | 
|---|
|  |  |  | import javax.sip.ResponseEvent; | 
|---|
|  |  |  | import javax.sip.TimeoutEvent; | 
|---|
|  |  |  | import javax.sip.TransactionTerminatedEvent; | 
|---|
|  |  |  | import javax.sip.header.CallIdHeader; | 
|---|
|  |  |  | import javax.sip.message.Response; | 
|---|
|  |  |  | import java.text.ParseException; | 
|---|
|  |  |  | import java.time.Instant; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  | import java.util.concurrent.ConcurrentHashMap; | 
|---|
|  |  |  | 
|---|
|  |  |  | private Map<String, SipSubscribe.Event> okSubscribes = new ConcurrentHashMap<>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private Map<String, Instant> okTimeSubscribes = new ConcurrentHashMap<>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private Map<String, Instant> errorTimeSubscribes = new ConcurrentHashMap<>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //    @Scheduled(cron="*/5 * * * * ?")   //每五秒执行一次 | 
|---|
|  |  |  | 
|---|
|  |  |  | // 会话已结束 | 
|---|
|  |  |  | dialogTerminated, | 
|---|
|  |  |  | // 设备未找到 | 
|---|
|  |  |  | deviceNotFoundEvent | 
|---|
|  |  |  | deviceNotFoundEvent, | 
|---|
|  |  |  | // 设备未找到 | 
|---|
|  |  |  | cmdSendFailEvent | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static class EventResult<EventObject>{ | 
|---|
|  |  |  | 
|---|
|  |  |  | public String callId; | 
|---|
|  |  |  | public EventObject event; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public EventResult() { | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public EventResult(EventObject event) { | 
|---|
|  |  |  | this.event = event; | 
|---|
|  |  |  | if (event instanceof ResponseEvent) { | 
|---|