diff --git a/LinphoneCore.java b/LinphoneCore.java index 0a327f481..59747220c 100644 --- a/LinphoneCore.java +++ b/LinphoneCore.java @@ -94,6 +94,26 @@ public interface LinphoneCore { * @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(); + + } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 2ef2895f6..2997033e5 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -39,21 +39,24 @@ class LinphoneCoreImpl implements LinphoneCore { private native void invite(long nativePtr,String uri); private native void terminateCall(long nativePtr); private native long getRemoteAddress(long nativePtr); + private native boolean isInCall(long nativePtr); + private native boolean isInComingInvitePending(long nativePtr); + private native void acceptCall(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) { + public synchronized void addAuthInfo(LinphoneAuthInfo info) { addAuthInfo(nativePtr,((LinphoneAuthInfoImpl)info).nativePtr); } - public LinphoneProxyConfig createProxyConfig(String identity, String proxy,String route,boolean enableRegister) throws LinphoneCoreException { + public synchronized LinphoneProxyConfig createProxyConfig(String identity, String proxy,String route,boolean enableRegister) throws LinphoneCoreException { return new LinphoneProxyConfigImpl(identity, proxy, route,enableRegister); } - public LinphoneProxyConfig getDefaultProxyConfig() { + public synchronized LinphoneProxyConfig getDefaultProxyConfig() { long lNativePtr = getDefaultProxyConfig(nativePtr); if (lNativePtr!=0) { return new LinphoneProxyConfigImpl(lNativePtr); @@ -62,33 +65,33 @@ class LinphoneCoreImpl implements LinphoneCore { } } - public void invite(String uri) { + public synchronized void invite(String uri) { invite(nativePtr,uri); } - public void iterate() { + public synchronized void iterate() { iterate(nativePtr); } - public void setDefaultProxyConfig(LinphoneProxyConfig proxyCfg) { + public synchronized void setDefaultProxyConfig(LinphoneProxyConfig proxyCfg) { setDefaultProxyConfig(nativePtr,((LinphoneProxyConfigImpl)proxyCfg).nativePtr); } - public void addtProxyConfig(LinphoneProxyConfig proxyCfg) throws LinphoneCoreException{ + public synchronized void addtProxyConfig(LinphoneProxyConfig proxyCfg) throws LinphoneCoreException{ if (addProxyConfig(nativePtr,((LinphoneProxyConfigImpl)proxyCfg).nativePtr) !=0) { throw new LinphoneCoreException("bad proxy config"); } } - public void clearAuthInfos() { + public synchronized void clearAuthInfos() { clearAuthInfos(nativePtr); } - public void clearProxyConfigs() { + public synchronized void clearProxyConfigs() { clearProxyConfigs(nativePtr); } - public void terminateCall() { + public synchronized void terminateCall() { terminateCall(nativePtr); } - public LinphoneAddress getRemoteAddress() { + public synchronized LinphoneAddress getRemoteAddress() { long ptr = getRemoteAddress(nativePtr); if (ptr==0) { return null; @@ -96,6 +99,14 @@ class LinphoneCoreImpl implements LinphoneCore { return new LinphoneAddressImpl(ptr); } } - - + public synchronized boolean isIncall() { + return isInCall(nativePtr); + } + public synchronized boolean isInComingInvitePending() { + return isInComingInvitePending(nativePtr); + } + public synchronized void acceptCall() { + acceptCall(nativePtr); + + } } diff --git a/LinphoneProxyConfig.java b/LinphoneProxyConfig.java index 97c7d21a6..a7fe6b850 100644 --- a/LinphoneProxyConfig.java +++ b/LinphoneProxyConfig.java @@ -56,6 +56,12 @@ public interface LinphoneProxyConfig { * @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 diff --git a/LinphoneProxyConfigImpl.java b/LinphoneProxyConfigImpl.java index a82418cdb..af2722dd2 100644 --- a/LinphoneProxyConfigImpl.java +++ b/LinphoneProxyConfigImpl.java @@ -42,7 +42,8 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { ownPtr=false; } protected void finalize() throws Throwable { - if (ownPtr) delete(nativePtr); + Log.e(Linphone.TAG,"fixme, should release underlying proxy config"); + // FIXME if (ownPtr) delete(nativePtr); } private native long newLinphoneProxyConfig(); private native void delete(long ptr); @@ -61,6 +62,8 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { private native String getDomain(long ptr); + private native void setDialEscapePlus(long ptr, boolean value); + public void enableRegister(boolean value) { enableRegister(nativePtr,value); } @@ -91,4 +94,7 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { public String getDomain() { return getDomain(nativePtr); } + public void setDialEscapePlus(boolean value) { + setDialEscapePlus(nativePtr,value); + } }