JSIP API v1.2
November 2006

javax.sip.header
Interface ContactHeader

All Superinterfaces:
java.lang.Cloneable, Header, HeaderAddress, Parameters, java.io.Serializable

public interface ContactHeader
extends HeaderAddress, Parameters, Header

A Contact header field value provides a URI whose meaning depends on the type of request or response it is in. A Contact header field value can contain a display name, a URI with URI parameters, and header parameters.

The Contact header field provides a SIP or SIPS URI that can be used to contact that specific instance of the User Agent for subsequent requests. The Contact header field MUST be present and contain exactly one SIP or SIPS URI in any request that can result in the establishment of a dialog. For the methods defined in this specification, that includes only the INVITE request. For these requests, the scope of the Contact is global. That is, the Contact header field value contains the URI at which the User Agent would like to receive requests, and this URI MUST be valid even if used in subsequent requests outside of any dialogs.

If the Request-URI or top Route header field value contains a SIPS URI, the Contact header field MUST contain a SIPS URI as well.

Messages and Contact Headers

The ContactHeader defines the Contact parameters "q" and "expires". The q-value value is used to prioritize addresses in a list of contact addresses. The expires value suggests an expiration interval that indicates how long the client would like a registration to be valid for a specific address. These parameters are only used when the Contact is present in a: For Example:
Contact: "Mr. Watson" sip:watson@worcester.jcp.org; q=0.7; expires=3600, "Mr. Watson" mailto:watson@jcp.org.com; q=0.1

Author:
BEA Systems, NIST
See Also:
HeaderAddress, Parameters

Field Summary
static java.lang.String NAME
          Name of ContactHeader
 
Method Summary
 int getExpires()
          Returns the value of the expires parameter or -1 if no expires parameter was specified or if the parameter value cannot be parsed as an int.
 float getQValue()
          Returns the value of the q-value parameter of this ContactHeader.
 boolean isWildCard()
          Returns a boolean value that indicates if the contact header has the format of Contact: *.
 void setExpires(int expires)
          Sets the value of the expires parameter as delta-seconds.
 void setQValue(float qValue)
          Sets the qValue value of the Name Address.
 void setWildCard()
          Sets a wildcard on this contact address that is "*" is assigned to the contact header so that the header will have the format of Contact: *.
 
Methods inherited from interface javax.sip.header.HeaderAddress
getAddress, setAddress
 
Methods inherited from interface javax.sip.header.Parameters
getParameter, getParameterNames, removeParameter, setParameter
 
Methods inherited from interface javax.sip.header.Header
clone, equals, getName, hashCode, toString
 

Field Detail

NAME

static final java.lang.String NAME
Name of ContactHeader

See Also:
Constant Field Values
Method Detail

setExpires

void setExpires(int expires)
                throws InvalidArgumentException
Sets the value of the expires parameter as delta-seconds. When a client sends a REGISTER request, it MAY suggest an expiration interval that indicates how long the client would like the registration to be valid for a specific address. There are two ways in which a client can suggest an expiration interval for a binding: The latter allows expiration intervals to be suggested on a per-binding basis when more than one binding is given in a single REGISTER request, whereas the former suggests an expiration interval for all Contact header field values that do not contain the "expires" parameter. If neither mechanism for expressing a suggested expiration time is present in a REGISTER, the client is indicating its desire for the server to choose.

A User Agent requests the immediate removal of a binding by specifying an expiration interval of "0" for that contact address in a REGISTER request. User Agents SHOULD support this mechanism so that bindings can be removed before their expiration interval has passed. The REGISTER-specific Contact header field value of "*" applies to all registrations, but it MUST NOT be used unless the Expires header field is present with a value of "0". The "*" value can be determined if "this.getNameAddress().isWildcard() = = true".

Parameters:
expires - new relative value of the expires parameter. 0 implies removal of Registration specified in Contact Header.
Throws:
InvalidArgumentException - if supplied value is less than zero.

getExpires

int getExpires()
Returns the value of the expires parameter or -1 if no expires parameter was specified or if the parameter value cannot be parsed as an int.

Returns:
value of the expires parameter measured in delta-seconds, O implies removal of Registration specified in Contact Header.

setQValue

void setQValue(float qValue)
               throws InvalidArgumentException
Sets the qValue value of the Name Address. If more than one Contact is sent in a REGISTER request, the registering UA intends to associate all of the URIs in these Contact header field values with the address-of-record present in the To field. This list can be prioritized with the "q" parameter in the Contact header field. The "q" parameter indicates a relative preference for the particular Contact header field value compared to other bindings for this address-of-record. A value of -1 indicates the qValue paramater is not set.

Parameters:
qValue - - the new float value of the q-value parameter.
Throws:
InvalidArgumentException - if the q-value parameter value is not -1 or between 0 and 1.

getQValue

float getQValue()
Returns the value of the q-value parameter of this ContactHeader. The q-value parameter indicates the relative preference amongst a set of locations. q-values are decimal numbers from 0 to 1, with higher values indicating higher preference.

Returns:
the q-value parameter of this ContactHeader, -1 if the q-value is not set.

setWildCard

void setWildCard()
Sets a wildcard on this contact address that is "*" is assigned to the contact header so that the header will have the format of Contact: *.

Since:
v1.2

isWildCard

boolean isWildCard()
Returns a boolean value that indicates if the contact header has the format of Contact: *.

Returns:
true if this is a wildcard address, false otherwise.
Since:
v1.2

JSIP API v1.2
November 2006

If you have any comments, please mail them to JAIN-SIP-INTEREST@java.sun.com after subscribing at http://archives.java.sun.com
Copyright - 2006 BEA Systems and Sun Microsystems