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 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 the
address.
  • Method Details

    • getDisplayName

      @Nullable String getDisplayName()
      Returns the display name.

      Returns:
      the display name if any, null otherwise.
    • setDisplayName

      int setDisplayName(@Nullable String displayName)
      Sets the display name.

      Parameters:
      displayName - the display name to set.
    • getDomain

      @Nullable String getDomain()
      Returns the domain name.

      Returns:
      the domain name if any, null otherwise.
    • setDomain

      int setDomain(@Nullable 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

      @Nullable boolean isValid()
      Returns if address is valid.

      Returns:
      the scheme if any, null otherwise.
    • getMethodParam

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

      Returns:
      the value of the parameter or null.
    • setMethodParam

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

      Parameters:
      methodParam - the value to set to the method parameter.
    • getPassword

      @Nullable 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(@Nullable 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

      @Nullable 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()
      Get the transport.

      Returns:
      a TransportType, default value if not set is UDP.
    • setTransport

      int setTransport(TransportType transport)
      Set 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

      @Nullable String getUsername()
      Returns the username.

      Returns:
      the username name if any, null otherwise.
    • setUsername

      int setUsername(@Nullable String username)
      Sets the username.

      Parameters:
      username - the username to set.
    • asString

      @NonNull 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

      @NonNull 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.
    • clean

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

    • clone

      @NonNull Address clone()
      Clones a Address object.

      Returns:
      a new Address object.
    • equal

      boolean equal(@NonNull 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

      @Nullable String getHeader(@NonNull 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

      @Nullable String getParam(@NonNull String paramName)
      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

      @Nullable String getUriParam(@NonNull 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(@NonNull String paramName)
      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

      boolean hasUriParam(@NonNull 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
    • removeUriParam

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

      Parameters:
      uriParamName - The name of the parameter.
    • setHeader

      void setHeader(@NonNull String headerName, @Nullable String headerValue)
      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

      void setParam(@NonNull String paramName, @Nullable String paramValue)
      Set 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(@NonNull String uriParamName, @Nullable 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(@NonNull 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