many bug fixes + audio routing + incoming call

This commit is contained in:
Jehan Monnier 2010-02-15 18:01:06 +01:00
parent 8f449aabbe
commit 7b6ccba59e
4 changed files with 58 additions and 15 deletions

View file

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

View file

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

View file

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

View file

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