From 5327a1b00ed620169cad6fcba7178e307ecd42df Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 2 Apr 2010 16:28:44 +0200 Subject: [PATCH] add android build script + linphone core java interfaces --- build/android/Android.mk | 90 +++++++++ java/.DS_Store | Bin 0 -> 6148 bytes java/org/.DS_Store | Bin 0 -> 6148 bytes java/org/linphone/.DS_Store | Bin 0 -> 6148 bytes java/org/linphone/core/LinphoneAddress.java | 46 +++++ java/org/linphone/core/LinphoneAuthInfo.java | 25 +++ java/org/linphone/core/LinphoneCallLog.java | 31 +++ java/org/linphone/core/LinphoneCore.java | 177 ++++++++++++++++++ .../linphone/core/LinphoneCoreException.java | 43 +++++ .../linphone/core/LinphoneCoreFactory.java | 53 ++++++ .../linphone/core/LinphoneCoreListener.java | 51 +++++ .../linphone/core/LinphoneProxyConfig.java | 71 +++++++ mediastreamer2 | 2 +- oRTP | 2 +- 14 files changed, 589 insertions(+), 2 deletions(-) create mode 100755 build/android/Android.mk create mode 100644 java/.DS_Store create mode 100644 java/org/.DS_Store create mode 100644 java/org/linphone/.DS_Store create mode 100644 java/org/linphone/core/LinphoneAddress.java create mode 100644 java/org/linphone/core/LinphoneAuthInfo.java create mode 100644 java/org/linphone/core/LinphoneCallLog.java create mode 100644 java/org/linphone/core/LinphoneCore.java create mode 100644 java/org/linphone/core/LinphoneCoreException.java create mode 100644 java/org/linphone/core/LinphoneCoreFactory.java create mode 100644 java/org/linphone/core/LinphoneCoreListener.java create mode 100644 java/org/linphone/core/LinphoneProxyConfig.java diff --git a/build/android/Android.mk b/build/android/Android.mk new file mode 100755 index 000000000..14d2b8f59 --- /dev/null +++ b/build/android/Android.mk @@ -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) + + + + + + diff --git a/java/.DS_Store b/java/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..e6dc460bb1c6d2efab7037b03d06d0556d348790 GIT binary patch literal 6148 zcmeH~Jqp4=5QS%qgvIYIqf#4$mI7itHYo8^+Vg;}!TM!kPMk^St>SKu2 zy&WuhT}`%Nw2S8Op?PPuDF&v|E?SVlv^p5502LT1&_&+c`M-yMoBu~GOsN1B_%j7` zzB}x;c&R*FKVHx3$E@1A!9l+q;q4~?i5W_g#>`1v|D*?$L&+shaZ zmjD(E0BhnBhzLxB3Jj`di=jbBykuTYTmpkGn$3si&6*vG`t3Nsc)Dl}RF zSPoYIU*K2z|22s#DnJG9N&)S5``s2#%G%mI&T4IeAK;er12@CmDHyyQ1HBw$VdePQ clOnI!9Q!qK33NK*P6zU5z;vNef&W(E7lsNImH+?% literal 0 HcmV?d00001 diff --git a/java/org/linphone/.DS_Store b/java/org/linphone/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..f0988f2021b965fa11efdf8712fc62f3d2a44de7 GIT binary patch literal 6148 zcmeH~J&MCX427RIE&|)QOgYUSAU7C7a)MkS*I1iPt)Ctw2uyWN*^)X&uu{pNC7Dz1*Cu! zSdapFjITcz^h|mbDIf)wp@4rM3f)FOW6aI$5DvP7ju? z7GsFlqn#{yT}`&m-VV#*!}8ANQw+^|JFGCFSq&&i0Vyz3VAb={&;JAculax0qEre< zfj3jYhW&BB<4fh)`to{SKV{X|jZVhp3{O7+O#CR`(8IW2d_mS^>tuzdAAyiTK??k< F0>7ec60QIM literal 0 HcmV?d00001 diff --git a/java/org/linphone/core/LinphoneAddress.java b/java/org/linphone/core/LinphoneAddress.java new file mode 100644 index 000000000..86271674c --- /dev/null +++ b/java/org/linphone/core/LinphoneAddress.java @@ -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(); +} diff --git a/java/org/linphone/core/LinphoneAuthInfo.java b/java/org/linphone/core/LinphoneAuthInfo.java new file mode 100644 index 000000000..2a5dbaf2d --- /dev/null +++ b/java/org/linphone/core/LinphoneAuthInfo.java @@ -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 { + +} + + diff --git a/java/org/linphone/core/LinphoneCallLog.java b/java/org/linphone/core/LinphoneCallLog.java new file mode 100644 index 000000000..19d851a43 --- /dev/null +++ b/java/org/linphone/core/LinphoneCallLog.java @@ -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(); +} diff --git a/java/org/linphone/core/LinphoneCore.java b/java/org/linphone/core/LinphoneCore.java new file mode 100644 index 000000000..8609e04e1 --- /dev/null +++ b/java/org/linphone/core/LinphoneCore.java @@ -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 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(); +} diff --git a/java/org/linphone/core/LinphoneCoreException.java b/java/org/linphone/core/LinphoneCoreException.java new file mode 100644 index 000000000..abec2943e --- /dev/null +++ b/java/org/linphone/core/LinphoneCoreException.java @@ -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 + } + +} diff --git a/java/org/linphone/core/LinphoneCoreFactory.java b/java/org/linphone/core/LinphoneCoreFactory.java new file mode 100644 index 000000000..24315f6dd --- /dev/null +++ b/java/org/linphone/core/LinphoneCoreFactory.java @@ -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); + +} diff --git a/java/org/linphone/core/LinphoneCoreListener.java b/java/org/linphone/core/LinphoneCoreListener.java new file mode 100644 index 000000000..f48f8a9eb --- /dev/null +++ b/java/org/linphone/core/LinphoneCoreListener.java @@ -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); +} diff --git a/java/org/linphone/core/LinphoneProxyConfig.java b/java/org/linphone/core/LinphoneProxyConfig.java new file mode 100644 index 000000000..a7fe6b850 --- /dev/null +++ b/java/org/linphone/core/LinphoneProxyConfig.java @@ -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(); +} diff --git a/mediastreamer2 b/mediastreamer2 index eaf825b1a..2e02b06af 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit eaf825b1a2f041d162097b30a1b159afa80cd013 +Subproject commit 2e02b06af897fa1ed25b6e24bd3096c2c88374bf diff --git a/oRTP b/oRTP index 0424a6538..0c97230e5 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 0424a6538e1741e064c8d8573efee365b25593f1 +Subproject commit 0c97230e53c8a8eefde8024ac1f81721ad645992