Class SipRequestUtils
java.lang.Object
io.github.lunasaw.sip.common.utils.SipRequestUtils
- Author:
- luna
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic javax.sip.address.Address
createAddress
(String user, String host) static javax.sip.address.Address
createAddress
(javax.sip.address.SipURI sipUri) static javax.sip.header.AuthorizationHeader
createAuthorizationHeader
(String scheme) 基于新提供的方案值创建新的授权标头。static javax.sip.header.AuthorizationHeader
createAuthorizationHeader
(String scheme, String user, javax.sip.address.URI requestUri, String realm, String nonce, String qop, String cNonce, String response) static javax.sip.header.CallIdHeader
createCallIdHeader
(String callId) static javax.sip.header.ContactHeader
createContactHeader
(String user, String host) 联系人标头static javax.sip.header.ContentTypeHeader
createContentTypeHeader
(String contentType, String contentSubType) 基于新提供的内容类型和内容子类型值创建新的内容类型标头。static javax.sip.header.CSeqHeader
createCSeqHeader
(long sequenceNumber, String method) 基于新提供的序列号和方法值创建新的 CSeqHeader。static javax.sip.header.EventHeader
createEventHeader
(String eventType) static javax.sip.header.EventHeader
createEventHeader
(String eventType, String eventId) static javax.sip.header.ExpiresHeader
createExpiresHeader
(int expires) static javax.sip.header.FromHeader
createFromHeader
(String user, String host, String tag) static javax.sip.header.FromHeader
createFromHeader
(javax.sip.address.Address address, String tag) 根据新提供的地址和标记值创建新的 FromHeader。static javax.sip.header.Header
createHeader
(String name, String value) static javax.sip.header.MaxForwardsHeader
70 maxForwards – 最大转发的新整数值。static javax.sip.header.MaxForwardsHeader
createMaxForwardsHeader
(int maxForwards) static javax.sip.message.Request
createRequest
(javax.sip.address.URI requestUri, String method, javax.sip.header.CallIdHeader callId, javax.sip.header.CSeqHeader cSeq, javax.sip.header.FromHeader from, javax.sip.header.ToHeader to, List<javax.sip.header.ViaHeader> via, javax.sip.header.MaxForwardsHeader maxForwards, javax.sip.header.ContentTypeHeader contentType, Object content) static javax.sip.message.Response
createResponse
(int statusCode, javax.sip.header.CallIdHeader callId, javax.sip.header.CSeqHeader cSeq, javax.sip.header.FromHeader from, javax.sip.header.ToHeader to, List<javax.sip.header.ViaHeader> via, javax.sip.header.MaxForwardsHeader maxForwards, javax.sip.header.ContentTypeHeader contentType, Object content) static javax.sip.message.Response
createResponse
(int statusCode, javax.sip.message.Request request) 创建响应static javax.sip.message.Response
createResponse
(int statusCode, javax.sip.message.Request request, List<javax.sip.header.Header> headers) static javax.sdp.SessionDescription
static javax.sip.address.SipURI
createSipUri
(String user, String host) static javax.sip.header.SubjectHeader
createSubjectHeader
(String subject) static javax.sip.header.SubscriptionStateHeader
createSubscriptionStateHeader
(String subscriptionState) static javax.sip.header.ToHeader
createToHeader
(String user, String host, String tag) static javax.sip.header.ToHeader
createToHeader
(javax.sip.address.Address address, String tag) 根据新提供的地址和标记值创建新的 ToHeader。static javax.sip.header.UserAgentHeader
static javax.sip.header.UserAgentHeader
createUserAgentHeader
(String... agent) static javax.sip.header.ViaHeader
createViaHeader
(String ip, int port, String transport, String branch) host – 主机的新字符串值。 port – 端口的新整数值。 transport – tcp / udp。 branch – 代理服务器的新字符串值。static List<javax.sip.header.ViaHeader>
createViaHeader
(javax.sip.header.ViaHeader... viaHeaders) static javax.sip.header.WWWAuthenticateHeader
createWWWAuthenticateHeader
(String scheme) static javax.sip.header.WWWAuthenticateHeader
createWWWAuthenticateHeader
(String scheme, String realm, String nonce, String algorithm) static String
static javax.sip.header.CallIdHeader
static javax.sip.header.CallIdHeader
getNewCallIdHeader
(String ip, String transport) static String
static String
static void
setContent
(javax.sip.message.Request request, javax.sip.header.ContentTypeHeader contentType, Object content) static void
setRequestHeader
(javax.sip.message.Request request, List<javax.sip.header.Header> headers) static void
setResponseHeader
(javax.sip.message.Response response, List<javax.sip.header.Header> headers)
-
Constructor Details
-
SipRequestUtils
public SipRequestUtils()
-
-
Method Details
-
createRequest
public static javax.sip.message.Request createRequest(javax.sip.address.URI requestUri, String method, javax.sip.header.CallIdHeader callId, javax.sip.header.CSeqHeader cSeq, javax.sip.header.FromHeader from, javax.sip.header.ToHeader to, List<javax.sip.header.ViaHeader> via, javax.sip.header.MaxForwardsHeader maxForwards, javax.sip.header.ContentTypeHeader contentType, Object content) - Parameters:
requestUri
- requestURI – 此消息的请求 URI 值的新 URI 对象。method
- method – 此消息的方法值的新字符串。callId
- callId – 此消息的 callId 值的新 CallIdHeader 对象。cSeq
- cSeq – 此消息的 cSeq 值的新 CSeqHeader 对象。from
- from – 此消息的 from 值的新 FromHeader 对象。to
- to – 此消息的 to 值的新 ToHeader 对象。via
- via – 此消息的 ViaHeader 的新列表对象。maxForwards
- contentType – 此消息的内容类型值的新内容类型标头对象。contentType
- 响应类型 – 此消息的正文内容值的新对象。content
- 内容
-
setRequestHeader
public static void setRequestHeader(javax.sip.message.Request request, List<javax.sip.header.Header> headers) -
createViaHeader
public static javax.sip.header.ViaHeader createViaHeader(String ip, int port, String transport, String branch) host – 主机的新字符串值。 port – 端口的新整数值。 transport – tcp / udp。 branch – 代理服务器的新字符串值。- Returns:
- ViaHeader
-
createViaHeader
public static List<javax.sip.header.ViaHeader> createViaHeader(javax.sip.header.ViaHeader... viaHeaders) -
createMaxForwardsHeader
public static javax.sip.header.MaxForwardsHeader createMaxForwardsHeader()70 maxForwards – 最大转发的新整数值。 -
createMaxForwardsHeader
public static javax.sip.header.MaxForwardsHeader createMaxForwardsHeader(int maxForwards) - Parameters:
maxForwards
- maxForwards – 最大转发的新整数值。
-
createCallIdHeader
-
getNewCallId
-
getNewCallIdHeader
public static javax.sip.header.CallIdHeader getNewCallIdHeader() -
getNewCallIdHeader
-
createSipUri
- Parameters:
user
- sip用户host
- 主机地址 ip:port- Returns:
- SipURI
-
createAddress
-
createAddress
public static javax.sip.address.Address createAddress(javax.sip.address.SipURI sipUri) -
createFromHeader
- Parameters:
user
- sip用户host
- 主机地址 ip:porttag
- 标签- Returns:
- FromHeader
-
createToHeader
- Parameters:
user
- sip用户host
- 主机地址 ip:porttag
- 标签- Returns:
- FromHeader
-
createFromHeader
public static javax.sip.header.FromHeader createFromHeader(javax.sip.address.Address address, String tag) 根据新提供的地址和标记值创建新的 FromHeader。- Parameters:
address
- – 地址的新地址对象。tag
- – 标签的新字符串值。- Returns:
- FromHeader
-
createToHeader
public static javax.sip.header.ToHeader createToHeader(javax.sip.address.Address address, String tag) 根据新提供的地址和标记值创建新的 ToHeader。- Parameters:
address
- – 地址的新地址对象。tag
- – 标签的新字符串值,此值可能为空。- Returns:
- ToHeader
-
createCSeqHeader
基于新提供的序列号和方法值创建新的 CSeqHeader。- Parameters:
sequenceNumber
- – 序列号的新长整型值。method
- – 方法的新字符串值。
-
createContentTypeHeader
public static javax.sip.header.ContentTypeHeader createContentTypeHeader(String contentType, String contentSubType) 基于新提供的内容类型和内容子类型值创建新的内容类型标头。- Parameters:
contentType
- contentType – 新的字符串内容类型值。contentSubType
- contentSubType – 新的字符串内容子类型值。- Returns:
- ContentTypeHeader
-
createUserAgentHeader
public static javax.sip.header.UserAgentHeader createUserAgentHeader() -
createUserAgentHeader
-
getNewFromTag
-
getNewViaTag
-
createContactHeader
联系人标头- Parameters:
user
- 用户设备编号host
- 主机地址 ip:port- Returns:
- ContactHeader
-
createSubjectHeader
-
createExpiresHeader
public static javax.sip.header.ExpiresHeader createExpiresHeader(int expires) -
createEventHeader
-
createEventHeader
-
createSubscriptionStateHeader
public static javax.sip.header.SubscriptionStateHeader createSubscriptionStateHeader(String subscriptionState) -
createAuthorizationHeader
基于新提供的方案值创建新的授权标头。- Parameters:
scheme
- 方案的新字符串值。- Returns:
- AuthorizationHeader
-
createAuthorizationHeader
-
createHeader
-
createResponse
public static javax.sip.message.Response createResponse(int statusCode, javax.sip.message.Request request) 创建响应- Parameters:
statusCode
- 状态码request
- 回复的请求- Returns:
-
createResponse
public static javax.sip.message.Response createResponse(int statusCode, javax.sip.header.CallIdHeader callId, javax.sip.header.CSeqHeader cSeq, javax.sip.header.FromHeader from, javax.sip.header.ToHeader to, List<javax.sip.header.ViaHeader> via, javax.sip.header.MaxForwardsHeader maxForwards, javax.sip.header.ContentTypeHeader contentType, Object content) - Parameters:
statusCode
- statusCode – 状态码Response
callId
- callId – 此消息的 callId 值的新 CallIdHeader 对象。cSeq
- cSeq – 此消息的 cSeq 值的新 CSeqHeader 对象。from
- from – 此消息的 from 值的新 FromHeader 对象。to
- to – 此消息的 to 值的新 ToHeader 对象。via
- via – 此消息的 ViaHeader 的新列表对象。maxForwards
- contentType – 此消息的内容类型值的新内容类型标头对象。contentType
- 响应类型 – 此消息的正文内容值的新对象。content
- 内容
-
createResponse
public static javax.sip.message.Response createResponse(int statusCode, javax.sip.message.Request request, List<javax.sip.header.Header> headers) -
setResponseHeader
public static void setResponseHeader(javax.sip.message.Response response, List<javax.sip.header.Header> headers) -
createWWWAuthenticateHeader
-
createWWWAuthenticateHeader
-
setContent
public static void setContent(javax.sip.message.Request request, javax.sip.header.ContentTypeHeader contentType, Object content) -
createSessionDescription
-