|  |  |  | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.transmit.event.response.ISIPResponseProcessor; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.transmit.event.timeout.ITimeoutProcessor; | 
|---|
|  |  |  | import gov.nist.javax.sip.message.SIPRequest; | 
|---|
|  |  |  | import org.slf4j.Logger; | 
|---|
|  |  |  | import org.slf4j.LoggerFactory; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | 
|---|
|  |  |  | import javax.sip.header.*; | 
|---|
|  |  |  | import javax.sip.message.Request; | 
|---|
|  |  |  | import javax.sip.message.Response; | 
|---|
|  |  |  | import java.net.InetAddress; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  | import java.util.concurrent.ConcurrentHashMap; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | * @param requestEvent RequestEvent事件 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | @Async | 
|---|
|  |  |  | @Async("taskExecutor") | 
|---|
|  |  |  | public void processRequest(RequestEvent requestEvent) { | 
|---|
|  |  |  | String method = requestEvent.getRequest().getMethod(); | 
|---|
|  |  |  | if ("NOTIFY".equalsIgnoreCase(requestEvent.getRequest().getMethod())) { | 
|---|
|  |  |  | System.out.println(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ISIPRequestProcessor sipRequestProcessor = requestProcessorMap.get(method); | 
|---|
|  |  |  | if (sipRequestProcessor == null) { | 
|---|
|  |  |  | logger.warn("不支持方法{}的request", method); | 
|---|
|  |  |  | // TODO 回复错误玛 | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | requestProcessorMap.get(method).process(requestEvent); | 
|---|
|  |  |  | 
|---|
|  |  |  | * @param responseEvent responseEvent事件 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | @Async | 
|---|
|  |  |  | @Async("taskExecutor") | 
|---|
|  |  |  | public void processResponse(ResponseEvent responseEvent) { | 
|---|
|  |  |  | Response response = responseEvent.getResponse(); | 
|---|
|  |  |  | int status = response.getStatusCode(); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void processTransactionTerminated(TransactionTerminatedEvent transactionTerminatedEvent) { | 
|---|
|  |  |  | //        if (transactionTerminatedEvent.isServerTransaction()) { | 
|---|
|  |  |  | //            ServerTransaction serverTransaction = transactionTerminatedEvent.getServerTransaction(); | 
|---|
|  |  |  | //            serverTransaction.get | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //        Transaction transaction = null; | 
|---|
|  |  |  | //        System.out.println("processTransactionTerminated"); | 
|---|
|  |  |  | //        if (transactionTerminatedEvent.isServerTransaction()) { | 
|---|