This commit is contained in:
shikong 2023-09-27 01:04:05 +08:00
parent ad72b02371
commit 2d38c7d6ec
3 changed files with 9 additions and 16 deletions

View File

@ -10,11 +10,4 @@ import javax.sip.message.Request;
public class RegisterBuilder {
@Getter
private static final String method = Request.REGISTER;
private String localIp;
private int localPort;
private String localId;
private String targetIp;
private int targetPort;
private String targetId;
private String transport;
}

View File

@ -25,6 +25,14 @@ import javax.sip.message.Request;
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class RegisterRequestBuilder extends RegisterBuilder {
private String localIp;
private int localPort;
private String localId;
private String targetIp;
private int targetPort;
private String targetId;
private String transport;
public Request createNoAuthorizationRequest(String callId, int expires) {
String local = SipBuilder.createHostAddress(getLocalIp(), getLocalPort());
Address localAddress = SipBuilder.createAddress(SipBuilder.createSipURI(getLocalId(), local));

View File

@ -41,15 +41,7 @@ public class RequestTest {
.transport(ListeningPoint.UDP)
.build();
RegisterResponseBuilder registerResponseBuilder = RegisterResponseBuilder.builder()
.localIp(remoteIp)
.localPort(remotePort)
.localId(remoteId)
.targetIp(localIp)
.targetPort(localPort)
.targetId(localId)
.transport(ListeningPoint.UDP)
.build();
RegisterResponseBuilder registerResponseBuilder = RegisterResponseBuilder.builder().build();
log.info("无密码的认证");
Request noAuthorizationRequest = registerRequestBuilder.createNoAuthorizationRequest(callId, 3600);