mirror of https://github.com/swwheihei/wvp.git
修复部分设备invite后bye无法找到设备地址的问题
parent
1a746f2882
commit
340a23a961
|
@ -7,10 +7,13 @@ import javax.sip.Dialog;
|
|||
import javax.sip.InvalidArgumentException;
|
||||
import javax.sip.SipException;
|
||||
import javax.sip.TransactionDoesNotExistException;
|
||||
import javax.sip.address.Address;
|
||||
import javax.sip.address.SipURI;
|
||||
import javax.sip.header.ViaHeader;
|
||||
import javax.sip.message.Request;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.security.SecurityProperties.Headers;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.genersoft.iot.vmp.conf.SipConfig;
|
||||
|
@ -21,6 +24,9 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander;
|
|||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.SIPRequestHeaderProvider;
|
||||
import com.genersoft.iot.vmp.gb28181.utils.DateUtil;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
/**
|
||||
* @Description:设备能力接口,用于定义设备的控制、查询能力
|
||||
* @author: songww
|
||||
|
@ -288,6 +294,13 @@ public class SIPCommander implements ISIPCommander {
|
|||
return;
|
||||
}
|
||||
Request byeRequest = dialog.createRequest(Request.BYE);
|
||||
SipURI byeURI = (SipURI) byeRequest.getRequestURI();
|
||||
String vh = transaction.getRequest().getHeader(ViaHeader.NAME).toString();
|
||||
Pattern p = Pattern.compile("(\\d+\\.\\d+\\.\\d+\\.\\d+)\\:(\\d+)");
|
||||
Matcher matcher = p.matcher(vh);
|
||||
if (matcher.find()) {
|
||||
byeURI.setHost(matcher.group(1));
|
||||
}
|
||||
ViaHeader viaHeader = (ViaHeader) byeRequest.getHeader(ViaHeader.NAME);
|
||||
String protocol = viaHeader.getTransport().toUpperCase();
|
||||
ClientTransaction clientTransaction = null;
|
||||
|
@ -301,6 +314,8 @@ public class SIPCommander implements ISIPCommander {
|
|||
e.printStackTrace();
|
||||
} catch (SipException e) {
|
||||
e.printStackTrace();
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue