request toHeader 修正
This commit is contained in:
parent
f44440c42a
commit
a87fedc28b
@ -12,6 +12,7 @@ import javax.sip.address.Address;
|
||||
import javax.sip.address.SipURI;
|
||||
import javax.sip.message.Request;
|
||||
|
||||
@SuppressWarnings("Duplicates")
|
||||
@Data
|
||||
@SuperBuilder
|
||||
public class RequestBuilder {
|
||||
@ -28,12 +29,13 @@ public class RequestBuilder {
|
||||
Address localAddress = SipBuilder.createAddress(SipBuilder.createSipURI(getLocalId(), local));
|
||||
String target = SipBuilder.createHostAddress(getTargetIp(), getTargetPort());
|
||||
SipURI targetUri = SipBuilder.createSipURI(getTargetId(), target);
|
||||
Address targetAddress = SipBuilder.createAddress(targetUri);
|
||||
|
||||
return SipRequestBuilder.createRequest(targetUri, method,
|
||||
SipBuilder.createCallIdHeader(callId),
|
||||
SipBuilder.createCSeqHeader(cSeq, method),
|
||||
SipBuilder.createFromHeader(localAddress, SipUtil.generateFromTag()),
|
||||
SipBuilder.createToHeader(localAddress),
|
||||
SipBuilder.createToHeader(targetAddress),
|
||||
SipBuilder.createViaHeaders(getTargetIp(), getTargetPort(), getTransport(), SipUtil.generateViaTag()),
|
||||
SipBuilder.createMaxForwardsHeader(70));
|
||||
}
|
||||
@ -43,12 +45,13 @@ public class RequestBuilder {
|
||||
Address localAddress = SipBuilder.createAddress(SipBuilder.createSipURI(getLocalId(), local));
|
||||
String target = SipBuilder.createHostAddress(getTargetIp(), getTargetPort());
|
||||
SipURI targetUri = SipBuilder.createSipURI(getTargetId(), target);
|
||||
Address targetAddress = SipBuilder.createAddress(targetUri);
|
||||
|
||||
return SipRequestBuilder.createRequest(targetUri, method,
|
||||
SipBuilder.createCallIdHeader(callId),
|
||||
SipBuilder.createCSeqHeader(cSeq, method),
|
||||
SipBuilder.createFromHeader(localAddress, SipUtil.generateFromTag()),
|
||||
SipBuilder.createToHeader(localAddress),
|
||||
SipBuilder.createToHeader(targetAddress),
|
||||
SipBuilder.createViaHeaders(getTargetIp(), getTargetPort(), getTransport(), SipUtil.generateViaTag()),
|
||||
SipBuilder.createMaxForwardsHeader(70), SipContentType.XML, content);
|
||||
}
|
||||
@ -58,12 +61,13 @@ public class RequestBuilder {
|
||||
Address localAddress = SipBuilder.createAddress(SipBuilder.createSipURI(getLocalId(), local));
|
||||
String target = SipBuilder.createHostAddress(getTargetIp(), getTargetPort());
|
||||
SipURI targetUri = SipBuilder.createSipURI(getTargetId(), target);
|
||||
Address targetAddress = SipBuilder.createAddress(targetUri);
|
||||
|
||||
return SipRequestBuilder.createRequest(targetUri, method,
|
||||
SipBuilder.createCallIdHeader(callId),
|
||||
SipBuilder.createCSeqHeader(cSeq, method),
|
||||
SipBuilder.createFromHeader(localAddress, SipUtil.generateFromTag()),
|
||||
SipBuilder.createToHeader(localAddress),
|
||||
SipBuilder.createToHeader(targetAddress),
|
||||
SipBuilder.createViaHeaders(getTargetIp(), getTargetPort(), getTransport(), SipUtil.generateViaTag()),
|
||||
SipBuilder.createMaxForwardsHeader(70), SipContentType.SDP, description.toString());
|
||||
}
|
||||
|
@ -1,11 +1,9 @@
|
||||
package cn.skcks.docking.gb28181.sip.method.register.request;
|
||||
|
||||
import cn.skcks.docking.gb28181.sip.generic.SipBuilder;
|
||||
import cn.skcks.docking.gb28181.sip.generic.SipRequestBuilder;
|
||||
import cn.skcks.docking.gb28181.sip.method.RequestBuilder;
|
||||
import cn.skcks.docking.gb28181.sip.method.register.RegisterBuilder;
|
||||
import cn.skcks.docking.gb28181.sip.utils.DigestAuthenticationHelper;
|
||||
import cn.skcks.docking.gb28181.sip.utils.SipUtil;
|
||||
import gov.nist.javax.sip.message.SIPRequest;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@ -14,7 +12,6 @@ import lombok.ToString;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import javax.sip.address.Address;
|
||||
import javax.sip.address.SipURI;
|
||||
import javax.sip.header.AuthorizationHeader;
|
||||
import javax.sip.header.WWWAuthenticateHeader;
|
||||
import javax.sip.message.Request;
|
||||
@ -30,7 +27,9 @@ public class RegisterRequestBuilder extends RequestBuilder implements RegisterBu
|
||||
String local = SipBuilder.createHostAddress(getLocalIp(), getLocalPort());
|
||||
Address localAddress = SipBuilder.createAddress(SipBuilder.createSipURI(getLocalId(), local));
|
||||
|
||||
Request request = createRequest(METHOD, callId, 1);
|
||||
SIPRequest request = (SIPRequest) createRequest(METHOD, callId, 1);
|
||||
Address address = request.getFromHeader().getAddress();
|
||||
request.getToHeader().setAddress(address);
|
||||
return SipBuilder.addHeaders(request,
|
||||
SipBuilder.createExpiresHeader(expires),
|
||||
SipBuilder.createContactHeader(localAddress));
|
||||
|
@ -40,7 +40,7 @@ public class RequestTest {
|
||||
.targetIp(localIp)
|
||||
.targetPort(localPort)
|
||||
.targetId(localId)
|
||||
.transport(ListeningPoint.UDP)
|
||||
.transport(ListeningPoint.TCP)
|
||||
.build();
|
||||
String callId = SipUtil.nanoId(10);
|
||||
CatalogQueryDTO catalogQueryDTO = CatalogQueryDTO.builder()
|
||||
|
Loading…
Reference in New Issue
Block a user