org.lastbamboo.common.sip.stack.message
Interface SipMessageFactory

All Known Implementing Classes:
SipMessageFactoryImpl

public interface SipMessageFactory

Interface for factories for creating SIP messages.


Method Summary
 Invite addVia(Invite message, SipHeader newHeader)
          Copies all the data from the original message into a new message, adding the specified Via header.
 Register addVia(Register request, SipHeader via)
          Copies all the data from the original message into a new message, adding the specified Via header.
 SipMessage createErrorResponse(SipMessage request, org.apache.commons.id.uuid.UUID instanceId, URI contactUri, int responseCode, String reasonPhrase)
          Creates an error response to the specified request.
 SipResponse createInviteOk(Invite request, org.apache.commons.id.uuid.UUID instanceId, URI contactUri, org.littleshoot.mina.common.ByteBuffer body)
          Creates a new INVITE OK message, copying data from the specified request.
 Invite createInviteRequest(String displayName, URI toUri, URI fromUri, org.apache.commons.id.uuid.UUID instanceId, URI contactUri, org.littleshoot.mina.common.ByteBuffer body)
          Creates a new invite request outside of a dialog.
 Invite createInviteToForward(InetSocketAddress socketAddress, Invite invite)
          Creates a new message to forward with all of the appropriate modifications to the Via header based on the remote reading of the socket address and port.
 SipResponse createRegisterOk(Register register)
          Creates a register OK message from the specified request.
 Register createRegisterRequest(URI requestUri, String displayName, URI toUri, org.apache.commons.id.uuid.UUID instanceId, URI contactUri)
          Creates a new register request.
 SipResponse createRequestTimeoutResponse(SipMessage request)
          Creates a 408 Request Timeout response.
 SipResponse stripVia(SipResponse response)
          Strips the topmost Via header from the response, returning a new message without the topmost Via.
 

Method Detail

createRegisterRequest

Register createRegisterRequest(URI requestUri,
                               String displayName,
                               URI toUri,
                               org.apache.commons.id.uuid.UUID instanceId,
                               URI contactUri)
Creates a new register request.

Parameters:
requestUri - The request URI for the request start line.
displayName - The display name to send the request to.
toUri - The URI to send the request to.
instanceId - The instance ID of the registering SIP entity.
contactUri - The contact URI of the registering SIP entity.
Returns:
The new SIP register request.

createInviteRequest

Invite createInviteRequest(String displayName,
                           URI toUri,
                           URI fromUri,
                           org.apache.commons.id.uuid.UUID instanceId,
                           URI contactUri,
                           org.littleshoot.mina.common.ByteBuffer body)
Creates a new invite request outside of a dialog. This will generate a new Call-ID for the dialog.

Parameters:
displayName - The name to display.
toUri - The SIP URI to send the message to.
fromUri - The SIP URI the message is from.
instanceId - The instance ID of the sending client, used in the contact header.
contactUri - The contact URI.
body - The body of the INVITE. This is typcically SDP.
Returns:
The new invite.

createInviteOk

SipResponse createInviteOk(Invite request,
                           org.apache.commons.id.uuid.UUID instanceId,
                           URI contactUri,
                           org.littleshoot.mina.common.ByteBuffer body)
Creates a new INVITE OK message, copying data from the specified request.

Parameters:
request - The request to respond to with an OK response.
instanceId - The instance ID of the responding user.
contactUri - The contact URI of the responding user.
body - The body of the message.
Returns:
A new INVITE OK with the specified data.

createErrorResponse

SipMessage createErrorResponse(SipMessage request,
                               org.apache.commons.id.uuid.UUID instanceId,
                               URI contactUri,
                               int responseCode,
                               String reasonPhrase)
Creates an error response to the specified request.

Parameters:
request - The request to create a response for.
instanceId - The instance ID of the resonding peer.
contactUri - The contact URI of the responding peer.
responseCode - The reason code for the response.
reasonPhrase - The reason phrase for the response.
Returns:
The new response message.

createRegisterOk

SipResponse createRegisterOk(Register register)
Creates a register OK message from the specified request.

Parameters:
register - The register request to create an OK response for.
Returns:
The register OK response.

addVia

Invite addVia(Invite message,
              SipHeader newHeader)
Copies all the data from the original message into a new message, adding the specified Via header.

Parameters:
message - The original message to create a new message from.
newHeader - The Via header to add.
Returns:
A new SIP message with all the data from the original message plus the specified header.

addVia

Register addVia(Register request,
                SipHeader via)
Copies all the data from the original message into a new message, adding the specified Via header.

Parameters:
request - The original message to create a new message from.
via - The Via header to add.
Returns:
A new SIP message with all the data from the original message plus the specified header.

stripVia

SipResponse stripVia(SipResponse response)
Strips the topmost Via header from the response, returning a new message without the topmost Via.

Parameters:
response - The response message to strip the Via from.
Returns:
The new message without the topmost Via header from the original.

createRequestTimeoutResponse

SipResponse createRequestTimeoutResponse(SipMessage request)
Creates a 408 Request Timeout response.

Parameters:
request - The request that timed out.
Returns:
The 408 Request Timeout response.

createInviteToForward

Invite createInviteToForward(InetSocketAddress socketAddress,
                             Invite invite)
                             throws IOException
Creates a new message to forward with all of the appropriate modifications to the Via header based on the remote reading of the socket address and port.

Parameters:
socketAddress - The remote socket address the INVITE arrived from.
invite - The incoming INVITE message.
Returns:
A new INVITE message with appropriate modifications to the Via header.
Throws:
IOException - If the message does not match the expected syntax.


Copyright © 2013 LittleShoot. All Rights Reserved.