Package org.linphone.core

# Interface Address

public interface Address
Object that represents a parsed SIP address.
A SIP address is made of display name, username, domain name, port, and various
uri headers (such as tags). It looks like 'Alice invalid input: '<'sip:alice@example.net>'.
A SIP address is made of display name, username, domain name, port, and various
uri headers (such as tags). It looks like 'Alice invalid input: '<'sip:alice@example.net>'.
You can create an address using `Factory.createAddress(java.lang.String)` or `Core.interpretUrl(java.lang.String)`
and both will return a null object if it doesn't match the grammar defined by
the standard.
This object is used in almost every other major objects to identity people
(including yourself) invalid input: '&' servers.
The `Address` has methods to extract and manipulate all parts of the
address.

## Nested Class Summary

Nested Classes
Modifier and Type
Interface
Description
`static enum`
`Address.Family`

## Method Summary

Modifier and Type
Method
Description
`String`
`asString()`
Returns the address as a string.
`String`
`asStringUriOnly()`
Returns the SIP uri only as a string, that is display name is removed.
`String`
`asStringUriOnlyOrdered()`
Returns the SIP uri only as a string, that is display name is removed.
`void`
`clean()`
Removes address's tags and uri headers so that it is displayable to the user.
`Address`
`clone()`
Clones a `Address` object.
`boolean`
`equal(Address address2)`
Compare two `Address` taking the tags and headers into account.
`String`
`getDisplayName()`
Returns the display name.
`String`
`getDomain()`
Returns the domain name.
`String`
`getHeader(String headerName)`
Get the header encoded in the address.
`String`
`getMethodParam()`
Get the value of the method parameter.
`long`
`getNativePointer()`
Gets the native pointer used by this class to make native method calls.
`String`
`getParam(String paramName)`
Gets the value of a parameter of the address.
`String`
`getPassword()`
Get the password encoded in the address.
`int`
`getPort()`
Get port number as an integer value, 0 if not present.
`String`
`getScheme()`
Returns the address scheme, normally "sip".
`boolean`
`getSecure()`
Returns whether the address refers to a secure location (sips) or not.
`TransportType`
`getTransport()`
Gets the transport.
`String`
`getUriParam(String uriParamName)`
Get the value of a parameter of the URI of the address.
`Object`
`getUserData()`
Gets the object stored in this object user's data
`String`
`getUsername()`
Returns the username.
`boolean`
`hasParam(String paramName)`
Tells whether a parameter is present in the address.
`boolean`
`hasUriParam(String uriParamName)`
Tell whether a parameter is present in the URI of the address.
`boolean`
`isSip()`
returns whether the address is a routable SIP address or not
`boolean`
`isValid()`
Returns if address is valid.
`boolean`
`lesser(Address other)`
Compare two addresses.
`void`
`removeUriParam(String uriParamName)`
Removes the value of a parameter of the URI of the address.
`int`
`setDisplayName(String displayName)`
Sets the display name.
`int`
`setDomain(String domain)`
Sets the domain.
`void`
`setHeader(String headerName, String headerValue)`
Set a header into the address.
`void`
`setMethodParam(String methodParam)`
Set the value of the method parameter.
`void`
`setParam(String paramName, String paramValue)`
Sets the value of a parameter of the address.
`void`
`setParams(String params)`
Sets parameters from a raw string.
`void`
`setPassword(String password)`
Set the password encoded in the address.
`int`
`setPort(int port)`
Sets the port number.
`void`
`setSecure(boolean enabled)`
Make the address refer to a secure location (sips scheme)
`int`
`setTransport(TransportType transport)`
Sets a transport.
`void`
`setUriParam(String uriParamName, String uriParamValue)`
Set the value of a parameter of the URI of the address.
`void`
`setUriParams(String params)`
Set the value of the parameters of the URI of the address.
`void`
`setUserData(Object data)`
Sets the object to store in this object user's data
`int`
`setUsername(String username)`
Sets the username.
`String`
`toString()`
`boolean`
`weakEqual(Address address2)`
Compare two `Address` ignoring tags and headers, basically just domain,
username, and port.

## Method Details

### getDisplayName

String getDisplayName()
Returns the display name.

Returns:
  the display name if any, null otherwise.

### setDisplayName

int setDisplayName(String displayName)
Sets the display name.

Parameters:
  `displayName` - the display name to set.

### getDomain

String getDomain()
Returns the domain name.

Returns:
  the domain name if any, null otherwise.

### setDomain

int setDomain(String domain)
Sets the domain.

Parameters:
  `domain` - the domain to set.

### isSip

boolean isSip()
returns whether the address is a routable SIP address or not

Returns:
  true if it is a routable SIP address, false otherwise

### isValid

boolean isValid()
Returns if address is valid.

Returns:
  true is the address is valid, false otherwise

### getMethodParam

String getMethodParam()
Get the value of the method parameter.

Returns:
  the value of the parameter or null.

### setMethodParam

void setMethodParam(String methodParam)
Set the value of the method parameter.

Parameters:
  `methodParam` - the value to set to the method parameter.

### setParams

void setParams(String params)
Sets parameters from a raw string.

Parameters:
  `params` - The parameters.

### getPassword

String getPassword()
Get the password encoded in the address.
It is used for basic authentication (not recommended).

Returns:
  the password if any, null otherwise.

### setPassword

