|
NIST SIP Parser and Stack (v1.2) API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The Via header field indicates the transport used for the transaction and identifies the location where the response is to be sent. A Via header field value is added only after the transport that will be used to reach the next hop has been selected. When the UAC creates a request, it MUST insert a Via into that request. The protocol name and protocol version in the header field MUST be SIP and 2.0, respectively. The Via header field value MUST contain a branch parameter. This parameter is used to identify the transaction created by that request. This parameter is used by both the client and the server.
Branch Paramater:
The branch parameter value MUST be unique across space and time for all
requests sent by the User Agent. The exceptions to this rule are CANCEL and ACK for
non-2xx responses. A CANCEL request will have the same value of the branch
parameter as the request it cancels. An ACK for a non-2xx response will also
have the same branch ID as the INVITE whose response it acknowledges.
The uniqueness property of the branch ID parameter, to facilitate its use as
a transaction ID, was not part of RFC 2543. The branch ID inserted by an
element compliant with this specification MUST always begin with the
characters "z9hG4bK". These 7 characters are used as a magic cookie (7 is
deemed sufficient to ensure that an older RFC 2543 implementation would not
pick such a value), so that servers receiving the request can determine that
the branch ID was constructed in the fashion described by this specification
(that is, globally unique). Beyond this requirement, the precise format of
the branch token is implementation-defined. JAIN SIP defines a convenience
function to generate unique branch idenifiers at
Transaction.getBranchId()
A common way to create the branch value is to compute a cryptographic hash of the To tag, From tag, Call-ID header field, the Request-URI of the request received (before translation), the topmost Via header, and the sequence number from the CSeq header field, in addition to any Proxy-Require and Proxy-Authorization header fields that may be present. The algorithm used to compute the hash is implementation-dependent.
Via Processing Rules
Two Via header fields are equal if their sent-protocol and sent-by fields are equal, both have the same set of parameters, and the values of all parameters are equal.
Field Summary | |
static String |
NAME
Name of ViaHeader |
Method Summary | |
String |
getBranch()
Gets the branch paramater of the ViaHeader. |
String |
getHost()
Returns the host part of this ViaHeader. |
String |
getMAddr()
Returns the value of the maddr parameter, or null if this
is not set. |
int |
getPort()
Returns the port part of this ViaHeader. |
String |
getProtocol()
Returns the value of the protocol used. |
String |
getReceived()
Gets the received paramater of the ViaHeader. |
String |
getTransport()
Returns the value of the transport parameter. |
int |
getTTL()
Returns the value of the ttl parameter, or -1 if this is not set. |
void |
setBranch(String branch)
Sets the branch parameter of the ViaHeader to the newly supplied branch value. |
void |
setHost(String host)
Set the host part of this ViaHeader to the newly supplied host
parameter. |
void |
setMAddr(String mAddr)
Sets the value of the maddr parameter of this ViaHeader. |
void |
setPort(int port)
Set the port part of this ViaHeader to the newly supplied port
parameter. |
void |
setProtocol(String protocol)
Sets the value of the protocol parameter. |
void |
setReceived(String received)
Sets the received parameter of ViaHeader. |
void |
setTransport(String transport)
Sets the value of the transport. |
void |
setTTL(int ttl)
Sets the value of the ttl parameter. |
Methods inherited from interface javax.sip.header.Parameters |
getParameter, getParameterNames, removeParameter, setParameter |
Methods inherited from interface javax.sip.header.Header |
clone, equals, getName, toString |
Field Detail |
public static final String NAME
Method Detail |
public void setHost(String host) throws ParseException
host
parameter.
ParseException
- which signals that an error has been reached
unexpectedly while parsing the host value.public String getHost()
public void setPort(int port)
port
parameter.
port
- - the new interger value of the port of this ViaHeaderpublic int getPort()
public String getTransport()
public void setTransport(String transport) throws ParseException
transport
- - new value for the transport parameter
ParseException
- which signals that an error has been reached
unexpectedly while parsing the transport value.public String getProtocol()
public void setProtocol(String protocol) throws ParseException
protocol
- - new value for the protocol parameter
ParseException
- which signals that an error has been reached
unexpectedly while parsing the protocol value.public int getTTL()
ttl
parameterpublic void setTTL(int ttl) throws InvalidArgumentException
ttl
- - new value of the ttl parameter
InvalidArgumentException
- if supplied value is less than zero or
greater than 255, excluding -1 the default not set value.public String getMAddr()
maddr
parameter, or null if this
is not set.
public void setMAddr(String mAddr) throws ParseException
maddr
parameter of this ViaHeader. The
maddr parameter indicates the server address to be contacted for this
user, overriding any address derived from the host field.
ParseException
- which signals that an error has been reached
unexpectedly while parsing the mAddr value.public String getReceived()
public void setReceived(String received) throws ParseException
received
- - the newly supplied received parameter.
ParseException
- which signals that an error has been reached
unexpectedly while parsing the received value.public String getBranch()
public void setBranch(String branch) throws ParseException
branch
- - the new string branch parmameter of the ViaHeader.
ParseException
- which signals that an error has been reached
unexpectedly while parsing the branch value.
|
NIST SIP Parser and Stack (v1.2) API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |