| | |
| | | import gov.nist.javax.sip.address.SipUri; |
| | | import gov.nist.javax.sip.header.Subject; |
| | | import gov.nist.javax.sip.message.SIPRequest; |
| | | import org.apache.commons.lang3.RandomStringUtils; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import javax.sip.PeerUnavailableException; |
| | |
| | | } |
| | | |
| | | public static String getNewViaTag() { |
| | | return "z9hG4bK" + System.currentTimeMillis(); |
| | | return "z9hG4bK" + RandomStringUtils.randomNumeric(10); |
| | | } |
| | | |
| | | public static UserAgentHeader createUserAgentHeader(GitUtil gitUtil) throws PeerUnavailableException, ParseException { |
| | |
| | | strTmp = String.format("%02X", moveSpeed); |
| | | builder.append(strTmp, 0, 2); |
| | | builder.append(strTmp, 0, 2); |
| | | |
| | | //优化zoom低倍速下的变倍速率 |
| | | if ((zoomSpeed > 0) && (zoomSpeed <16)) |
| | | { |
| | | zoomSpeed = 16; |
| | | } |
| | | strTmp = String.format("%X", zoomSpeed); |
| | | builder.append(strTmp, 0, 1).append("0"); |
| | | //计算校验码 |
| | |
| | | String remoteAddress; |
| | | int remotePort; |
| | | if (sipUseSourceIpAsRemoteAddress) { |
| | | remoteAddress = request.getRemoteAddress().getHostAddress(); |
| | | remotePort = request.getRemotePort(); |
| | | remoteAddress = request.getPeerPacketSourceAddress().getHostAddress(); |
| | | remotePort = request.getPeerPacketSourcePort(); |
| | | |
| | | }else { |
| | | // 判断RPort是否改变,改变则说明路由nat信息变化,修改设备信息 |
| | | // 获取到通信地址等信息 |
| | |
| | | remotePort = request.getTopmostViaHeader().getRPort(); |
| | | // 解析本地地址替代 |
| | | if (ObjectUtils.isEmpty(remoteAddress) || remotePort == -1) { |
| | | remoteAddress = request.getRemoteAddress().getHostAddress(); |
| | | remotePort = request.getRemotePort(); |
| | | remoteAddress = request.getPeerPacketSourceAddress().getHostAddress(); |
| | | remotePort = request.getPeerPacketSourcePort(); |
| | | } |
| | | } |
| | | |