void setPassword(String password)
Set the password encoded in the address.
It is used for basic authentication (not recommended).

Parameters:
  `password` - the password to set.

### getPort

int getPort()
Get port number as an integer value, 0 if not present.

Returns:
  the port set in the address or 0 if not present.

### setPort

int setPort(int port)
Sets the port number.

Parameters:
  `port` - the port to set in the address

### getScheme

String getScheme()
Returns the address scheme, normally "sip".

Returns:
  the scheme if any, null otherwise.

### getSecure

boolean getSecure()
Returns whether the address refers to a secure location (sips) or not.

Returns:
  true if address refers to a secure location, false otherwise

### setSecure

void setSecure(boolean enabled)
Make the address refer to a secure location (sips scheme)

Parameters:
  `enabled` - true if address is requested to be secure.

### getTransport

TransportType getTransport()
Gets the transport.

Returns:
  A `TransportType` (default value if not set is UDP).

### setTransport

int setTransport(TransportType transport)
Sets a transport.

Parameters:
  `transport` - A `TransportType`

### setUriParams

void setUriParams(String params)
Set the value of the parameters of the URI of the address.

Parameters:
  `params` - The parameters string

### getUsername

String getUsername()
Returns the username.

Returns:
  the username name if any, null otherwise.

### setUsername

int setUsername(String username)
Sets the username.

Parameters:
  `username` - the username to set.

### asString

String asString()
Returns the address as a string.
The returned char * must be freed by the application. Use ms_free().

Returns:
  a string representation of the address.

### asStringUriOnly

String asStringUriOnly()
Returns the SIP uri only as a string, that is display name is removed.
The returned char * must be freed by the application. Use ms_free().

Returns:
  a string representation of the address.

### asStringUriOnlyOrdered

String asStringUriOnlyOrdered()
Returns the SIP uri only as a string, that is display name is removed.
This function always returns a string whose URI parameters has a constant order
allowing to easily compute hashes for example. The returned char * must be
freed by the application. Use ms_free().

Returns:
  a string representation of the address.

### clean

void clean()
Removes address's tags and uri headers so that it is displayable to the user.

### clone

Address clone()
Clones a `Address` object.

Returns:
  a new `Address` object.

### equal

boolean equal(Address address2)
Compare two `Address` taking the tags and headers into account.

Parameters:
  `address2` - `Address` object.
Returns:
  Boolean value telling if the `Address` objects are equal.
  see: `weakEqual(org.linphone.core.Address)`

### getHeader

String getHeader(String headerName)
Get the header encoded in the address.

Parameters:
  `headerName` - the header name.
Returns:
  the header value or null if it doesn't exists.

### getParam

String getParam(String paramName)
Gets the value of a parameter of the address.

Parameters:
  `paramName` - The name of the parameter.
Returns:
  The value of the parameter or null if it doesn't exists.

### getUriParam

String getUriParam(String uriParamName)
Get the value of a parameter of the URI of the address.

Parameters:
  `uriParamName` - The name of the parameter.
Returns:
  The value of the parameter or null if it doesn't exists.

### hasParam

boolean hasParam(String paramName)
Tells whether a parameter is present in the address.

Parameters:
  `paramName` - The name of the parameter.
Returns:
  A boolean value telling whether the parameter is present in the address

### hasUriParam

boolean hasUriParam(String uriParamName)
Tell whether a parameter is present in the URI of the address.

Parameters:
  `uriParamName` - The name of the parameter.
Returns:
  A boolean value telling whether the parameter is present in the URI of
  the address

### lesser

boolean lesser(Address other)
Compare two addresses.

Parameters:
  `other` - an other `Address` object.

### removeUriParam

void removeUriParam(String uriParamName)
Removes the value of a parameter of the URI of the address.

Parameters:
  `uriParamName` - The name of the parameter.

### setHeader

void setHeader(String headerName, String headerValue)
Set a header into the address.
Headers appear in the URI with '?', such as
invalid input: '<'sip:test@linphone.org?SomeHeader=SomeValue>.
Headers appear in the URI with '?', such as
invalid input: '<'sip:test@linphone.org?SomeHeader=SomeValue>.

Parameters:
  `headerName` - the header name.
  `headerValue` - the header value.

### setParam

void setParam(String paramName, String paramValue)
Sets the value of a parameter of the address.

Parameters:
  `paramName` - The name of the parameter.
  `paramValue` - The new value of the parameter.

### setUriParam

void setUriParam(String uriParamName, String uriParamValue)
Set the value of a parameter of the URI of the address.

Parameters:
  `uriParamName` - The name of the parameter.
  `uriParamValue` - The new value of the parameter.

### weakEqual

boolean weakEqual(Address address2)
Compare two `Address` ignoring tags and headers, basically just domain,
username, and port.

Parameters:
  `address2` - `Address` object.
Returns:
  Boolean value telling if the `Address` objects are equal.
  see: `equal(org.linphone.core.Address)`

### setUserData

void setUserData(Object data)
Sets the object to store in this object user's data

Parameters:
  `data` - the object to store

### getUserData

Object getUserData()
Gets the object stored in this object user's data

Returns:
  the object store if any, null otherwise

### getNativePointer

long getNativePointer()
Gets the native pointer used by this class to make native method calls.

Returns:
  the nativer pointer, as long

### toString

String toString()

Overrides:
  `toString` in class `Object`