mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
phone book integration
This commit is contained in:
parent
358f29c5cc
commit
08ab87eaf8
7 changed files with 141 additions and 2 deletions
37
LinphoneAddress.java
Normal file
37
LinphoneAddress.java
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
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();
|
||||
}
|
||||
61
LinphoneAddressImpl.java
Normal file
61
LinphoneAddressImpl.java
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
LinphoneAddressImpl.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 class LinphoneAddressImpl implements LinphoneAddress {
|
||||
protected final long nativePtr;
|
||||
boolean ownPtr = false;
|
||||
private native long newLinphoneAddressImpl(String uri,String displayName);
|
||||
private native void delete(long ptr);
|
||||
private native String getDisplayName(long ptr);
|
||||
private native String getUserName(long ptr);
|
||||
private native String getDomain(long ptr);
|
||||
|
||||
|
||||
protected LinphoneAddressImpl(String username,String domain,String displayName) {
|
||||
nativePtr = newLinphoneAddressImpl("sip:"+username+"@"+domain, displayName);
|
||||
}
|
||||
protected LinphoneAddressImpl(long aNativePtr) {
|
||||
nativePtr = aNativePtr;
|
||||
ownPtr=false;
|
||||
}
|
||||
protected void finalize() throws Throwable {
|
||||
if (ownPtr) delete(nativePtr);
|
||||
}
|
||||
public String getDisplayName() {
|
||||
return getDisplayName(nativePtr);
|
||||
}
|
||||
public String getDomain() {
|
||||
return getDomain(nativePtr);
|
||||
}
|
||||
public String getUserName() {
|
||||
return getUserName(nativePtr);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
String tmp="";
|
||||
if (getDisplayName()!=null) {
|
||||
tmp="<"+getDisplayName()+">";
|
||||
}
|
||||
return tmp+"sip:"+getUserName()+"@"+getDomain();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,3 +1,21 @@
|
|||
/*
|
||||
LinphoneAuthInfoImpl.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;
|
||||
|
||||
class LinphoneAuthInfoImpl implements LinphoneAuthInfo {
|
||||
|
|
|
|||
|
|
@ -89,6 +89,11 @@ public interface LinphoneCore {
|
|||
public void invite(String uri);
|
||||
|
||||
public void terminateCall();
|
||||
/**
|
||||
* get the remote address in case of in/out call
|
||||
* @return null if no call engaged yet
|
||||
*/
|
||||
public LinphoneAddress getRemoteAddress();
|
||||
|
||||
public void iterate();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
private native void addAuthInfo(long nativePtr,long authInfoNativePtr);
|
||||
private native void invite(long nativePtr,String uri);
|
||||
private native void terminateCall(long nativePtr);
|
||||
private native long getRemoteAddress(long nativePtr);
|
||||
|
||||
LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException {
|
||||
mListener=listener;
|
||||
|
|
@ -87,6 +88,14 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
public void terminateCall() {
|
||||
terminateCall(nativePtr);
|
||||
}
|
||||
public LinphoneAddress getRemoteAddress() {
|
||||
long ptr = getRemoteAddress(nativePtr);
|
||||
if (ptr==0) {
|
||||
return null;
|
||||
} else {
|
||||
return new LinphoneAddressImpl(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,10 @@ public interface LinphoneProxyConfig {
|
|||
* @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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig {
|
|||
|
||||
private native void enableRegister(long ptr,boolean value);
|
||||
|
||||
private native String normalizePhoneNumber(long ptr,String number);
|
||||
|
||||
public void enableRegister(boolean value) {
|
||||
enableRegister(nativePtr,value);
|
||||
}
|
||||
|
|
@ -76,4 +78,7 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig {
|
|||
throw new LinphoneCoreException("Bad proxy address ["+proxyUri+"]");
|
||||
}
|
||||
}
|
||||
public String normalizePhoneNumber(String number) {
|
||||
return normalizePhoneNumber(nativePtr,number);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue