add android build script + linphone core java interfaces

This commit is contained in:
Jehan Monnier 2010-04-02 16:28:44 +02:00
parent e868674ebd
commit 5327a1b00e
14 changed files with 589 additions and 2 deletions

90
build/android/Android.mk Executable file
View file

@ -0,0 +1,90 @@
##
## Android.mk -Android build script-
##
##
## 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 Library 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.
##
LOCAL_PATH:= $(call my-dir)/../../coreapi
include $(CLEAR_VARS)
LOCAL_MODULE := liblinphone
LOCAL_CPP_EXTENSION := .cc
LOCAL_SRC_FILES = \
linphonecore.c \
misc.c \
enum.c \
enum.h \
presence.c \
proxy.c \
friend.c \
authentication.c \
lpconfig.c \
chat.c \
general_state.c \
sipsetup.c \
siplogin.c \
address.c \
linphonecore_jni.cc \
sal.c \
sal_eXosip2.c \
sal_eXosip2_presence.c \
sal_eXosip2_sdp.c \
offeranswer.c \
callbacks.c
LOCAL_CFLAGS += \
-D_BYTE_ORDER=_LITTLE_ENDIAN \
-DORTP_INET6 \
-DENABLE_TRACE \
-DLINPHONE_VERSION=\"Linphone-3.1.2\" \
-DLINPHONE_PLUGINS_DIR=\"\\tmp\" \
-DLOG_DOMAIN=\"Linphone\"
LOCAL_CFLAGS += -DIN_LINPHONE
#LOCAL_CFLAGS += -DVIDEO_ENABLED -DIN_LINPHONE
LOCAL_C_INCLUDES += \
$(LOCAL_PATH) \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/../oRTP/include \
$(LOCAL_PATH)/../mediastreamer2/include \
$(LOCAL_PATH)/../../../eXosip/include \
$(LOCAL_PATH)/../../../osip/include
LOCAL_LDLIBS += -llog
LOCAL_STATIC_LIBRARIES := \
libmsandroidsnd \
libmediastreamer2 \
libortp \
libspeex \
libeXosip2 \
libosip2 \
libgsm
LOCAL_MODULE_CLASS = SHARED_LIBRARIES
include $(BUILD_SHARED_LIBRARY)

BIN
java/.DS_Store vendored Normal file

Binary file not shown.

BIN
java/org/.DS_Store vendored Normal file

Binary file not shown.

BIN
java/org/linphone/.DS_Store vendored Normal file

Binary file not shown.

View file

@ -0,0 +1,46 @@
/*
LinphoneAddress.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 LinphoneAddress {
/**
* Human display name
* @return null if not set
*/
public String getDisplayName();
/**
* userinfo
* @return null if not set
*/
public String getUserName();
/**
*
* @return null if not set
*/
public String getDomain();
/**
* set display name
* @param name
*/
public void setDisplayName(String name);
/**
* @return an URI version of the address that can be used to place a call using {@link LinphoneCore#invite(String)}
*/
public String toUri();
}

View file

