|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--jain.protocol.ip.sip.header.Header
|
+--jain.protocol.ip.sip.header.GeneralHeader
|
+--jain.protocol.ip.sip.header.ContactHeader
This class represents the Contact general-header. A ContactHeader field can appear in InviteMessage, AckMessage and RegisterMessages, and in ResponseMessages with any INFORMATIONAL, SUCCESS, REDIRECT, or CLIENT_ERROR_AMBIGUOUS status codes. In general, it provides a URL where the user can be reached for further communications.
InviteMessages and AckMessages: InviteMessages and AckMessages may contain ContactHeaders indicating from which location the request is originating.
This allows the callee to send future requests, such as ByeMessages, directly to the caller instead of through a series of proxies. The ViaHeader is not sufficient since the desired address may be that of a proxy.
SUCCESS ResponseMessages for InviteMessages: A user agent server sending a definitive, positive response (SUCCESS) may insert a ContactHeader in the ResponseMessage indicating the SIP address under which it is reachable most directly for future SIP requests, such as AckMessage, within the same Call-ID. The ContactHeader contains the address of the server itself or that of a proxy, e.g., if the host is behind a firewall. The value of this Contact header is copied into the Request-URI of subsequent requests for this call if the response did not also contain a RecordRouteHeader. If the response also contains a RecordRouteHeader, the address in the ContactHeader is added as the last item in the RouteHeader. See RecordRouteHeader for details.
The ContactHeader should not be cached across calls, as it may not represent the most desirable location for a particular destination address.
INFORMATIONAL ResponseMessages for InviteMessages: A server sending an INFORMATIONAL ResponseMessage may insert a ContactHeader. It has the same semantics in an INFORMATIONAL ResponseMessage as a SUCCESS ResponseMessage. Note that CancelMessages must not be sent to that address, but rather follow the same path as the original request.
RegisterMessages: RegisterMessages may contain ContactHeaders indicating at which locations the user is reachable. The RegisterMessage defines a wildcard ContactHeader which must only be used with Expires set to 0 to remove all registrations for a particular user. An optional "expires" parameter indicates the desired expiration time of the registration. If a ContactHeader does not have an "expires" parameter, the ExpiresHeader field is used as the default value. If neither of these mechanisms is used, SIP URIs are assumed to expire after one hour. Other URI schemes have no expiration times.
SUCCESS ResponseMessages for RegisterMessages: A ResponseMessage for a RegisterMessage may return all locations at which the user is currently reachable. An optional "expires" parameter indicates the expiration time of the registration. If a ContactHeader does not have an "expires" parameter, the value of the ExpiresHeader indicates the expiration time. If neither mechanism is used, the expiration time specified in the request, explicitly or by default, is used.
REDIRECTION and CLIENT_ERROR_AMBIGUOUS ResponseMessages: The ContactHeader can be used with a REDIRECTION or CLIENT_ERROR_AMBIGUOUS ResponseMessage to indicate one or more alternate addresses to try. It can appear in ResponseMessages for ByeMessages, InviteMessages and OptionsMessage. ContactHeaders contain URIs giving the new locations or user names to try, or may simply specify additional transport parameters. A REDIRECTION_MULTIPLE_CHOICES, REDIRECTION_MOVED_PERMANENTLY, REDIRECTION_MOVED_TEMPORARILY, CLIENT_ERROR_AMBIGUOUS ResponseMessage should contain one or more ContactHeaders containing URIs of new addresses to be tried. A REDIRECTION_MOVED_PERMANENTLY or REDIRECTION_MOVED_TEMPORARILY ResponseMessage may also give the same location and username that was being tried but specify additional transport parameters such as a different server or multicast address to try or a change of SIP transport from UDP to TCP or vice versa. The client copies the "user", "password", "host", "port" and "user-param" elements of the Contact URI into the Request-URI of the redirected request and directs the request to the address specified by the "maddr" and "port" parameters, using the transport protocol given in the "transport" parameter. If "maddr" is a multicast address, the value of "ttl" is used as the time-to-live value.
Note that the ContactHeader field may also refer to a different entity than the one originally called. For example, a SIP call connected to GSTN gateway may need to deliver a special information announcement such as "The number you have dialed has been changed."
A ContactHeader in a ResponseMessage can contain any suitable URI indicating where the called party can be reached, not limited to SIP URLs. For example, it could contain URL's for phones, fax, or irc (if they were defined) or a mailto: URL.
The following parameters are defined.
q: The "qvalue" indicates the relative preference among the locations given. "qvalue" values are decimal numbers from 0 to 1, with higher values indicating higher preference.
action: The "action" parameter is used only when registering with the RegisterMessage. It indicates whether the client wishes that the server proxy or redirect future requests intended for the client. If this parameter is not specified the action taken depends on server configuration. In its response, the registrar should indicate the mode used. This parameter is ignored for other requests.
expires: The "expires" parameter indicates how long the URI is valid. The parameter is either a number indicating seconds or a quoted string containing a SIP-date. If this parameter is not provided, the value of the ExpiresHeader determines how long the URI is valid. Implementations may treat values larger than 2**32-1 (4294967295 seconds or 136 years) as equivalent to 2**32-1.
RecordRouteHeader| Field Summary | |
static int |
ACTION_PROXY
|
static int |
ACTION_REDIRECT
|
static java.lang.String |
token
Token of ContactHeader |
| Fields inherited from class jain.protocol.ip.sip.header.Header |
ENTITY_HEADER,
GENERAL_HEADER,
REQUEST_HEADER,
RESPONSE_HEADER |
| Constructor Summary | |
ContactHeader()
Creates a wildcard ContactHeader. |
|
ContactHeader(NameAddress nameAddress)
Creates a ContactHeader based on given NameAddress |
|
| Method Summary | |
java.lang.Object |
clone()
Creates and returns copy of ContactHeader |
boolean |
equals(ContactHeader contactHeader)
Indicates whether some other ContactHeader is "equal to" this one |
int |
getAction()
Gets action of ContactHeader |
java.lang.String |
getComment()
Gets comment of ContactHeader |
java.util.Date |
getExpiryDate()
Gets expiry date of ContactHeader |
long |
getExpiryDeltaSeconds()
Gets expiry delta-seconds of ContactHeader |
java.lang.String |
getExtension(java.lang.String extension)
Gets the value of specified extension parameter in ContactHeader |
java.lang.String[] |
getExtensions()
Gets an array of the names of ContactHeader's extension parameters |
NameAddress |
getNameAddress()
Gets NameAddress of ContactHeader |
float |
getQValue()
Gets q-value of ContactHeader |
java.lang.String |
getValue()
Gets value of ContactHeader |
boolean |
hasAction()
Gets boolean value to indicate if ContactHeader has action |
boolean |
hasComment()
Gets boolean value to indicate if ContactHeader has comment |
boolean |
hasExpires()
Gets boolean value to indicate if ContactHeader has expires value |
boolean |
hasExpiryDate()
Gets boolean value to indicate if ContactHeader has expiry value that is a date |
boolean |
hasExtension(java.lang.String extension)
Gets boolean value to indicate if ContactHeader has specified extension parameter |
boolean |
hasExtensions()
Gets boolean value to indicate if ContactHeader has extension parameters |
boolean |
hasQValue()
Gets boolean value to indicate if ContactHeader has q-value |
boolean |
isWildCard()
Returns boolean value indicating whether ContactHeader is a wild card |
void |
removeAction()
Removes action from ContactHeader |
void |
removeExpires()
Removes expires value from ContactHeader |
void |
removeExtension(java.lang.String extension)
Removes specified extension parameter from ContactHeader |
void |
removeExtensions()
Removes all extension parameters from ContactHeader |
void |
removeQValue()
Removes q-value from ContactHeader |
void |
setAction(int action)
Sets action of ContactHeader |
void |
setComment(java.lang.String comment)
Sets comment of ContactHeader |
void |
setExpiryDate(java.util.Date expiryDate)
Sets expiry value of ContactHeader to a date |
void |
setExpiryDeltaSeconds(long expiryDeltaSeconds)
Sets expiry value of ContactHeader to a number of delta-seconds |
void |
setExtension(java.lang.String extension,
java.lang.String value)
Sets value of extension parameter to value in ContactHeader |
void |
setNameAddress(NameAddress nameAddress)
Sets NameAddress of ContactHeader |
void |
setQvalue(float qValue)
Sets q-value of ContactHeader |
| Methods inherited from class jain.protocol.ip.sip.header.Header |
equals,
getHeaderType,
getToken,
setValue,
toString |
| Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
public static final java.lang.String token
public static final int ACTION_PROXY
public static final int ACTION_REDIRECT
| Constructor Detail |
public ContactHeader(NameAddress nameAddress)
throws java.lang.IllegalArgumentException
nameAddress - NameAddresspublic ContactHeader()
| Method Detail |
public boolean isWildCard()
public java.lang.String getComment()
throws ParameterNotSetException
public void setComment(java.lang.String comment)
throws java.lang.IllegalArgumentException
comment - commentpublic boolean hasExtension(java.lang.String extension)
public NameAddress getNameAddress()
throws ParameterNotSetException
public void setExtension(java.lang.String extension,
java.lang.String value)
throws java.lang.IllegalArgumentException
extension - name of extension parametervalue - value of extension parameterpublic void removeExtension(java.lang.String extension)
extension - extension parameter to remove from AcceptHeaderpublic void removeExtensions()
public java.lang.String[] getExtensions()
throws ParameterNotSetException
public java.lang.String getExtension(java.lang.String extension)
throws ParameterNotSetException
extension - extension parameter to retrieve
public void setNameAddress(NameAddress nameAddress)
throws java.lang.IllegalArgumentException
nameAddress - NameAddress
public float getQValue()
throws ParameterNotSetException
public boolean hasAction()
public boolean hasExtensions()
public boolean hasQValue()
public boolean hasExpires()
public boolean hasComment()
public boolean hasExpiryDate()
public void removeQValue()
public void setQvalue(float qValue)
throws java.lang.IllegalArgumentException
qValue - q-value
public void setAction(int action)
throws java.lang.IllegalArgumentException
action - action (either ACTION_PROXY or ACTION_REDIRECT)public void removeAction()
public int getAction()
throws ParameterNotSetException
public void setExpiryDeltaSeconds(long expiryDeltaSeconds)
throws java.lang.IllegalArgumentException
expiryDeltaSeconds - number of delta-seconds until expiry
public void setExpiryDate(java.util.Date expiryDate)
throws java.lang.IllegalArgumentException
expiryDate - date of expirypublic void removeExpires()
public long getExpiryDeltaSeconds()
throws ParameterNotSetException
public java.util.Date getExpiryDate()
throws ParameterNotSetException
public java.lang.String getValue()
public java.lang.Object clone()
public boolean equals(ContactHeader contactHeader)
contactHeader - the ContactHeader with which to compare
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Copyright - 2000 Sun Microsystems