Interface Tunnel


public interface Tunnel
Linphone tunnel object.

  • Method Details

    • getActivated

      boolean getActivated()
      Returns whether the tunnel is activated.

      If mode is set to auto, this gives indication whether the automatic detection
      determined that tunnel was necessary or not.
      Returns:
      true if tunnel is in use, false otherwise.
    • getDomain

      @Nullable String getDomain()
      Get the domain.

      Returns:
      The domain.
    • setDomain

      void setDomain(@Nullable String domain)
      Set the domain.

      Required for tunnel TLS client authentification. Certificate Altname or CName
      should be sip:
      Parameters:
      domain - The domain.
    • isDualModeEnabled

      boolean isDualModeEnabled()
      Get the dual tunnel client mode.

      Returns:
      true if dual tunnel client mode is enabled, false otherwise
    • setDualModeEnabled

      void setDualModeEnabled(boolean dualModeEnabled)
      Sets whether or not to use the dual tunnel client mode.

      By default this feature is disabled. After enabling it, add a server with 2
      hosts and 2 ports for the feature to work.
      Parameters:
      dualModeEnabled - true to enable it, false to disable it
    • getMode

      Tunnel.Mode getMode()
      Get the tunnel mode.

      Returns:
      The current Tunnel.Mode
    • setMode

      void setMode(Tunnel.Mode mode)
      Set the tunnel mode.

      The tunnel mode can be 'enable', 'disable' or 'auto' If the mode is set to
      'auto', the tunnel manager will try to established an RTP session with the
      tunnel server on the UdpMirrorPort. If the connection fail, the tunnel is
      automatically activated whereas the tunnel is automatically disabled if the
      connection succeed.
      Parameters:
      mode - The desired Tunnel.Mode
    • getServers

      @NonNull TunnelConfig[] getServers()
      Get added servers.

      Returns:
      The list of servers.
    • isSipEnabled

      boolean isSipEnabled()
      Check whether tunnel is set to transport SIP packets.

      Returns:
      A boolean value telling whether SIP packets shall pass through the
      tunnel
    • setSipEnabled

      void setSipEnabled(boolean enable)
      Set whether SIP packets must be directly sent to a UA or pass through the
      tunnel.

      Parameters:
      enable - If true, SIP packets shall pass through the tunnel
    • getUsername

      @Nullable String getUsername()
      Get the username.

      Returns:
      The username.
    • setUsername

      void setUsername(@Nullable String username)
      Set the username.

      Required for tunnel TLS client authentification. Certificate Altname or CName
      should be sip:
      Parameters:
      username - The username.
    • addServer

      void addServer(@NonNull TunnelConfig tunnelConfig)
      Add a tunnel server configuration.

      Parameters:
      tunnelConfig - TunnelConfig object
    • cleanServers

      void cleanServers()
      Remove all tunnel server addresses previously entered with addServer(org.linphone.core.TunnelConfig)

    • connected

      boolean connected()
      Check whether the tunnel is connected.

      Returns:
      A boolean value telling if the tunnel is connected
    • reconnect

      void reconnect()
      Force reconnection to the tunnel server.

      This method is useful when the device switches from wifi to Edge/3G or vice
      versa. In most cases the tunnel client socket won't be notified promptly that
      its connection is now zombie, so it is recommended to call this method that
      will cause the lost connection to be closed and new connection to be issued.
    • removeServer

      void removeServer(@NonNull TunnelConfig tunnelConfig)
      Remove a tunnel server configuration.

      Parameters:
      tunnelConfig - TunnelConfig object
    • setHttpProxy

      void setHttpProxy(@NonNull String host, int port, @Nullable String username, @Nullable String passwd)
      Set an optional http proxy to go through when connecting to tunnel server.

      Parameters:
      host - http proxy host
      port - http proxy port
      username - Optional http proxy username if the proxy request
      authentication. Currently only basic authentication is supported. Use null if
      not needed.
      passwd - Optional http proxy password. Use null if not needed.
    • setHttpProxyAuthInfo

      void setHttpProxyAuthInfo(@Nullable String username, @Nullable String passwd)
      Set authentication info for the http proxy.

      Parameters:
      username - User name
      passwd - Password
    • 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