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 <sip:alice@example.net>'.
You can create an address using
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) & servers.
The
address.
A SIP address is made of display name, username, domain name, port, and various
uri headers (such as tags). It looks like 'Alice <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) & servers.
The
Address
has methods to extract and manipulate all parts of theaddress.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionasString()
Returns the address as a string.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.clone()
Clones aAddress
object.boolean
Compare twoAddress
taking the tags and headers into account.Returns the display name.Returns the domain name.Get the header encoded in the address.Get the value of the method parameter.long
Gets the native pointer used by this class to make native method calls.Get the value of a parameter of the address.Get the password encoded in the address.int
getPort()
Get port number as an integer value, 0 if not present.Returns the address scheme, normally "sip".boolean
Returns whether the address refers to a secure location (sips) or not.Get the transport.getUriParam
(String uriParamName) Get the value of a parameter of the URI of the address.Gets the object stored in this object user's dataReturns the username.boolean
Tell 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.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
Sets the domain.void
Set a header into the address.void
setMethodParam
(String methodParam) Set the value of the method parameter.void
Set the value of a parameter of the address.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) Set 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 dataint
setUsername
(String username) Sets the username.toString()
boolean
Compare twoAddress
ignoring tags and headers, basically just domain,
username, and port.
-
Method Details
-
getDisplayName
Returns the display name.
- Returns:
- the display name if any, null otherwise.
-
setDisplayName
Sets the display name.
- Parameters:
displayName
- the display name to set.
-
getDomain
Returns the domain name.
- Returns:
- the domain name if any, null otherwise.
-
setDomain
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
@Nullable boolean isValid()Returns if address is valid.
- Returns:
- the scheme if any, null otherwise.
-
getMethodParam
Get the value of the method parameter.
- Returns:
- the value of the parameter or null.
-
setMethodParam
Set the value of the method parameter.
- Parameters:
methodParam
- the value to set to the method parameter.
-
getPassword
Get the password encoded in the address.
It is used for basic authentication (not recommended).- Returns:
- the password if any, null otherwise.
-
setPassword
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
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()Get the transport.
- Returns:
- a
TransportType
, default value if not set is UDP.
-
setTransport
Set a transport.
- Parameters:
transport
- aTransportType
-
setUriParams
Set the value of the parameters of the URI of the address.
- Parameters:
params
- The parameters string
-
getUsername
Returns the username.
- Returns:
- the username name if any, null otherwise.
-
setUsername
Sets the username.
- Parameters:
username
- the username to set.
-
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
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.
-
clean
void clean()Removes address's tags and uri headers so that it is displayable to the user.
-
clone
- Returns:
- a new
Address
object.
-
equal
- Parameters:
address2
-Address
object.- Returns:
- Boolean value telling if the
Address
objects are equal.
see:weakEqual(org.linphone.core.Address)
-
getHeader
Get the header encoded in the address.
- Parameters:
headerName
- the header name.- Returns:
- the header value or null if it doesn't exists.
-
getParam
Get 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
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
Tell 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
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
-
removeUriParam
Removes the value of a parameter of the URI of the address.
- Parameters:
uriParamName
- The name of the parameter.
-
setHeader
Set a header into the address.
Headers appear in the URI with '?', such as
<sip:test@linphone.org?SomeHeader=SomeValue>.- Parameters:
headerName
- the header name.headerValue
- the header value.
-
setParam
Set the value of a parameter of the address.
- Parameters:
paramName
- The name of the parameter.paramValue
- The new value of the parameter.
-
setUriParam
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
- Parameters:
address2
-Address
object.- Returns:
- Boolean value telling if the
Address
objects are equal.
see:equal(org.linphone.core.Address)
-
setUserData
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()
-