Merge remote-tracking branch 'origin/wvp-28181-2.0' into wvp-28181-2.0
commit
d21d281b2c
|
@ -127,7 +127,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
|||
SipURI sipUri = (SipURI) request.getRequestURI();
|
||||
//从subject读取channelId,不再从request-line读取。 有些平台request-line是平台国标编码,不是设备国标编码。
|
||||
//String channelId = sipURI.getUser();
|
||||
String channelId = SipUtils.getChannelIdFromHeader(request);
|
||||
String channelId = SipUtils.getChannelIdFromRequest(request);
|
||||
String requesterId = SipUtils.getUserIdFromFromHeader(request);
|
||||
CallIdHeader callIdHeader = (CallIdHeader) request.getHeader(CallIdHeader.NAME);
|
||||
if (requesterId == null || channelId == null) {
|
||||
|
|
|
@ -27,6 +27,7 @@ import javax.sip.SipException;
|
|||
import javax.sip.address.SipURI;
|
||||
import javax.sip.header.CSeqHeader;
|
||||
import javax.sip.header.CallIdHeader;
|
||||
import javax.sip.message.Request;
|
||||
import javax.sip.message.Response;
|
||||
import java.text.ParseException;
|
||||
import java.util.Map;
|
||||
|
@ -68,22 +69,23 @@ public class MessageRequestProcessor extends SIPRequestProcessorParent implement
|
|||
|
||||
@Override
|
||||
public void process(RequestEvent evt) {
|
||||
SIPRequest sipRequest = (SIPRequest)evt.getRequest();
|
||||
logger.debug("接收到消息:" + evt.getRequest());
|
||||
String deviceId = SipUtils.getUserIdFromFromHeader(evt.getRequest());
|
||||
CallIdHeader callIdHeader = (CallIdHeader)evt.getRequest().getHeader(CallIdHeader.NAME);
|
||||
CallIdHeader callIdHeader = sipRequest.getCallIdHeader();
|
||||
// 先从会话内查找
|
||||
SsrcTransaction ssrcTransaction = sessionManager.getSsrcTransaction(null, null, callIdHeader.getCallId(), null);
|
||||
if (ssrcTransaction != null) { // 兼容海康 媒体通知 消息from字段不是设备ID的问题
|
||||
// 兼容海康 媒体通知 消息from字段不是设备ID的问题
|
||||
if (ssrcTransaction != null) {
|
||||
deviceId = ssrcTransaction.getDeviceId();
|
||||
}
|
||||
// 查询设备是否存在
|
||||
CSeqHeader cseqHeader = (CSeqHeader) evt.getRequest().getHeader(CSeqHeader.NAME);
|
||||
String method = cseqHeader.getMethod();
|
||||
Device device = redisCatchStorage.getDevice(deviceId);
|
||||
// 查询上级平台是否存在
|
||||
ParentPlatform parentPlatform = storage.queryParentPlatByServerGBId(deviceId);
|
||||
try {
|
||||
if (device != null && parentPlatform != null) {
|
||||
|
||||
logger.warn("[重复]平台与设备编号重复:{}", deviceId);
|
||||
SIPRequest request = (SIPRequest) evt.getRequest();
|
||||
String hostAddress = request.getRemoteAddress().getHostAddress();
|
||||
|
|
|
@ -23,9 +23,10 @@ public class SipUtils {
|
|||
/**
|
||||
* 从subject读取channelId
|
||||
* */
|
||||
public static String getChannelIdFromHeader(Request request) {
|
||||
public static String getChannelIdFromRequest(Request request) {
|
||||
Header subject = request.getHeader("subject");
|
||||
if (subject == null) {
|
||||
// 如果缺失subject
|
||||
return null;
|
||||
}
|
||||
return ((Subject) subject).getSubject().split(":")[0];
|
||||
|
|
|
@ -451,7 +451,6 @@ public class ZLMHttpHookListener {
|
|||
redisCatchStorage.stopPlayback(streamInfo.getDeviceID(), streamInfo.getChannelId(),
|
||||
streamInfo.getStream(), null);
|
||||
}
|
||||
|
||||
}
|
||||
}else {
|
||||
if (!"rtp".equals(app)){
|
||||
|
|
|
@ -85,6 +85,7 @@ public class ZLMMediaListManager {
|
|||
streamPushMapper.add(transform);
|
||||
}else {
|
||||
streamPushMapper.update(transform);
|
||||
gbStreamMapper.updateMediaServer(mediaItem.getApp(), mediaItem.getStream(), mediaItem.getMediaServerId());
|
||||
}
|
||||
if (transform != null) {
|
||||
if (getChannelOnlineEventLister(transform.getApp(), transform.getStream()) != null) {
|
||||
|
|
|
@ -492,6 +492,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
|||
try {
|
||||
int addStreamResult = streamPushMapper.add(stream);
|
||||
if (!StringUtils.isEmpty(stream.getGbId())) {
|
||||
stream.setStreamType("push");
|
||||
gbStreamMapper.add(stream);
|
||||
}
|
||||
dataSourceTransactionManager.commit(transactionStatus);
|
||||
|
|
|
@ -143,4 +143,9 @@ public interface GbStreamMapper {
|
|||
"</foreach>" +
|
||||
"</script>")
|
||||
List<GbStream> selectAllForAppAndStream(List<StreamPushItem> streamPushItems);
|
||||
|
||||
@Update("UPDATE gb_stream " +
|
||||
"SET mediaServerId=#{mediaServerId}" +
|
||||
"WHERE app=#{app} AND stream=#{stream}")
|
||||
void updateMediaServer(String app, String stream, String mediaServerId);
|
||||
}
|
||||
|
|
|
@ -149,7 +149,7 @@ media:
|
|||
enable: true
|
||||
# [可选] 在此范围内选择端口用于媒体流传输, 必须提前在zlm上配置该属性,不然自动配置此属性可能不成功
|
||||
port-range: 30000,30500 # 端口范围
|
||||
# [可选] 国标级联在此范围内选择端口发送媒体流,
|
||||
# [可选] 国标级联在此范围内选择端口发送媒体流
|
||||
send-port-range: 30000,30500 # 端口范围
|
||||
# 录像辅助服务, 部署此服务可以实现zlm录像的管理与下载, 0 表示不使用
|
||||
record-assist-port: 0
|
||||
|
|
Loading…
Reference in New Issue