@ -0,0 +1,25 @@
/*
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,31 @@
/*
LinPhoneCallLog.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 LinphoneCallLog {
public enum CallDirection {
CallOutgoing,Callincoming
}
public LinphoneAddress getFrom();
public LinphoneAddress getTo ();
public LinphoneCallLog.CallDirection getDirection();
}

View file

@ -0,0 +1,177 @@
/*
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.util.List;
public interface LinphoneCore {
/*
* linphone core states
*/
public enum GeneralState {
/* states for GSTATE_GROUP_POWER */
GSTATE_POWER_OFF(0), /* initial state */
GSTATE_POWER_STARTUP(1),
GSTATE_POWER_ON(2),
GSTATE_POWER_SHUTDOWN(3),
/* states for GSTATE_GROUP_REG */
GSTATE_REG_NONE(10), /* initial state */
GSTATE_REG_OK(11),
GSTATE_REG_FAILED(12),
/* states for GSTATE_GROUP_CALL */
GSTATE_CALL_IDLE(20), /* initial state */
GSTATE_CALL_OUT_INVITE(21),
GSTATE_CALL_OUT_CONNECTED(22),
GSTATE_CALL_IN_INVITE(23),
GSTATE_CALL_IN_CONNECTED(24),
GSTATE_CALL_END(25),
GSTATE_CALL_ERROR(26),
GSTATE_INVALID(27);
private final int mValue;
GeneralState(int value) {
mValue = value;
}
public static GeneralState fromInt(int value) {
for (GeneralState state: GeneralState.values()) {
if (state.mValue == value) return state;
}
throw new RuntimeException("sate not found ["+value+"]");
}
}
/**
* @param identity sip uri sip:jehan@linphone.org
* @param proxy sip uri (sip:linphone.org)
* @param route optionnal sip usi (sip:linphone.org)
* @param register should be initiated
* @return
*/
public LinphoneProxyConfig createProxyConfig(String identity,String proxy,String route,boolean enableRegister) throws LinphoneCoreException;
/**
* clear all added proxy config
*/
public void clearProxyConfigs();
public void addProxyConfig(LinphoneProxyConfig proxyCfg) throws LinphoneCoreException;
public void setDefaultProxyConfig(LinphoneProxyConfig proxyCfg);
/**
* @return null if no default proxy config
*/
public LinphoneProxyConfig getDefaultProxyConfig() ;
/**
* clear all the added auth info
*/
void clearAuthInfos();
void addAuthInfo(LinphoneAuthInfo info);
public void invite(String uri);
public void invite(LinphoneAddress to);
public void terminateCall();
/**
* get the remote address in case of in/out call
* @return null if no call engaged yet
*/
public LinphoneAddress getRemoteAddress();
/**
*
* @return TRUE if there is a call running or pending.
*/
public boolean isIncall();
/**
*
* @return Returns true if in incoming call is pending, ie waiting for being answered or declined.
*/
public boolean isInComingInvitePending();
public void iterate();
/**
* Accept an incoming call.
*
* Basically the application is notified of incoming calls within the
* {@link LinphoneCoreListener#inviteReceived(LinphoneCore, String)} listener.
* The application can later respond positively to the call using
* this method.
*/
public void acceptCall();
/**
* @return a list of LinphoneCallLog
*/
public List<LinphoneCallLog> getCallLogs();
/**
* This method is called by the application to notify the Linphone core library when network is reachable.
* Calling this method with true trigger Linphone to initiate a registration process for all proxy
* configuration with parameter register set to enable.
* This method disable the automatic registration mode. It means you must call this method after each network state changes
* @param network state
*
*/
public void setNetworkStateReachable(boolean isReachable);
/**
* destroy linphone core and free all underlying resources
*/
public void destroy();
/**
* Allow to control play level before entering sound card:
* @param level in db
*/
public void setSoftPlayLevel(float gain);
/**
* get play level before entering sound card:
* @return level in db
*/
public float getSoftPlayLevel();
/**
* Mutes or unmutes the local microphone.
* @param isMuted
*/
public void muteMic(boolean isMuted);
/**
*
* @return true is mic is muted
*/
public boolean isMicMuted();
/**
* Build an address according to the current proxy config. In case destination is not a sip uri, the default proxy domain is automatically appended
* @param destination
* @return
* @throws If no LinphonrAddress can be built from destination
*/
public LinphoneAddress interpretUrl(String destination) throws LinphoneCoreException;
/**
* Initiate a dtmf signal if in call
* @param number
*/
public void sendDtmf(char number);
/**
*
*/
public void clearCallLogs();
}

View file

@ -0,0 +1,43 @@
/*
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;
@SuppressWarnings("serial")
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,53 @@
/*
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;
import java.io.IOException;
public class LinphoneCoreFactory {
static {
System.loadLibrary("linphone");
}
static LinphoneCoreFactory theLinphoneCoreFactory = new LinphoneCoreFactory();
public static LinphoneCoreFactory instance() {
return theLinphoneCoreFactory;
}
public LinphoneAuthInfo createAuthInfo(String username,String password) {
return new LinphoneAuthInfoImpl(username,password) ;
}
public LinphoneCore createLinphoneCore(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException {
return new LinphoneCoreImpl(listener,userConfig,factoryConfig,userdata);
}
public LinphoneAddress createLinphoneAddress(String username,String domain,String displayName) {
return new LinphoneAddressImpl(username,domain,displayName);
}
/**
* Enable verbose traces
* @param enable
*/
public native void setDebugMode(boolean enable);
}

View file

@ -0,0 +1,51 @@
/*
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
* @param state LinphoneCore.GeneralState
* @return
* */
public void generalState(LinphoneCore lc,LinphoneCore.GeneralState state);
}

View file

@ -0,0 +1,71 @@
/*
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 {
/**
* Unregister proxy config a enable edition
*/
public void edit();
/**
* Validate proxy config changes. Start registration in case
*/
public void done();
/**
* sip user made by sip:username@domain
*/
public void setIdentity(String identity) throws LinphoneCoreException;
/**
* Set proxy uri, like sip:linphone.org:5060
* @param proxyUri
* @throws LinphoneCoreException
*/
public void setProxy(String proxyUri) throws LinphoneCoreException;
/**
* Enable register for this proxy config.
* Register message is issued after call to {@link #done()}
* @param value
* @throws LinphoneCoreException
*/
public void enableRegister(boolean value) throws LinphoneCoreException;
/**
* normalize a human readable phone number into a basic string. 888-444-222 becomes 888444222
* @param number
* @return
*/
public String normalizePhoneNumber(String number);
/**
* usefull function to automatically add internationnal prefix to e164 phone numbers
* @param prefix
*/
public void setDialPrefix(String prefix);
/**
* * Sets whether liblinphone should replace "+" by "00" in dialed numbers (passed to
* {@link LinphoneCore#invite(String)}).
* @param value default value is false
*/
public void setDialEscapePlus(boolean value);
/**
* rget domain host name or ip
* @return may be null
*/
public String getDomain();
}

@ -1 +1 @@
Subproject commit eaf825b1a2f041d162097b30a1b159afa80cd013
Subproject commit 2e02b06af897fa1ed25b6e24bd3096c2c88374bf

2
oRTP

@ -1 +1 @@
Subproject commit 0424a6538e1741e064c8d8573efee365b25593f1
Subproject commit 0c97230e53c8a8eefde8024ac1f81721ad645992