Merge pull request #35 from lawrencehj/master

解决非默认端口无法Send Bye的问题
This commit is contained in:
648540858 2021-01-12 14:08:46 +08:00 committed by GitHub
commit bbcaee3732
2 changed files with 6 additions and 3 deletions

View File

@ -526,7 +526,10 @@ public class SIPCommander implements ISIPCommander {
Pattern p = Pattern.compile("(\\d+\\.\\d+\\.\\d+\\.\\d+)\\:(\\d+)");
Matcher matcher = p.matcher(vh);
if (matcher.find()) {
byeURI.setHost(matcher.group(1));
String ip = matcher.group(1);
byeURI.setHost(ip);
String port = matcher.group(2);
byeURI.setPort(Integer.parseInt(port));
}
ViaHeader viaHeader = (ViaHeader) byeRequest.getHeader(ViaHeader.NAME);
String protocol = viaHeader.getTransport().toUpperCase();

View File

@ -342,7 +342,7 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
try {
// 回复200 OK
responseAck(evt);
String seqNo = String.valueOf(System.currentTimeMillis());
String uuid = UUID.randomUUID().toString().replace("-", "");
RecordInfo recordInfo = new RecordInfo();
Element rootElement = getRootElement(evt);
Element deviceIdElement = rootElement.element("DeviceID");
@ -398,7 +398,7 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
// 为防止连续请求该设备的录像数据返回数据错乱特增加sn进行区分
String cacheKey = CACHE_RECORDINFO_KEY + deviceId + sn;
redis.set(cacheKey + "_" + seqNo, recordList, 90);
redis.set(cacheKey + "_" + uuid, recordList, 90);
List<Object> cacheKeys = redis.scan(cacheKey + "_*");
List<RecordItem> totalRecordList = new ArrayList<RecordItem>();
for (int i = 0; i < cacheKeys.size(); i++) {