| | |
| | | package com.genersoft.iot.vmp.gb28181;
|
| | |
|
| | | import com.genersoft.iot.vmp.conf.SipConfig;
|
| | | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
|
| | | import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver;
|
| | | import com.genersoft.iot.vmp.gb28181.transmit.ISIPProcessorObserver;
|
| | | import gov.nist.javax.sip.SipProviderImpl;
|
| | | import gov.nist.javax.sip.SipStackImpl;
|
| | | import org.slf4j.Logger;
|
| | |
| | | private SipConfig sipConfig;
|
| | |
|
| | | @Autowired
|
| | | private SIPProcessorObserver sipProcessorObserver;
|
| | |
|
| | | @Autowired
|
| | | private SipSubscribe sipSubscribe;
|
| | | private ISIPProcessorObserver sipProcessorObserver;
|
| | |
|
| | | private SipStackImpl sipStack;
|
| | |
|
| | | private SipFactory sipFactory;
|
| | |
|
| | | /** |
| | | * 消息处理器线程池
|
| | | */
|
| | | private ThreadPoolExecutor processThreadPool;
|
| | |
|
| | | public SipLayer() {
|
| | | int processThreadNum = Runtime.getRuntime().availableProcessors() * 10;
|
| | | LinkedBlockingQueue<Runnable> processQueue = new LinkedBlockingQueue<>(10000);
|
| | | processThreadPool = new ThreadPoolExecutor(processThreadNum,processThreadNum,
|
| | | 0L,TimeUnit.MILLISECONDS,processQueue,
|
| | | new ThreadPoolExecutor.CallerRunsPolicy());
|
| | | }
|
| | |
|
| | |
|
| | | @Bean("sipFactory")
|
| | |
| | | try {
|
| | | tcpListeningPoint = sipStack.createListeningPoint(sipConfig.getMonitorIp(), sipConfig.getPort(), "TCP");
|
| | | tcpSipProvider = (SipProviderImpl)sipStack.createSipProvider(tcpListeningPoint);
|
| | | tcpSipProvider.setDialogErrorsAutomaticallyHandled();
|
| | | tcpSipProvider.addSipListener(sipProcessorObserver);
|
| | | logger.info("Sip Server TCP 启动成功 port {" + sipConfig.getMonitorIp() + ":" + sipConfig.getPort() + "}");
|
| | | } catch (TransportNotSupportedException e) {
|