Response 补充 user-agent
This commit is contained in:
parent
296747ec31
commit
74cd2d2048
@ -15,6 +15,7 @@ public class SipResponseBuilder {
|
||||
public static Response createResponse(int statusCode, Request request) {
|
||||
return SipBuilder.addHeaders(
|
||||
SipBuilder.getMessageFactory().createResponse(statusCode, request),
|
||||
SipBuilder.userAgentHeader,
|
||||
GB_VERSION);
|
||||
}
|
||||
|
||||
@ -23,6 +24,7 @@ public class SipResponseBuilder {
|
||||
FromHeader from, ToHeader to, List<ViaHeader> via, MaxForwardsHeader maxForwards) {
|
||||
return SipBuilder.addHeaders(
|
||||
SipBuilder.getMessageFactory().createResponse(statusCode, callId, cSeq, from, to, via, maxForwards),
|
||||
SipBuilder.userAgentHeader,
|
||||
GB_VERSION);
|
||||
}
|
||||
|
||||
@ -30,6 +32,7 @@ public class SipResponseBuilder {
|
||||
public static <T> Response createResponse(int statusCode, Request request, ContentTypeHeader contentType, T content) {
|
||||
return SipBuilder.addHeaders(
|
||||
SipBuilder.getMessageFactory().createResponse(statusCode, request, contentType, content),
|
||||
SipBuilder.userAgentHeader,
|
||||
GB_VERSION
|
||||
);
|
||||
}
|
||||
@ -38,6 +41,7 @@ public class SipResponseBuilder {
|
||||
public static <T> Response createXmlResponse(int statusCode, Request request, T content) {
|
||||
return SipBuilder.addHeaders(
|
||||
SipBuilder.getMessageFactory().createResponse(statusCode, request, SipContentType.XML, content),
|
||||
SipBuilder.userAgentHeader,
|
||||
GB_VERSION
|
||||
);
|
||||
}
|
||||
@ -46,6 +50,7 @@ public class SipResponseBuilder {
|
||||
public static <T> Response createXmlResponse(int statusCode, Request request, T content, String charset) {
|
||||
return SipBuilder.addHeaders(
|
||||
SipBuilder.getMessageFactory(charset).createResponse(statusCode, request, SipContentType.XML, content),
|
||||
SipBuilder.userAgentHeader,
|
||||
GB_VERSION);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package cn.skcks.docking.gb28181.sip.process;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.skcks.docking.gb28181.sip.method.register.request.RegisterRequestBuilder;
|
||||
import cn.skcks.docking.gb28181.sip.method.register.response.RegisterResponseBuilder;
|
||||
import cn.skcks.docking.gb28181.sip.utils.SipUtil;
|
||||
import gov.nist.javax.sip.message.SIPResponse;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -28,6 +29,7 @@ public class RequestTest {
|
||||
@Test
|
||||
@SneakyThrows
|
||||
void test() {
|
||||
SipUtil.setUserAgentVersion("0.1.0");
|
||||
String callId = IdUtil.fastSimpleUUID();
|
||||
RegisterRequestBuilder registerRequestBuilder = RegisterRequestBuilder.builder()
|
||||
.localIp(localIp)
|
||||
|
Loading…
Reference in New Issue
Block a user