Commit 3e76214d0768abe027e10d983015cfb4d820a6d9
Merge remote-tracking branch 'origin/wvp-28181-2.0' into wvp-28181-2.0
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 | 138 | // 解析sdp消息, 使用jainsip 自带的sdp解析方式 |
| 139 | 139 | String contentString = new String(request.getRawContent()); |
| 140 | 140 | |
| 141 | - // jainSip不支持y=字段, 移除移除以解析。 | |
| 141 | + // jainSip不支持y=字段, 移除以解析。 | |
| 142 | 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 | 158 | Vector mediaDescriptions = sdp.getMediaDescriptions(true); | ... | ... |