From 297f8965526b9438117c78b64eb6a0b3a518c70d Mon Sep 17 00:00:00 2001 From: 648540858 <456PANlinlin> Date: Sat, 20 Nov 2021 21:03:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E7=BC=BA=E5=B0=91y=3D?= =?UTF-8?q?=E7=9A=84sdp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../request/impl/InviteRequestProcessor.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java index a9e9b455..1cb4af59 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java @@ -138,12 +138,21 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements // 解析sdp消息, 使用jainsip 自带的sdp解析方式 String contentString = new String(request.getRawContent()); - // jainSip不支持y=字段, 移除移除以解析。 + // jainSip不支持y=字段, 移除以解析。 int ssrcIndex = contentString.indexOf("y="); - //ssrc规定长度为10字节,不取余下长度以避免后续还有“f=”字段 - String ssrc = contentString.substring(ssrcIndex + 2, ssrcIndex + 12); - String substring = contentString.substring(0, contentString.indexOf("y=")); - SessionDescription sdp = SdpFactory.getInstance().createSessionDescription(substring); + // 检查是否有y字段 + String ssrcDefault = "0000000000"; + String ssrc; + SessionDescription sdp; + if (ssrcIndex >= 0) { + //ssrc规定长度为10字节,不取余下长度以避免后续还有“f=”字段 + ssrc = contentString.substring(ssrcIndex + 2, ssrcIndex + 12); + String substring = contentString.substring(0, contentString.indexOf("y=")); + sdp = SdpFactory.getInstance().createSessionDescription(substring); + }else { + ssrc = ssrcDefault; + sdp = SdpFactory.getInstance().createSessionDescription(contentString); + } // 获取支持的格式 Vector mediaDescriptions = sdp.getMediaDescriptions(true);