commit aae69af5c3ef58f54e7ad50dffd39571202fb32f Author: jehan Date: Mon Jan 18 18:04:25 2010 +0100 initial commit diff --git a/.classpath b/.classpath new file mode 100644 index 000000000..609aa00eb --- /dev/null +++ b/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.project b/.project new file mode 100644 index 000000000..7ce4f487d --- /dev/null +++ b/.project @@ -0,0 +1,33 @@ + + + linphone-android + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + diff --git a/AndroidManifest.xml b/AndroidManifest.xml new file mode 100644 index 000000000..983d336cc --- /dev/null +++ b/AndroidManifest.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Application.mk b/Application.mk new file mode 100644 index 000000000..a8a033a2d --- /dev/null +++ b/Application.mk @@ -0,0 +1,3 @@ +APP_PROJECT_PATH := $(call my-dir)/ +APP_MODULES :=libspeex libortp libosip2 libeXosip2 libmediastreamer2 libmsandroidsnd liblinphone +APP_BUILD_SCRIPT:=$(call my-dir)/../linphone-builder/android/Android.mk diff --git a/default.properties b/default.properties new file mode 100644 index 000000000..9d6f70d65 --- /dev/null +++ b/default.properties @@ -0,0 +1,13 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system use, +# "build.properties", and override values to adapt the script to your +# project structure. + +# Project target. +target=android-4 +# Indicates whether an apk should be generated for each density. +split.density=false diff --git a/res/drawable-hdpi/icon.png b/res/drawable-hdpi/icon.png new file mode 100644 index 000000000..8074c4c57 Binary files /dev/null and b/res/drawable-hdpi/icon.png differ diff --git a/res/drawable-ldpi/icon.png b/res/drawable-ldpi/icon.png new file mode 100644 index 000000000..1095584ec Binary files /dev/null and b/res/drawable-ldpi/icon.png differ diff --git a/res/drawable-mdpi/icon.png b/res/drawable-mdpi/icon.png new file mode 100644 index 000000000..a07c69fa5 Binary files /dev/null and b/res/drawable-mdpi/icon.png differ diff --git a/res/layout/main.xml b/res/layout/main.xml new file mode 100644 index 000000000..3a5f117d3 --- /dev/null +++ b/res/layout/main.xml @@ -0,0 +1,12 @@ + + + + diff --git a/res/raw/linphonerc b/res/raw/linphonerc new file mode 100644 index 000000000..ad8b197a6 --- /dev/null +++ b/res/raw/linphonerc @@ -0,0 +1,75 @@ +[net] +download_bw=128 +upload_bw=128 +firewall_policy=0 +mtu=0 + +[sip] +sip_port=5060 +guess_hostname=1 +contact=sip:jehanmonnier@unknown-host +inc_timeout=15 +use_info=0 +use_ipv6=0 +register_only_when_network_is_up=0 +default_proxy=0 + +[proxy_0] +reg_proxy=sip:mty11.axtel.net +reg_identity=sip:???@mty11.axtel.net +reg_expires=3600 +reg_sendregister=1 +publish=0 + +[rtp] +audio_rtp_port=7076 +video_rtp_port=9078 +audio_jitt_comp=60 +video_jitt_comp=60 +nortp_timeout=30 + +[sound] +playback_dev_id=AU: Audio Unit +ringer_dev_id=AU: Audio Unit +capture_dev_id=AU: Audio Unit + +[audio_codec_0] +mime=speex +rate=32000 +enabled=0 + +[audio_codec_1] +mime=speex +rate=16000 +enabled=0 + +[audio_codec_2] +mime=speex +rate=8000 +enabled=0 + +[audio_codec_3] +mime=GSM +rate=22050 +enabled=0 + +[audio_codec_4] +mime=GSM +rate=11025 +enabled=0 + +[audio_codec_5] +mime=GSM +rate=8000 +enabled=0 + +[audio_codec_6] +mime=PCMU +rate=8000 +enabled=0 + +[audio_codec_7] +mime=PCMA +rate=8000 +enabled=0 + diff --git a/res/raw/oldphone_mono.wav b/res/raw/oldphone_mono.wav new file mode 100644 index 000000000..39a1c9a80 Binary files /dev/null and b/res/raw/oldphone_mono.wav differ diff --git a/res/raw/ringback.wav b/res/raw/ringback.wav new file mode 100644 index 000000000..21f4b5bfb Binary files /dev/null and b/res/raw/ringback.wav differ diff --git a/res/values/strings.xml b/res/values/strings.xml new file mode 100644 index 000000000..1b02d5367 --- /dev/null +++ b/res/values/strings.xml @@ -0,0 +1,5 @@ + + + Hello World, Linphone! + Linphone + diff --git a/src/org/linphone/Linphone.java b/src/org/linphone/Linphone.java new file mode 100644 index 000000000..b20e3a591 --- /dev/null +++ b/src/org/linphone/Linphone.java @@ -0,0 +1,32 @@ +package org.linphone; + +import java.io.File; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import android.app.Activity; +import android.os.Bundle; + +public class Linphone extends Activity { + /** Called when the activity is first created. */ + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.main); + } + public void copyAssetsFromPackage() throws IOException { + File lFileToPlay = new File("/data/data/"+this.getPackageName()+"/files/oldphone_mono.wav"); + if (!lFileToPlay.exists()) { + FileOutputStream lOutputStream = openFileOutput ("oldphone_mono.wav", 0); + InputStream lInputStream = getResources().openRawResource(R.raw.oldphone_mono); + int readByte; + while (( readByte = lInputStream.read())!=-1) { + lOutputStream.write(readByte); + } + lOutputStream.flush(); + lOutputStream.close(); + lInputStream.close(); + } + } +} \ No newline at end of file diff --git a/src/org/linphone/core/LinphoneAuthInfo.java b/src/org/linphone/core/LinphoneAuthInfo.java new file mode 100644 index 000000000..0b8865f42 --- /dev/null +++ b/src/org/linphone/core/LinphoneAuthInfo.java @@ -0,0 +1,23 @@ +/* +LinphoneAuthInfo.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; + +public interface LinphoneAuthInfo { + +} diff --git a/src/org/linphone/core/LinphoneCore.java b/src/org/linphone/core/LinphoneCore.java new file mode 100644 index 000000000..f10cf0df3 --- /dev/null +++ b/src/org/linphone/core/LinphoneCore.java @@ -0,0 +1,68 @@ +/* +LinphoneCore.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; + +import java.io.File; +import java.net.URI; + +public interface LinphoneCore { + /* + * linphone core states + */ + interface GeneralState { + /* states for GSTATE_GROUP_POWER */ + static int GSTATE_POWER_OFF =0; /* initial state */ + static int GSTATE_POWER_STARTUP=1; + static int GSTATE_POWER_ON=2; + static int GSTATE_POWER_SHUTDOWN=3; + /* states for GSTATE_GROUP_REG */ + static int GSTATE_REG_NONE=10; /* initial state */ + static int GSTATE_REG_OK=11; + static int GSTATE_REG_FAILED=12; + /* states for GSTATE_GROUP_CALL */ + static int GSTATE_CALL_IDLE=20; /* initial state */ + static int GSTATE_CALL_OUT_INVITE=21; + static int GSTATE_CALL_OUT_CONNECTED=22; + static int GSTATE_CALL_IN_INVITE=23; + static int GSTATE_CALL_IN_CONNECTED=24; + static int GSTATE_CALL_END=25; + static int GSTATE_CALL_ERROR=26; + static int GSTATE_INVALID=27; + /** + * get new state {@link: } + */ + public int getNewState(); +} + + + public LinphoneProxyConfig createProxyConfig(URI identity,URI proxy,URI route); + + public void setDefaultProxyConfig(LinphoneProxyConfig proxyCfg); + + /** + * @return null if no default proxyconfig + */ + public LinphoneProxyConfig getDefaultProxyConfig(); + + void addAuthInfo(LinphoneAuthInfo info); + + public void invite(String url); + + public void iterate(); +} diff --git a/src/org/linphone/core/LinphoneCoreException.java b/src/org/linphone/core/LinphoneCoreException.java new file mode 100644 index 000000000..069e114a0 --- /dev/null +++ b/src/org/linphone/core/LinphoneCoreException.java @@ -0,0 +1,42 @@ +/* +LinphoneCoreException.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; + +public class LinphoneCoreException extends Exception { + + public LinphoneCoreException() { + // TODO Auto-generated constructor stub + } + + public LinphoneCoreException(String detailMessage) { + super(detailMessage); + // TODO Auto-generated constructor stub + } + + public LinphoneCoreException(Throwable throwable) { + super(throwable); + // TODO Auto-generated constructor stub + } + + public LinphoneCoreException(String detailMessage, Throwable throwable) { + super(detailMessage, throwable); + // TODO Auto-generated constructor stub + } + +} diff --git a/src/org/linphone/core/LinphoneCoreFactory.java b/src/org/linphone/core/LinphoneCoreFactory.java new file mode 100644 index 000000000..6a8c69493 --- /dev/null +++ b/src/org/linphone/core/LinphoneCoreFactory.java @@ -0,0 +1,43 @@ +/* +LinphoneCoreFactory.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; + +import java.io.File; + +public class LinphoneCoreFactory { + static { + System.loadLibrary("liblinphone"); + } + static LinphoneCoreFactory theLinphoneCoreFactory = new LinphoneCoreFactory(); + + public static LinphoneCoreFactory instance() { + + return theLinphoneCoreFactory; + } + public LinphoneAuthInfo createAuthInfo(String username,String password) { + throw new RuntimeException("Not Implemented yet"); + } + + public LinphoneCore createLinphoneCore(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) { + throw new RuntimeException("Not Implemented yet"); + } + + + +} diff --git a/src/org/linphone/core/LinphoneCoreImpl.java b/src/org/linphone/core/LinphoneCoreImpl.java new file mode 100644 index 000000000..958a66b9a --- /dev/null +++ b/src/org/linphone/core/LinphoneCoreImpl.java @@ -0,0 +1,63 @@ +/* +LinphoneCoreImpl.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; + +import java.io.File; +import java.io.IOException; +import java.net.URI; + +public class LinphoneCoreImpl implements LinphoneCore { + + private final LinphoneCoreListener mListener; + private final long nativePtr; + private native long newLinphoneCore(LinphoneCoreListener listener,String userConfig,String factoryConfig,Object userdata); + private native void iterate(long nativePtr); + LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { + mListener=listener; + nativePtr = newLinphoneCore(listener,userConfig.getCanonicalPath(),factoryConfig.getCanonicalPath(),userdata); + } + + public void addAuthInfo(LinphoneAuthInfo info) { + // TODO Auto-generated method stub + + } + + public LinphoneProxyConfig createProxyConfig(URI identity, URI proxy,URI route) { + return new LinphoneProxyConfigImpl(identity, proxy, route); + } + + public LinphoneProxyConfig getDefaultProxyConfig() { + // TODO Auto-generated method stub + return null; + } + + public void invite(String url) { + // TODO Auto-generated method stub + } + + public void iterate() { + iterate(nativePtr); + } + + public void setDefaultProxyConfig(LinphoneProxyConfig proxyCfg) { + // TODO Auto-generated method stub + + } + +} diff --git a/src/org/linphone/core/LinphoneCoreListener.java b/src/org/linphone/core/LinphoneCoreListener.java new file mode 100644 index 000000000..e8a0279f3 --- /dev/null +++ b/src/org/linphone/core/LinphoneCoreListener.java @@ -0,0 +1,49 @@ +/* +LinphoneCoreListener.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; + + + +public interface LinphoneCoreListener { + + /**< Notifies the application that it should show up + * @return */ + public void show(LinphoneCore lc); + /**< Notifies incoming calls + * @return */ + public void inviteReceived(LinphoneCore lc,String from); + /**< Notify calls terminated by far end + * @return */ + public void byeReceived(LinphoneCore lc,String from); + /**< Ask the application some authentication information + * @return */ + public void authInfoRequested(LinphoneCore lc,String realm,String username); + /**< Callback that notifies various events with human readable text. + * @return */ + public void displayStatus(LinphoneCore lc,String message);; + /**< Callback to display a message to the user + * @return */ + public void displayMessage(LinphoneCore lc,String message); + /** Callback to display a warning to the user + * @return */ + public void displayWarning(LinphoneCore lc,String message); + /**< State notification callback + * @return */ + public void generalState(LinphoneCore lc,LinphoneCore.GeneralState state); +} diff --git a/src/org/linphone/core/LinphoneProxyConfig.java b/src/org/linphone/core/LinphoneProxyConfig.java new file mode 100644 index 000000000..fb8b68eb3 --- /dev/null +++ b/src/org/linphone/core/LinphoneProxyConfig.java @@ -0,0 +1,25 @@ +/* +LinphoneProxyConfig.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; + +public interface LinphoneProxyConfig { + + void enableRegister(boolean value); + +} diff --git a/src/org/linphone/core/LinphoneProxyConfigImpl.java b/src/org/linphone/core/LinphoneProxyConfigImpl.java new file mode 100644 index 000000000..84e470045 --- /dev/null +++ b/src/org/linphone/core/LinphoneProxyConfigImpl.java @@ -0,0 +1,54 @@ +/* +LinphoneProxyConfigImpl.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; + +import java.net.URI; + + +public class LinphoneProxyConfigImpl implements LinphoneProxyConfig { + + final long nativePtr; + protected LinphoneProxyConfigImpl(URI identity,URI proxy,URI route) { + nativePtr = createAndAdd(); + edit(nativePtr); + setIdentity(nativePtr,identity.getScheme()+":"+identity.getHost()); + done(nativePtr); + } + + protected void finalize() throws Throwable { + deleteNative(nativePtr); + } + private native long createAndAdd(); + private native long deleteNative(long ptr); + + private native void edit(long ptr); + private native void done(long ptr); + + private native void setIdentity(long ptr,String identity); + /*private native void setProxy(long ptr,String identity);*/ + + private native void enableRegister(long ptr,boolean value); + + public void enableRegister(boolean value) { + edit(nativePtr); + enableRegister(nativePtr,value); + done(nativePtr); + } + +}