add stun preference

This commit is contained in:
Simon Morlat 2010-11-19 16:40:29 +01:00
parent 653050685e
commit d5c9ee55b9
7 changed files with 27 additions and 2 deletions

Binary file not shown.

Binary file not shown.

View file

@ -68,4 +68,6 @@
<string name="notification_register_failure">fails to register to %s</string> <string name="notification_register_failure">fails to register to %s</string>
<string name="notification_started">started</string> <string name="notification_started">started</string>
<string name="pref_echo_cancellation_summary">Removes the echo heared by the other end.</string> <string name="pref_echo_cancellation_summary">Removes the echo heared by the other end.</string>
<string name="pref_stun_server">Stun server</string>
<string name="pref_stun_server_key">pref_stun_server_key</string>
</resources> </resources>

View file

@ -12,6 +12,7 @@
<CheckBoxPreference android:enabled="true" android:selectable="true" android:key="@string/pref_enable_outbound_proxy_key" android:title="@string/pref_enable_outbound_proxy"></CheckBoxPreference> <CheckBoxPreference android:enabled="true" android:selectable="true" android:key="@string/pref_enable_outbound_proxy_key" android:title="@string/pref_enable_outbound_proxy"></CheckBoxPreference>
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/pref_advanced"> <PreferenceCategory android:title="@string/pref_advanced">
<EditTextPreference android:title="@string/pref_stun_server" android:key="@string/pref_stun_server_key"></EditTextPreference>
<PreferenceScreen android:title="@string/pref_codecs" android:key="@string/pref_codecs_key"> <PreferenceScreen android:title="@string/pref_codecs" android:key="@string/pref_codecs_key">
<CheckBoxPreference android:key="@string/pref_codec_speex16_key" <CheckBoxPreference android:key="@string/pref_codec_speex16_key"
android:title="@string/pref_codec_speex16" android:defaultValue="true"></CheckBoxPreference> android:title="@string/pref_codec_speex16" android:defaultValue="true"></CheckBoxPreference>

View file

@ -38,6 +38,7 @@ import org.linphone.core.LinphoneFriend;
import org.linphone.core.LinphoneProxyConfig; import org.linphone.core.LinphoneProxyConfig;
import org.linphone.core.PayloadType; import org.linphone.core.PayloadType;
import org.linphone.core.LinphoneCall.State; import org.linphone.core.LinphoneCall.State;
import org.linphone.core.LinphoneCore.FirewallPolicy;
import org.linphone.core.LinphoneCore.GlobalState; import org.linphone.core.LinphoneCore.GlobalState;
@ -333,7 +334,12 @@ public class LinphoneService extends Service implements LinphoneCoreListener {
throw new LinphoneConfigException(getString(R.string.wrong_domain)); throw new LinphoneConfigException(getString(R.string.wrong_domain));
} }
String lStun = mPref.getString(getString(R.string.pref_stun_server_key), null);
//stun server
mLinphoneCore.setStunServer(lStun);
mLinphoneCore.setFirewallPolicy(lStun!=null ? FirewallPolicy.UseStun : FirewallPolicy.NoFirewall);
//auth //auth
mLinphoneCore.clearAuthInfos(); mLinphoneCore.clearAuthInfos();
LinphoneAuthInfo lAuthInfo = LinphoneCoreFactory.instance().createAuthInfo(lUserName, lPasswd,null); LinphoneAuthInfo lAuthInfo = LinphoneCoreFactory.instance().createAuthInfo(lUserName, lPasswd,null);

View file

@ -69,12 +69,16 @@ class LinphoneCoreImpl implements LinphoneCore {
private native void setPreviewWindowId(long nativePtr, Object wid); private native void setPreviewWindowId(long nativePtr, Object wid);
private AndroidVideoWindowImpl mVideoWindow; private AndroidVideoWindowImpl mVideoWindow;
private AndroidVideoWindowImpl mPreviewWindow; private AndroidVideoWindowImpl mPreviewWindow;
private native void addFriend(long nativePtr,long friend); private native void addFriend(long nativePtr,long friend);
private native void setPresenceInfo(long nativePtr,int minute_away, String alternative_contact,int status); private native void setPresenceInfo(long nativePtr,int minute_away, String alternative_contact,int status);
private native long createChatRoom(long nativePtr,String to); private native long createChatRoom(long nativePtr,String to);
private native void enableVideo(long nativePtr,boolean vcap_enabled,boolean display_enabled); private native void enableVideo(long nativePtr,boolean vcap_enabled,boolean display_enabled);
private native boolean isVideoEnabled(long nativePtr); private native boolean isVideoEnabled(long nativePtr);
private native void setFirewallPolicy(long nativePtr, int enum_value);
private native int getFirewallPolicy(long nativePtr);
private native void setStunServer(long nativePtr, String stun_server);
private native String getStunServer(long nativePtr);
private static String TAG = "LinphoneCore"; private static String TAG = "LinphoneCore";
LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException {
@ -335,4 +339,16 @@ class LinphoneCoreImpl implements LinphoneCore {
public boolean isVideoEnabled() { public boolean isVideoEnabled() {
return isVideoEnabled(nativePtr); return isVideoEnabled(nativePtr);
} }
public FirewallPolicy getFirewallPolicy() {
return FirewallPolicy.fromInt(getFirewallPolicy(nativePtr));
}
public String getStunServer() {
return getStunServer(nativePtr);
}
public void setFirewallPolicy(FirewallPolicy pol) {
setFirewallPolicy(nativePtr,pol.value());
}
public void setStunServer(String stunServer) {
setStunServer(nativePtr,stunServer);
}
} }

@ -1 +1 @@
Subproject commit 632c76515682a20e4c62542febcb23f637479efe Subproject commit 801508597b36e02e6d726851332a202529dc9025