diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index d0f5ffc20..3a9e1d86d 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -1279,9 +1279,84 @@ public interface LinphoneCore { * @param path path to music file played to remote side when on hold. */ void setPlayFile(String path); + + + enum TunnelMode { + disable(0), + enable(1), + auto(2); + private final int value; + + private TunnelMode(int value){ + this.value = value; + } + public static int enumToInt(TunnelMode enum_mode) { + return enum_mode.value; + } + public static TunnelMode intToEnum(int value) { + switch(value) { + case 0: return disable; + case 1: return enable; + case 2: return auto; + default: return disable; + } + } + } + + /** + * @deprecated Use tunnelSetMode() instead + * Enable or disable tunnel + * @param enable True to enable and false to disable + */ void tunnelEnable(boolean enable); + + /** + * Set the tunnel mode. + * The tunnel can be enable or disable by passing 'enable' or 'disable'. + * If the mode is set to 'auto', Linphone will try to establish an RTP session + * on the mirror port of the tunnel server. If the connection fails, the tunnel + * will be activated. + * @param mode enable, disable or auto + */ + void tunnelSetMode(TunnelMode mode); + + /** + * Get the set mode + * @return + */ + TunnelMode tunnelGetMode(); + + /** + * Set whether sip packets must pass through the tunnel + * @param enable If true, tunnel will transport SIP packets in addition + * of RTP packets. + */ + void tunnelEnableSip(boolean enable); + + /** + * Check whether SIP tuneling is enabled + * @return true means the tunnel is set to transport SIP packets + */ + boolean tunnelSipEnabled(); + + /** + * @deprecated Use tunnelSetMode instaead + * Enable tunnel if the mirror RTP session cannot be established + */ void tunnelAutoDetect(); + + /** + * Clean the list of server + */ void tunnelCleanServers(); + + /** + * Set an optional HTTP proxy + * @param proxy_host + * @param port + * @param username + * @param password + */ void tunnelSetHttpProxy(String proxy_host, int port, String username, String password); /** * @param host tunnel server ip address diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index 02725113a..0c53735fc 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -784,6 +784,30 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized void tunnelEnable(boolean enable) { tunnelEnable(nativePtr, enable); } + + private native void tunnelSetMode(long nativePtr, int mode); + @Override + public synchronized void tunnelSetMode(LinphoneCore.TunnelMode mode) { + tunnelSetMode(nativePtr, TunnelMode.enumToInt(mode)); + } + + private native int tunnelGetMode(long nativePtr); + @Override + public synchronized LinphoneCore.TunnelMode tunnelGetMode() { + return LinphoneCore.TunnelMode.intToEnum(tunnelGetMode(nativePtr)); + } + + private native void tunnelEnableSip(long nativePtr, boolean enable); + @Override + public void tunnelEnableSip(boolean enable) { + tunnelEnableSip(nativePtr, enable); + } + + private native boolean tunnelSipEnabled(long nativePtr); + @Override + public boolean tunnelSipEnabled() { + return tunnelSipEnabled(nativePtr); + } @Override public native boolean isTunnelAvailable();