public class SipMessageFactory
extends java.lang.Object
implements javax.sip.message.MessageFactory
Modifier and Type | Field and Description |
---|---|
static Logger |
logger
The logger for this class
|
Constructor and Description |
---|
SipMessageFactory(ProtocolProviderServiceSipImpl service,
javax.sip.message.MessageFactory wrappedFactory)
The constructor for this class.
|
Modifier and Type | Method and Description |
---|---|
javax.sip.message.Request |
createAck(javax.sip.ClientTransaction clientTransaction)
Creates an ACK request that can be sent in the context of
clientTransaction's Dialog.
|
javax.sip.message.Request |
createInviteRequest(javax.sip.address.Address toAddress)
Creates an invite request destined for callee.
|
javax.sip.message.Request |
createInviteRequest(javax.sip.address.Address toAddress,
javax.sip.message.Message cause)
Creates an invite request destined for callee and reflects
any possible non-null cause (e.g.
|
javax.sip.message.Request |
createRegisterRequest(javax.sip.address.Address addressOfRecord,
int registrationsExpiration,
javax.sip.header.CallIdHeader callIdHeader,
long cSeqValue)
Creates a REGISTER Request as per the specified parameters.
|
javax.sip.message.Request |
createRequest(javax.sip.Dialog dialog,
java.lang.String method)
Creates a new
Request of a specific method which is to be sent in
a specific Dialog and populates its generally-necessary
headers such as the Authorization header. |
javax.sip.message.Request |
createRequest(java.lang.String requestParam)
Calls the same method in the internal wrapped factory
and returns a Request marked with its service.
|
javax.sip.message.Request |
createRequest(javax.sip.address.URI requestURI,
java.lang.String method,
javax.sip.header.CallIdHeader callId,
javax.sip.header.CSeqHeader cSeq,
javax.sip.header.FromHeader from,
javax.sip.header.ToHeader to,
java.util.List via,
javax.sip.header.MaxForwardsHeader maxForwards)
Calls the same method in the internal wrapped factory
and returns a Request marked with its service.
|
javax.sip.message.Request |
createRequest(javax.sip.address.URI requestURI,
java.lang.String method,
javax.sip.header.CallIdHeader callId,
javax.sip.header.CSeqHeader cSeq,
javax.sip.header.FromHeader from,
javax.sip.header.ToHeader to,
java.util.List via,
javax.sip.header.MaxForwardsHeader maxForwards,
javax.sip.header.ContentTypeHeader contentType,
byte[] content)
Calls the same method in the internal wrapped factory
and returns a Request marked with its service.
|
javax.sip.message.Request |
createRequest(javax.sip.address.URI requestURI,
java.lang.String method,
javax.sip.header.CallIdHeader callId,
javax.sip.header.CSeqHeader cSeq,
javax.sip.header.FromHeader from,
javax.sip.header.ToHeader to,
java.util.List via,
javax.sip.header.MaxForwardsHeader maxForwards,
javax.sip.header.ContentTypeHeader contentType,
java.lang.Object content)
Calls the same method in the internal wrapped factory
and returns a Request marked with its service.
|
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,
java.util.List via,
javax.sip.header.MaxForwardsHeader maxForwards)
Calls the same method in the internal wrapped factory
and returns a Response marked with its service.
|
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,
java.util.List via,
javax.sip.header.MaxForwardsHeader maxForwards,
javax.sip.header.ContentTypeHeader contentType,
byte[] content)
Calls the same method in the internal wrapped factory
and returns a Response marked with its service.
|
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,
java.util.List via,
javax.sip.header.MaxForwardsHeader maxForwards,
javax.sip.header.ContentTypeHeader contentType,
java.lang.Object content)
Calls the same method in the internal wrapped factory
and returns a Response marked with its service.
|
javax.sip.message.Response |
createResponse(int statusCode,
javax.sip.message.Request request)
Calls the same method in the internal wrapped factory
and returns a Response marked with its service.
|
javax.sip.message.Response |
createResponse(int statusCode,
javax.sip.message.Request request,
javax.sip.header.ContentTypeHeader contentType,
byte[] content)
Calls the same method in the internal wrapped factory
and returns a Response marked with its service.
|
javax.sip.message.Response |
createResponse(int statusCode,
javax.sip.message.Request request,
javax.sip.header.ContentTypeHeader contentType,
java.lang.Object content)
Calls the same method in the internal wrapped factory
and returns a Response marked with its service.
|
javax.sip.message.Response |
createResponse(java.lang.String responseParam)
Calls the same method in the internal wrapped factory
and returns a Response marked with its service.
|
javax.sip.message.Request |
createUnRegisterRequest(javax.sip.message.Request registerRequest,
long cSeqValue)
Creates a request that would end a registration established with
registerRequest
|
static java.lang.String |
generateLocalTag()
Generate a tag for a FROM header or TO header.
|
void |
preAuthenticateRequest(javax.sip.message.Request request)
Verifies wither we have already authenticated requests with the same
Call-ID as request and attaches the corresponding
credentials in an effort to avoid receiving an authentication challenge
from the server and having to re-send the request.
|
public static final Logger logger
public SipMessageFactory(ProtocolProviderServiceSipImpl service, javax.sip.message.MessageFactory wrappedFactory)
service
- the service this MessageFactory belongs to.wrappedFactory
- the MessageFactory which will really
create messages.public javax.sip.message.Request createRequest(javax.sip.address.URI requestURI, java.lang.String method, javax.sip.header.CallIdHeader callId, javax.sip.header.CSeqHeader cSeq, javax.sip.header.FromHeader from, javax.sip.header.ToHeader to, java.util.List via, javax.sip.header.MaxForwardsHeader maxForwards, javax.sip.header.ContentTypeHeader contentType, java.lang.Object content) throws java.text.ParseException
createRequest
in interface javax.sip.message.MessageFactory
requestURI
- the new URI object of the requestURI value of this
Message.method
- the new string of the method value of this
Message.callId
- the new CallIdHeader object of the callId value of this
Message.cSeq
- the new CSeqHeader object of the cSeq value of this
Message.from
- the new FromHeader object of the from value of this
Message.to
- the new ToHeader object of the to value of this
Message.via
- the new List object of the ViaHeaders of this
Message.maxForwards
- the Max-Forwards header for the new Request.contentType
- the new ContentTypeHeader object of the content type
value of this Message.content
- the new Object of the body content value of this Message.java.text.ParseException
- which signals that an error has been reached
unexpectedly while parsing the method or the body.public javax.sip.message.Request createRequest(javax.sip.address.URI requestURI, java.lang.String method, javax.sip.header.CallIdHeader callId, javax.sip.header.CSeqHeader cSeq, javax.sip.header.FromHeader from, javax.sip.header.ToHeader to, java.util.List via, javax.sip.header.MaxForwardsHeader maxForwards, javax.sip.header.ContentTypeHeader contentType, byte[] content) throws java.text.ParseException
createRequest
in interface javax.sip.message.MessageFactory
requestURI
- the new URI object of the requestURI value of this
Message.method
- the new string of the method value of this
Message.callId
- the new CallIdHeader object of the callId value of this
Message.cSeq
- the new CSeqHeader object of the cSeq value of this
Message.from
- the new FromHeader object of the from value of this
Message.to
- the new ToHeader object of the to value of this
Message.via
- the new List object of the ViaHeaders of this
Message.maxForwards
- the Max-Forwards header for the new Request.contentType
- the new ContentTypeHeader object of the content type
value of this Message.content
- the new Object of the body content value of this Message.java.text.ParseException
- which signals that an error has been reached
unexpectedly while parsing the method or the body.public javax.sip.message.Request createRequest(javax.sip.address.URI requestURI, java.lang.String method, javax.sip.header.CallIdHeader callId, javax.sip.header.CSeqHeader cSeq, javax.sip.header.FromHeader from, javax.sip.header.ToHeader to, java.util.List via, javax.sip.header.MaxForwardsHeader maxForwards) throws java.text.ParseException
createRequest
in interface javax.sip.message.MessageFactory
requestURI
- the new URI object of the requestURI value of this
Message.method
- the new string of the method value of this
Message.callId
- the new CallIdHeader object of the callId value of this
Message.cSeq
- the new CSeqHeader object of the cSeq value of this
Message.from
- the new FromHeader object of the from value of this
Message.to
- the new ToHeader object of the to value of this
Message.via
- the new List object of the ViaHeaders of this
Message.maxForwards
- the Max-Forwards header for the new Request.java.text.ParseException
- which signals that an error has been reached
unexpectedly while parsing the method or the body.public javax.sip.message.Request createRequest(java.lang.String requestParam) throws java.text.ParseException
createRequest
in interface javax.sip.message.MessageFactory
requestParam
- the new string value of the Request.java.text.ParseException
- which signals that an error has been reached
unexpectedly while parsing the request.public 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, java.util.List via, javax.sip.header.MaxForwardsHeader maxForwards, javax.sip.header.ContentTypeHeader contentType, java.lang.Object content) throws java.text.ParseException
createResponse
in interface javax.sip.message.MessageFactory
statusCode
- the new integer of the statusCode value of this
Message.callId
- the new CallIdHeader object of the callId value of this
Message.cSeq
- the new CSeqHeader object of the cSeq value of this
Message.from
- the new FromHeader object of the from value of this
Message.to
- the new ToHeader object of the to value of this
Message.via
- the new List object of the ViaHeaders of this
Message.maxForwards
- the Max-Forwards header for the new Response.contentType
- the new ContentTypeHeader object of the content type
value of this Message.content
- the new Object of the body content value of this
Message.java.text.ParseException
- which signals that an error has been reached
unexpectedly while parsing the statusCode or the body.public 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, java.util.List via, javax.sip.header.MaxForwardsHeader maxForwards, javax.sip.header.ContentTypeHeader contentType, byte[] content) throws java.text.ParseException
createResponse
in interface javax.sip.message.MessageFactory
statusCode
- the new integer of the statusCode value of this
Message.callId
- the new CallIdHeader object of the callId value of this
Message.cSeq
- the new CSeqHeader object of the cSeq value of this
Message.from
- the new FromHeader object of the from value of this
Message.to
- the new ToHeader object of the to value of this
Message.via
- the new List object of the ViaHeaders of this
Message.maxForwards
- the Max-Forwards header for the new Response.contentType
- the new ContentTypeHeader object of the content type
value of this Message.content
- the new Object of the body content value of this
Message.java.text.ParseException
- which signals that an error has been reached
unexpectedly while parsing the statusCode or the body.public 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, java.util.List via, javax.sip.header.MaxForwardsHeader maxForwards) throws java.text.ParseException
createResponse
in interface javax.sip.message.MessageFactory
statusCode
- the new integer of the statusCode value of this
Message.callId
- the new CallIdHeader object of the callId value of this
Message.cSeq
- the new CSeqHeader object of the cSeq value of this
Message.from
- the new FromHeader object of the from value of this
Message.to
- the new ToHeader object of the to value of this
Message.via
- the new List object of the ViaHeaders of this
Message.maxForwards
- the Max-Forwards header for the new Response.java.text.ParseException
- which signals that an error has been reached
unexpectedly while parsing the statusCode or the body.public javax.sip.message.Response createResponse(int statusCode, javax.sip.message.Request request, javax.sip.header.ContentTypeHeader contentType, java.lang.Object content) throws java.text.ParseException
createResponse
in interface javax.sip.message.MessageFactory
statusCode
- the new integer of the statusCode value of this
Message.request
- the received Request object upon which to base the
Response.contentType
- the new ContentTypeHeader object of the content type
value of this Message.content
- the new byte array of the body content value of this
Message.java.text.ParseException
- which signals that an error has been reached
unexpectedly while parsing the statusCode or the body.public javax.sip.message.Response createResponse(int statusCode, javax.sip.message.Request request, javax.sip.header.ContentTypeHeader contentType, byte[] content) throws java.text.ParseException
createResponse
in interface javax.sip.message.MessageFactory
statusCode
- the new integer of the statusCode value of this
Message.request
- the received Request object upon which to base the
Response.contentType
- the new ContentTypeHeader object of the content type
value of this Message.content
- the new byte array of the body content value of this
Message.java.text.ParseException
- which signals that an error has been reached
unexpectedly while parsing the statusCode or the body.public javax.sip.message.Response createResponse(int statusCode, javax.sip.message.Request request) throws java.text.ParseException
createResponse
in interface javax.sip.message.MessageFactory
statusCode
- the new integer of the statusCode value of this
Message.request
- the received Request object upon which to base the
Response.java.text.ParseException
- which signals that an error has been reached
unexpectedly while parsing the statusCode or the body.public javax.sip.message.Response createResponse(java.lang.String responseParam) throws java.text.ParseException
createResponse
in interface javax.sip.message.MessageFactory
responseParam
- is a string representing the response. The argument
should only contain the Sip Headers and not the body of the response.java.text.ParseException
- which signals an error has been reached unexpectedly
while parsing the response.public static java.lang.String generateLocalTag()
public javax.sip.message.Request createRequest(javax.sip.Dialog dialog, java.lang.String method) throws OperationFailedException
Request
of a specific method which is to be sent in
a specific Dialog and populates its generally-necessary
headers such as the Authorization header.dialog
- the Dialog to create the new
Request inmethod
- the method of the newly-created RequestRequest
of the specified method which
is to be sent in the specified dialog and populated with its
generally-necessary headers such as the Authorization headerOperationFailedException
- if we get a SipException while creating
the new request from dialog.public javax.sip.message.Request createInviteRequest(javax.sip.address.Address toAddress) throws OperationFailedException, java.lang.IllegalArgumentException
toAddress
- the sip address of the callee that the request is meant
for.OperationFailedException
- with the corresponding code if creating
the request fails.java.lang.IllegalArgumentException
- if toAddress does not appear
to be a valid destination.public javax.sip.message.Request createInviteRequest(javax.sip.address.Address toAddress, javax.sip.message.Message cause) throws OperationFailedException, java.lang.IllegalArgumentException
toAddress
- the sip address of the callee that the request is meant
for.cause
- the SIP Message from which the information is
to be copied or null if there is no cause to be reflected (
e.g. a refer request).OperationFailedException
- with the corresponding code if creating
the request fails.java.lang.IllegalArgumentException
- if toAddress does not appear
to be a valid destination.public javax.sip.message.Request createAck(javax.sip.ClientTransaction clientTransaction) throws javax.sip.InvalidArgumentException, javax.sip.SipException
clientTransaction
- the transaction that caused us to send an Ack.javax.sip.InvalidArgumentException
- if there is a problem with the supplied
CSeq ( for example <= 0 ).javax.sip.SipException
- if the CSeq does not relate to a previously sent
INVITE or if the Method that created the Dialog is not an INVITE ( for
example SUBSCRIBE)public void preAuthenticateRequest(javax.sip.message.Request request)
request
- the request that we'd like to try pre-authenticating.public javax.sip.message.Request createRegisterRequest(javax.sip.address.Address addressOfRecord, int registrationsExpiration, javax.sip.header.CallIdHeader callIdHeader, long cSeqValue) throws javax.sip.InvalidArgumentException, java.text.ParseException, OperationFailedException
addressOfRecord
- the address that we shall be registeringregistrationsExpiration
- the expiration interval for the AORcallIdHeader
- the Call-ID header for our new Request.cSeqValue
- the sequence number of the new request.javax.sip.InvalidArgumentException
- in case there's a problem with any of
the arguments that we received for this request.java.text.ParseException
- in case there's a problem with any of
the arguments that we received for this request.OperationFailedException
- if we have a problem with the
MaxForwardsHeader.public javax.sip.message.Request createUnRegisterRequest(javax.sip.message.Request registerRequest, long cSeqValue) throws javax.sip.InvalidArgumentException
registerRequest
- the request that established the registration
we are now about to terminate.cSeqValue
- the value of the sequence number that the new
Request should list in its CSeq header.javax.sip.InvalidArgumentException
- if we fail constructing the request for
some reason.
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.