| | |
| | | import javax.sip.Dialog;
|
| | | import javax.sip.InvalidArgumentException;
|
| | | import javax.sip.SipException;
|
| | | import javax.sip.SipFactory;
|
| | | import javax.sip.SipProvider;
|
| | | import javax.sip.TransactionDoesNotExistException;
|
| | | import javax.sip.address.SipURI;
|
| | |
| | | import javax.sip.message.Request;
|
| | |
|
| | | import com.alibaba.fastjson.JSONObject;
|
| | | import com.genersoft.iot.vmp.common.StreamInfo;
|
| | | import com.genersoft.iot.vmp.conf.MediaServerConfig;
|
| | | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
| | | import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookSubscribe;
|
| | | import com.genersoft.iot.vmp.media.zlm.ZLMUtils;
|
| | | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
|
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.beans.factory.annotation.Qualifier;
|
| | |
| | | private SipProvider udpSipProvider;
|
| | |
|
| | | @Autowired
|
| | | private ZLMUtils zlmUtils;
|
| | | private ZLMRTPServerFactory zlmrtpServerFactory;
|
| | |
|
| | | @Value("${media.rtp.enable}")
|
| | | private boolean rtpEnable;
|
| | |
| | | String mediaPort = null;
|
| | | // 使用动态udp端口
|
| | | if (rtpEnable) {
|
| | | mediaPort = zlmUtils.getNewRTPPort(streamId) + "";
|
| | | mediaPort = zlmrtpServerFactory.createRTPServer(streamId) + "";
|
| | | }else {
|
| | | mediaPort = mediaInfo.getRtpProxyPort();
|
| | | }
|
| | |
| | | String mediaPort = null;
|
| | | // 使用动态udp端口
|
| | | if (rtpEnable) {
|
| | | mediaPort = zlmUtils.getNewRTPPort(streamId) + "";
|
| | | mediaPort = zlmrtpServerFactory.createRTPServer(streamId) + "";
|
| | | }else {
|
| | | mediaPort = mediaInfo.getRtpProxyPort();
|
| | | }
|
| | |
| | | }
|
| | | dialog.sendRequest(clientTransaction);
|
| | | streamSession.remove(streamId);
|
| | | zlmrtpServerFactory.closeRTPServer(streamId);
|
| | | } catch (TransactionDoesNotExistException e) {
|
| | | e.printStackTrace();
|
| | | } catch (SipException e) {
|
| | |
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public void closeRTPServer(Device device, String channelId) {
|
| | | if (rtpEnable) {
|
| | | String streamId = String.format("gb_play_%s_%s", device.getDeviceId(), channelId);
|
| | | zlmrtpServerFactory.closeRTPServer(streamId);
|
| | | }
|
| | | }
|
| | | }
|