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.InvalidArgumentException;
|
||||||
import javax.sip.SipException;
|
import javax.sip.SipException;
|
||||||
import javax.sip.TransactionDoesNotExistException;
|
import javax.sip.TransactionDoesNotExistException;
|
||||||
|
import javax.sip.address.Address;
|
||||||
|
import javax.sip.address.SipURI;
|
||||||
import javax.sip.header.ViaHeader;
|
import javax.sip.header.ViaHeader;
|
||||||
import javax.sip.message.Request;
|
import javax.sip.message.Request;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.autoconfigure.security.SecurityProperties.Headers;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.conf.SipConfig;
|
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.transmit.cmd.SIPRequestHeaderProvider;
|
||||||
import com.genersoft.iot.vmp.gb28181.utils.DateUtil;
|
import com.genersoft.iot.vmp.gb28181.utils.DateUtil;
|
||||||
|
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description:设备能力接口,用于定义设备的控制、查询能力
|
* @Description:设备能力接口,用于定义设备的控制、查询能力
|
||||||
* @author: songww
|
* @author: songww
|
||||||
|
@ -288,6 +294,13 @@ public class SIPCommander implements ISIPCommander {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Request byeRequest = dialog.createRequest(Request.BYE);
|
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);
|
ViaHeader viaHeader = (ViaHeader) byeRequest.getHeader(ViaHeader.NAME);
|
||||||
String protocol = viaHeader.getTransport().toUpperCase();
|
String protocol = viaHeader.getTransport().toUpperCase();
|
||||||
ClientTransaction clientTransaction = null;
|
ClientTransaction clientTransaction = null;
|
||||||
|
@ -301,6 +314,8 @@ public class SIPCommander implements ISIPCommander {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (SipException e) {
|
} catch (SipException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue