diff --git a/.gitmodules b/.gitmodules index d0d34fa95..391eac1a0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "msandroid"] - path = submodules/msandroid - url = git://git.linphone.org/msandroid.git [submodule "linphone"] path = submodules/linphone url = git://git.savannah.nongnu.org/linphone.git diff --git a/Android.mk b/Android.mk index c419657aa..be9eb91f6 100644 --- a/Android.mk +++ b/Android.mk @@ -12,11 +12,8 @@ include $(root-dir)/submodules/linphone/oRTP/build/android/Android.mk include $(root-dir)/submodules/linphone/mediastreamer2/build/android/Android.mk -include $(root-dir)/submodules/msandroid/Android.mk - include $(root-dir)/submodules/msilbc/Android.mk - include $(root-dir)/submodules/linphone/build/android/Android.mk diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 5f0ab7cd3..8662eeed8 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -47,9 +47,14 @@ - - - + + + + + + + + @@ -58,5 +63,6 @@ + \ No newline at end of file diff --git a/Application.mk b/Application.mk index b1e035016..b63251376 100644 --- a/Application.mk +++ b/Application.mk @@ -1,4 +1,4 @@ APP_PROJECT_PATH := $(call my-dir)/ -APP_MODULES :=libspeex libgsm libortp libosip2 libeXosip2 libmediastreamer2 libmsandroidsnd liblinphone +APP_MODULES :=libspeex libgsm libortp libosip2 libeXosip2 libmediastreamer2 liblinphone APP_BUILD_SCRIPT:=$(call my-dir)/Android.mk APP_PLATFORM := android-3 diff --git a/libs/armeabi/liblinphone.so b/libs/armeabi/liblinphone.so index 4d84cf15a..a8069cf1b 100755 Binary files a/libs/armeabi/liblinphone.so and b/libs/armeabi/liblinphone.so differ diff --git a/res/raw/linphonerc b/res/raw/linphonerc index b9571e707..4c47b515e 100644 --- a/res/raw/linphonerc +++ b/res/raw/linphonerc @@ -6,6 +6,7 @@ mtu=0 [sip] sip_port=5060 +sip_random_port=1 guess_hostname=1 contact=sip:unknown@unknown-host inc_timeout=15 diff --git a/res/values/strings.xml b/res/values/strings.xml index acc7029d1..6d624c9f6 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1,5 +1,22 @@ + Outbound proxy + Outbound proxy + pcma + pref_codec_pcma_key + pcmu + pref_codec_pcmu_key + gsm + pref_codec_gsm_key + ilbc + pref_codec_ilbc_key + speex 8 Khz + pref_codec_speex8_key + speex 16 Khz + pref_codec_speex16_key + Codecs + pref_codecs_key + Place a call Debug Linphone %s SIP (rfc 3261) compatible phone under GNU Public License V2\n http://www.linphone.org\n© 2010 Belledonne Communications About diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index 3cf3dcab7..0f0a597ed 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -9,12 +9,29 @@ android:key="@string/pref_domain_key"> - + + + + + + + + + + - - + + + diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java index e6326527c..918dcf6e4 100644 --- a/src/org/linphone/LinphoneActivity.java +++ b/src/org/linphone/LinphoneActivity.java @@ -122,6 +122,26 @@ public class LinphoneActivity extends TabActivity implements SensorEventListener } + @Override + protected void onNewIntent(Intent intent) { + super.onNewIntent(intent); + if (intent.getData() != null) { + //incoming call requested + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setMessage(getString(R.string.place_call_chooser)) + .setCancelable(false) + .setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + ; + } + }).setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + } + }); + builder.create().show(); + } + + } @Override protected void onPause() { // TODO Auto-generated method stub diff --git a/src/org/linphone/LinphoneService.java b/src/org/linphone/LinphoneService.java index a4398105f..bbd608430 100644 --- a/src/org/linphone/LinphoneService.java +++ b/src/org/linphone/LinphoneService.java @@ -32,6 +32,7 @@ import org.linphone.core.LinphoneCoreException; import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.LinphoneCoreListener; import org.linphone.core.LinphoneProxyConfig; +import org.linphone.core.PayloadType; import org.linphone.core.LinphoneCore.GeneralState; @@ -306,7 +307,40 @@ public class LinphoneService extends Service implements LinphoneCoreListener { } //escape + lDefaultProxyConfig.setDialEscapePlus(true); + //outbound proxy + if (mPref.getBoolean(getString(R.string.pref_enable_outbound_proxy_key), false)) { + lDefaultProxyConfig.setRoute(lProxy); + } + } + + //codec config + PayloadType lPt = mLinphoneCore.findPayloadType("speex", 16000); + if (lPt !=null) { + boolean enable= mPref.getBoolean(getString(R.string.pref_codec_speex16_key),false); + mLinphoneCore.enablePayloadType(lPt, enable); + } + lPt = mLinphoneCore.findPayloadType("speex", 8000); + if (lPt !=null) { + boolean enable= mPref.getBoolean(getString(R.string.pref_codec_speex8_key),false); + mLinphoneCore.enablePayloadType(lPt, enable); + } + lPt = mLinphoneCore.findPayloadType("GSM", 8000); + if (lPt !=null) { + boolean enable= mPref.getBoolean(getString(R.string.pref_codec_gsm_key),false); + mLinphoneCore.enablePayloadType(lPt, enable); + } + lPt = mLinphoneCore.findPayloadType("PCMU", 8000); + if (lPt !=null) { + boolean enable= mPref.getBoolean(getString(R.string.pref_codec_pcmu_key),false); + mLinphoneCore.enablePayloadType(lPt, enable); + } + lPt = mLinphoneCore.findPayloadType("PCMA", 8000); + if (lPt !=null) { + boolean enable= mPref.getBoolean(getString(R.string.pref_codec_pcma_key),false); + mLinphoneCore.enablePayloadType(lPt, enable); + } + //init network state ConnectivityManager lConnectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo lInfo = lConnectivityManager.getActiveNetworkInfo(); diff --git a/src/org/linphone/OutgoingCallReceiver.java b/src/org/linphone/OutgoingCallReceiver.java new file mode 100644 index 000000000..ab3158760 --- /dev/null +++ b/src/org/linphone/OutgoingCallReceiver.java @@ -0,0 +1,40 @@ +/* +OutgoingCallReceiver.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone; + +import android.app.Activity; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.net.Uri; + +public class OutgoingCallReceiver extends BroadcastReceiver { + + @Override + public void onReceive(Context context, Intent intent) { + String to = intent.getStringExtra("android.intent.extra.PHONE_NUMBER"); + setResult(Activity.RESULT_OK,null, null); + Intent lIntent = new Intent(); + lIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + lIntent.setClass(context, LinphoneActivity.class); + lIntent.setData(Uri.parse("tel://"+to)); + context.startActivity(lIntent); + } + +} diff --git a/src/org/linphone/core/LinphoneCoreFactoryImpl.java b/src/org/linphone/core/LinphoneCoreFactoryImpl.java index a34eabcae..712e27b63 100644 --- a/src/org/linphone/core/LinphoneCoreFactoryImpl.java +++ b/src/org/linphone/core/LinphoneCoreFactoryImpl.java @@ -62,4 +62,10 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { @Override public native void setDebugMode(boolean enable); + + @Override + public void setLogHandler(LinphoneLogHandler handler) { + //not implemented on Android + + } } diff --git a/src/org/linphone/core/LinphoneCoreImpl.java b/src/org/linphone/core/LinphoneCoreImpl.java index 547e4bc0d..376831473 100644 --- a/src/org/linphone/core/LinphoneCoreImpl.java +++ b/src/org/linphone/core/LinphoneCoreImpl.java @@ -56,7 +56,8 @@ class LinphoneCoreImpl implements LinphoneCore { private native void sendDtmf(long nativePtr,char dtmf); private native void clearCallLogs(long nativePtr); private native boolean isMicMuted(long nativePtr); - + private native long findPayloadType(long nativePtr, String mime, int clockRate); + private native int enablePayloadType(long nativePtr, long payloadType, boolean enable); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; @@ -190,4 +191,19 @@ class LinphoneCoreImpl implements LinphoneCore { public boolean isMicMuted() { return isMicMuted(nativePtr); } + public PayloadType findPayloadType(String mime, int clockRate) { + long playLoadType = findPayloadType(nativePtr, mime, clockRate); + if (playLoadType == 0) { + return null; + } else { + return new PayloadTypeImpl(playLoadType); + } + } + public void enablePayloadType(PayloadType pt, boolean enable) + throws LinphoneCoreException { + if (enablePayloadType(nativePtr,((PayloadTypeImpl)pt).nativePtr,enable) != 0) { + throw new LinphoneCoreException("cannot enable payload type ["+pt+"]"); + } + + } } diff --git a/src/org/linphone/core/LinphoneProxyConfigImpl.java b/src/org/linphone/core/LinphoneProxyConfigImpl.java index 01080bfc0..7ffb164b2 100644 --- a/src/org/linphone/core/LinphoneProxyConfigImpl.java +++ b/src/org/linphone/core/LinphoneProxyConfigImpl.java @@ -69,6 +69,9 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { private native void setDialEscapePlus(long ptr, boolean value); + private native String getRoute(long ptr); + private native int setRoute(long ptr,String uri); + public void enableRegister(boolean value) { enableRegister(nativePtr,value); } @@ -114,4 +117,12 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { public boolean registerEnabled() { return isRegisterEnabled(nativePtr); } + public String getRoute() { + return getRoute(nativePtr); + } + public void setRoute(String routeUri) throws LinphoneCoreException { + if (setRoute(nativePtr, routeUri) != 0) { + throw new LinphoneCoreException("cannot set route ["+routeUri+"]"); + } + } } diff --git a/src/org/linphone/core/PayloadTypeImpl.java b/src/org/linphone/core/PayloadTypeImpl.java new file mode 100644 index 000000000..28c206786 --- /dev/null +++ b/src/org/linphone/core/PayloadTypeImpl.java @@ -0,0 +1,34 @@ +/* +PayloadTypeImpl.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +package org.linphone.core; + +class PayloadTypeImpl implements PayloadType { + + protected final long nativePtr; + + private native String toString(long ptr); + + protected PayloadTypeImpl(long aNativePtr) { + nativePtr = aNativePtr; + } + public String toString() { + return toString(nativePtr); + } +} diff --git a/submodules/linphone b/submodules/linphone index 7609ab2a4..a17cdb896 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 7609ab2a4a4b9c8a7ddf3ac0acf9e43dc23c2046 +Subproject commit a17cdb896f3df16b9715ab1a0bc57992857dfa24 diff --git a/submodules/msandroid b/submodules/msandroid deleted file mode 160000 index 3dd9bd6aa..000000000 --- a/submodules/msandroid +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3dd9bd6aa57641e16db7fb7503d4cd039dfb3c70