initial commit

This commit is contained in:
jehan 2010-01-18 18:04:25 +01:00
commit aae69af5c3
22 changed files with 565 additions and 0 deletions

7
.classpath Normal file
View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="output" path="bin"/>
</classpath>

33
.project Normal file
View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>linphone-android</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

18
AndroidManifest.xml Normal file
View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.linphone"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Linphone"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

3
Application.mk Normal file
View file

@ -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

13
default.properties Normal file
View file

@ -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

BIN
res/drawable-hdpi/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

BIN
res/drawable-ldpi/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
res/drawable-mdpi/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

12
res/layout/main.xml Normal file
View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>

75
res/raw/linphonerc Normal file
View file

@ -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

BIN
res/raw/oldphone_mono.wav Normal file

Binary file not shown.

BIN
res/raw/ringback.wav Normal file

Binary file not shown.

5
res/values/strings.xml Normal file
View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, Linphone!</string>
<string name="app_name">Linphone</string>
</resources>

View file

@ -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();
}
}
}

View file

@ -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 {
}

View file

@ -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();
}

View file

@ -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
}
}

View file

@ -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");
}
}

View file

@ -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
}
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}
}