diff --git a/LinphoneAddress.java b/LinphoneAddress.java index 619bd4fb8..86271674c 100644 --- a/LinphoneAddress.java +++ b/LinphoneAddress.java @@ -34,7 +34,11 @@ public interface LinphoneAddress { * @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)} */ diff --git a/LinphoneAddressImpl.java b/LinphoneAddressImpl.java index fd80db86e..50036ac7d 100644 --- a/LinphoneAddressImpl.java +++ b/LinphoneAddressImpl.java @@ -29,6 +29,8 @@ public class LinphoneAddressImpl implements LinphoneAddress { private native String getUserName(long ptr); private native String getDomain(long ptr); private native String toUri(long ptr); + private native String setDisplayName(long ptr,String name); + protected LinphoneAddressImpl(String username,String domain,String displayName) { nativePtr = newLinphoneAddressImpl("sip:"+username+"@"+domain, displayName); @@ -56,5 +58,8 @@ public class LinphoneAddressImpl implements LinphoneAddress { public String toUri() { return toUri(nativePtr); } + public void setDisplayName(String name) { + setDisplayName(nativePtr,name); + } } diff --git a/LinphoneCore.java b/LinphoneCore.java index 753dfa12f..4245c5518 100644 --- a/LinphoneCore.java +++ b/LinphoneCore.java @@ -90,6 +90,8 @@ public interface LinphoneCore { public void invite(String uri); + public void invite(LinphoneAddress to); + public void terminateCall(); /** * get the remote address in case of in/out call @@ -151,6 +153,13 @@ public interface LinphoneCore { * @param isMuted */ public void muteMic(boolean isMuted); + /** + * 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; } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index eda069112..173d5846c 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -52,6 +52,8 @@ class LinphoneCoreImpl implements LinphoneCore { private native void setSoftPlayLevel(long nativeptr, float gain); private native float getSoftPlayLevel(long nativeptr); private native void muteMic(long nativePtr,boolean isMuted); + private native long interpretUrl(long nativePtr,String destination); + private native void inviteAddress(long nativePtr,long to); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { @@ -169,4 +171,15 @@ class LinphoneCoreImpl implements LinphoneCore { public void muteMic(boolean isMuted) { muteMic(nativePtr,isMuted); } + public LinphoneAddress interpretUrl(String destination) throws LinphoneCoreException { + long lAddress = interpretUrl(nativePtr,destination); + if (lAddress != 0) { + return new LinphoneAddressImpl(lAddress); + } else { + throw new LinphoneCoreException("Cannot interpret ["+destination+"]"); + } + } + public void invite(LinphoneAddress to) { + inviteAddress(nativePtr,((LinphoneAddressImpl)to).nativePtr); + } }