Commit 297f8965526b9438117c78b64eb6a0b3a518c70d
1 parent
fe7ddbb5
兼容缺少y=的sdp
Showing
1 changed file
with
14 additions
and
5 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
| @@ -138,12 +138,21 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -138,12 +138,21 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 138 | // 解析sdp消息, 使用jainsip 自带的sdp解析方式 | 138 | // 解析sdp消息, 使用jainsip 自带的sdp解析方式 |
| 139 | String contentString = new String(request.getRawContent()); | 139 | String contentString = new String(request.getRawContent()); |
| 140 | 140 | ||
| 141 | - // jainSip不支持y=字段, 移除移除以解析。 | 141 | + // jainSip不支持y=字段, 移除以解析。 |
| 142 | int ssrcIndex = contentString.indexOf("y="); | 142 | int ssrcIndex = contentString.indexOf("y="); |
| 143 | - //ssrc规定长度为10字节,不取余下长度以避免后续还有“f=”字段 | ||
| 144 | - String ssrc = contentString.substring(ssrcIndex + 2, ssrcIndex + 12); | ||
| 145 | - String substring = contentString.substring(0, contentString.indexOf("y=")); | ||
| 146 | - SessionDescription sdp = SdpFactory.getInstance().createSessionDescription(substring); | 143 | + // 检查是否有y字段 |
| 144 | + String ssrcDefault = "0000000000"; | ||
| 145 | + String ssrc; | ||
| 146 | + SessionDescription sdp; | ||
| 147 | + if (ssrcIndex >= 0) { | ||
| 148 | + //ssrc规定长度为10字节,不取余下长度以避免后续还有“f=”字段 | ||
| 149 | + ssrc = contentString.substring(ssrcIndex + 2, ssrcIndex + 12); | ||
| 150 | + String substring = contentString.substring(0, contentString.indexOf("y=")); | ||
| 151 | + sdp = SdpFactory.getInstance().createSessionDescription(substring); | ||
| 152 | + }else { | ||
| 153 | + ssrc = ssrcDefault; | ||
| 154 | + sdp = SdpFactory.getInstance().createSessionDescription(contentString); | ||
| 155 | + } | ||
| 147 | 156 | ||
| 148 | // 获取支持的格式 | 157 | // 获取支持的格式 |
| 149 | Vector mediaDescriptions = sdp.getMediaDescriptions(true); | 158 | Vector mediaDescriptions = sdp.getMediaDescriptions(true); |