linphone-LinphoneProxyConfig.java文件分析
来源:互联网 发布:西科在线网络教育 编辑:程序博客网 时间:2024/05/17 04:41
说明
这个是linphone的纯配置文件,可能需要保存到文件中,是长久的数据.如何保存c/c++分析.
功能
- 设置Identity
- 设置Address
- 设置Proxy
- 设置register
- 设置Domain
- 设置Dial
- 设置 Route
- 设置Route
- 设置Expires
- 设置AVPF
- 设置Realm
- 设置ContactParameters
- 设置PublichExpires
UML类图
LinphoneProxyConfig.java
package org.linphone.core;/** * The LinphoneProxyConfig object represents a proxy configuration to be used by the LinphoneCore object. Its fields must not be used directly in favour of the accessors methods. * Once created and filled properly the LinphoneProxyConfig can be given to LinphoneCore with {@link LinphoneCore#addProxyConfig(LinphoneProxyConfig)}. This will automatically triggers the registration, if enabled. *<br>The proxy configuration are persistent to restarts because they are saved in the configuration file. As a consequence, after {@link LinphoneCoreFactory#createLinphoneCore(LinphoneCoreListener, String, String, Object)} there might already be a default proxy that can be examined with {@link LinphoneCore#getDefaultProxyConfig()} . * */public interface LinphoneProxyConfig { /** *Starts editing a proxy configuration. *Because proxy configuration must be consistent, applications MUST call {@link #edit()} before doing any attempts to modify proxy configuration (such as identity, proxy address and so on). *Once the modifications are done, then the application must call {@link #done()} to commit the changes. */ public LinphoneProxyConfig edit(); /** * Commits modification made to the proxy configuration. */ public void done(); /** * Sets the user identity as a SIP address. * @param identity This identity is normally formed with display name, username and domain, such as: Alice <sip:alice@example.net> The REGISTER messages will have from and to set to this identity. */ public void setIdentity(String identity) throws LinphoneCoreException; /** *get the SIP identity that belongs to this proxy configuration. * * @return The SIP identity is a SIP address (Display Name <sip:username> ) */ public String getIdentity(); /** * Sets the address of the proxy configuration * @param address */ public void setAddress(LinphoneAddress address) throws LinphoneCoreException; /** *get linphoneAddress that belongs to this proxy configuration. * * @return LinphoneAddress */ public LinphoneAddress getAddress(); /** *Sets the proxy address * Examples of valid sip proxy address are: *<li>IP address: sip:87.98.157.38 *<li>IP address with port: sip:87.98.157.38:5062 *<li>hostnames : sip:sip.example.net * @param proxyUri * @throws LinphoneCoreException */ public void setProxy(String proxyUri) throws LinphoneCoreException; /** * get the proxy's SIP address. * */ public String getProxy(); /** * Enable register for this proxy config. * Register message is issued after call to {@link #done()} * @param value */ public LinphoneProxyConfig enableRegister(boolean value); /** * @return true if registration to the proxy is enabled. */ public boolean registerEnabled(); /** * normalize a human readable phone number into a basic string. 888-444-222 becomes 888444222 * @param number * @return */ public String normalizePhoneNumber(String number); /** * Normalize a human readable sip uri into a fully qualified LinphoneAddress. * A sip address should look like DisplayName \<sip:username\@domain:port\> . * @param username the string to parse * @return NULL if invalid input, normalized sip address otherwise. */ public LinphoneAddress normalizeSipUri(String username); /** * Useful function to automatically add international prefix to e164 phone numbers * @param prefix */ public void setDialPrefix(String prefix); /** * Returns the automatically added international prefix to e164 phone numbers */ public String getDialPrefix(); /** * * 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); /** * Whether liblinphone should replace "+" by "00" in dialed numbers (passed to * {@link LinphoneCore#invite(String)}). */ public boolean getDialEscapePlus(); /** * get domain host name or ip * @return may be null */ public String getDomain(); /** * * @return a boolean indicating that the user is successfully registered on the proxy. */ public boolean isRegistered(); /** * Sets a SIP route. When a route is set, all outgoing calls will go to the route's destination if this proxy is the default one (see {@link LinphoneCore#getDefaultProxyConfig()} ). * @param routeUri ex sip:git.linphone.org * @throws LinphoneCoreException */ public void setRoute(String routeUri) throws LinphoneCoreException; /** * * @return the route set for this proxy configuration. */ public String getRoute(); /** * Indicates either or not, PUBLISH must be issued for this #LinphoneProxyConfig . * <br> In case this #LinphoneProxyConfig has been added to #LinphoneCore, follows the linphone_proxy_config_edit() rule. * @param enable if true, publish will be engaged * */ public void enablePublish(boolean enable); /** * returns publish state for this proxy config (see {@link #enablePublish(boolean)} ) */ public boolean publishEnabled(); LinphoneCore.RegistrationState getState(); /** * Sets the registration expiration time. * @param delay expiration time in seconds */ void setExpires(int delay); /** * Gets the registration expiration time. * @return delay expiration time in seconds. */ int getExpires(); /** * Set the privacy for all calls or chat sessions using the identity exposed by this LinphoneProxyConfig * @param privacy_mask a or'd int of values defined in interface {@link org.linphone.core.Privacy} */ void setPrivacy(int privacy_mask); /** * Get the privacy mask requested for this proxy config. * @return the privacy mask as defined in interface {@link org.linphone.core.Privacy} */ int getPrivacy(); /** * Indicates whether AVPF/SAVPF must be used for calls using this proxy config. * @param enable True to enable AVPF/SAVF, false to disable it. */ void enableAvpf(boolean enable); /** * Whether AVPF is used for calls through this proxy. * @return */ boolean avpfEnabled(); /** * Set the interval between regular RTCP reports when using AVPF/SAVPF. * @param interval The interval in seconds (between 0 and 5 seconds). */ void setAvpfRRInterval(int interval); /** * Get the interval between regular RTCP reports when using AVPF/SAVPF. * @return The interval in seconds. */ int getAvpfRRInterval(); /** * Indicates whether quality reporting must be used for calls using this proxy config. * @param enable True to enable quality reporting, false to disable it. */ void enableQualityReporting(boolean enable); /** * Whether quality reporting is used for calls through this proxy. * @return */ boolean qualityReportingEnabled(); /** * Set the interval between quality interval reports during a call when using quality reporting. * @param interval The interval in seconds (should be greater than 120 seconds to avoid too much). */ void setQualityReportingInterval(int interval); /** * Get the interval between quality interval reports during a call when using quality reporting. * @return The interval in seconds. */ int getQualityReportingInterval(); /** * Set the collector SIP URI to collect reports when using quality reporting. * @param collector The collector SIP URI which should be configured server side too. */ void setQualityReportingCollector(String collector); /** * Get the collector SIP URI collecting reports when using quality reporting. * @return The SIP URI collector address. */ String getQualityReportingCollector(); /** * Set the outbound proxy realm. It is used in digest authentication to avoid * re-authentication if a previous token has already been provided. * @param realm The new outbound proxy realm. */ void setRealm(String realm); /** * Get the outbound proxy realm. * @return The outbound proxy realm. */ String getRealm(); /** * Set optional contact parameters that will be added to the contact information sent in the registration. * @param contact_params a string containing the additional parameters in text form, like "myparam=something;myparam2=something_else" * * The main use case for this function is provide the proxy additional information regarding the user agent, like for example unique identifier or android push id. * As an example, the contact address in the SIP register sent will look like <sip:joe@15.128.128.93:50421>;android-push-id=43143-DFE23F-2323-FA2232. **/ public void setContactParameters(String contact_params); /** * Get the contact's parameters. * @return */ public String getContactParameters(); /** * Set optional contact parameters that will be added to the contact information sent in the registration, inside the URI. * @param params a string containing the additional parameters in text form, like "myparam=something;myparam2=something_else" * * The main use case for this function is provide the proxy additional information regarding the user agent, like for example unique identifier or apple push id. * As an example, the contact address in the SIP register sent will look like <sip:joe@15.128.128.93:50421;apple-push-id=43143-DFE23F-2323-FA2232>. **/ public void setContactUriParameters(String params); /** * Get the contact's URI parameters. * @return */ public String getContactUriParameters(); /** * Return the international prefix for the given country * @param iso code */ public int lookupCCCFromIso(String iso); /** * Return the international prefix for the given country * @param e164 phone number */ public int lookupCCCFromE164(String e164); /** * Return reason error code. * @return reason code. */ public Reason getError(); /** * Get full error information about last error occured on the proxy config. * @return an ErrorInfo. */ public ErrorInfo getErrorInfo(); /** * Set the publish expiration time in second. * @param expires in second */ public void setPublishExpires(int expires); /** * @return the publish expiration time in second. Default value is the registration expiration value. */ public int getPublishExpires(); /** * attached a user data to a proxy config **/ void setUserData(Object obj); /** * Detect if the given input is a phone number or not. * @param username string to parse. * @return TRUE if input is a phone number, FALSE otherwise. **/ boolean isPhoneNumber(String username); /** * Returns user data from a proxy config. return null if any * @return an Object. */ Object getUserData();}
LinphoneProxyCofnigImpl.java
package org.linphone.core;import org.linphone.core.LinphoneCore.RegistrationState;class LinphoneProxyConfigImpl implements LinphoneProxyConfig { protected final long nativePtr; protected LinphoneCoreImpl mCore; Object userData; private native void finalize(long ptr); private native int getState(long nativePtr); private native void setExpires(long nativePtr, int delay); private native int getExpires(long nativePtr); private native long createProxyConfig( long nativePtr); protected LinphoneProxyConfigImpl(LinphoneCoreImpl core,String identity,String proxy,String route, boolean enableRegister) throws LinphoneCoreException { mCore=core; nativePtr = createProxyConfig(core.nativePtr); setIdentity(identity); setProxy(proxy); setRoute(route); enableRegister(enableRegister); } protected LinphoneProxyConfigImpl(LinphoneCoreImpl core) { mCore=core; nativePtr = createProxyConfig(core.nativePtr); } /*reserved for JNI */ protected LinphoneProxyConfigImpl(LinphoneCoreImpl core, long aNativePtr) { mCore=core; nativePtr = aNativePtr; } private void isValid() { if (nativePtr == 0) { throw new RuntimeException("proxy config removed"); } } protected void finalize() throws Throwable { if (nativePtr != 0) { finalize(nativePtr); } super.finalize(); } private native long newLinphoneProxyConfig(); private native void edit(long ptr); private native void done(long ptr); private native void setIdentity(long ptr,String identity); private native String getIdentity(long ptr); private native void setAddress(long ptr, long address); private native long getAddress(long ptr); private native int setProxy(long ptr,String proxy); private native String getProxy(long ptr); private native void enableRegister(long ptr,boolean value); private native boolean isRegisterEnabled(long ptr); private native boolean isRegistered(long ptr); private native void setDialPrefix(long ptr, String prefix); private native String getDialPrefix(long ptr); private native String normalizePhoneNumber(long ptr,String number); private native long normalizeSipUri(long ptr,String username); private native String getDomain(long ptr); private native void setDialEscapePlus(long ptr, boolean value); private native boolean getDialEscapePlus(long ptr); private native String getRoute(long ptr); private native int setRoute(long ptr,String uri); private native void enablePublish(long ptr,boolean enable); private native boolean publishEnabled(long ptr); private native void setContactParameters(long ptr, String params); private native int lookupCCCFromIso(long nativePtr, String iso); private native int lookupCCCFromE164(long nativePtr, String e164); public LinphoneProxyConfig enableRegister(boolean value) { isValid(); enableRegister(nativePtr,value); return this; } public void done() { isValid(); Object mutex=mCore!=null ? mCore : this; synchronized(mutex){ done(nativePtr); } } public LinphoneProxyConfig edit() { isValid(); Object mutex=mCore!=null ? mCore : this; synchronized(mutex){ edit(nativePtr); } return this; } public void setIdentity(String identity) throws LinphoneCoreException { isValid(); setIdentity(nativePtr,identity); } public void setAddress(LinphoneAddress address) throws LinphoneCoreException { isValid(); setAddress(nativePtr,((LinphoneAddressImpl)address).nativePtr); } public void setProxy(String proxyUri) throws LinphoneCoreException { isValid(); if (setProxy(nativePtr,proxyUri)!=0) { throw new LinphoneCoreException("Bad proxy address ["+proxyUri+"]"); } } public String normalizePhoneNumber(String number) { isValid(); return normalizePhoneNumber(nativePtr,number); } public LinphoneAddress normalizeSipUri(String username) { isValid(); long ptr = normalizeSipUri(nativePtr,username); if (ptr==0) { return null; } else { return new LinphoneAddressImpl(ptr,LinphoneAddressImpl.WrapMode.FromConst); } } public void setDialPrefix(String prefix) { isValid(); setDialPrefix(nativePtr, prefix); } public String getDialPrefix() { isValid(); return getDialPrefix(nativePtr); } public String getDomain() { isValid(); return getDomain(nativePtr); } public void setDialEscapePlus(boolean value) { isValid(); setDialEscapePlus(nativePtr,value); } public boolean getDialEscapePlus() { isValid(); return getDialEscapePlus(nativePtr); } public String getIdentity() { isValid(); return getIdentity(nativePtr); } public LinphoneAddress getAddress() { isValid(); long ptr = getAddress(nativePtr); if (ptr==0) { return null; } else { return new LinphoneAddressImpl(ptr,LinphoneAddressImpl.WrapMode.FromConst); } } public String getProxy() { isValid(); return getProxy(nativePtr); } public boolean isRegistered() { isValid(); return isRegistered(nativePtr); } public boolean registerEnabled() { isValid(); return isRegisterEnabled(nativePtr); } public String getRoute() { isValid(); return getRoute(nativePtr); } public void setRoute(String routeUri) throws LinphoneCoreException { isValid(); if (setRoute(nativePtr, routeUri) != 0) { throw new LinphoneCoreException("cannot set route ["+routeUri+"]"); } } public void enablePublish(boolean enable) { isValid(); enablePublish(nativePtr,enable); } public RegistrationState getState() { isValid(); return RegistrationState.fromInt(getState(nativePtr)); } public void setExpires(int delay) { isValid(); setExpires(nativePtr, delay); } public int getExpires() { isValid(); return getExpires(nativePtr); } public boolean publishEnabled() { isValid(); return publishEnabled(nativePtr); } @Override public void setContactParameters(String params) { isValid(); setContactParameters(nativePtr, params); } @Override public int lookupCCCFromIso(String iso) { isValid(); return lookupCCCFromIso(nativePtr, iso); } @Override public int lookupCCCFromE164(String e164) { isValid(); return lookupCCCFromE164(nativePtr, e164); } private native int getError(long nativeptr); @Override public Reason getError() { isValid(); return Reason.fromInt(getError(nativePtr)); } private native void setPrivacy(long nativePtr, int mask); @Override public void setPrivacy(int privacy_mask) { isValid(); setPrivacy(nativePtr,privacy_mask); } private native int getPrivacy(long nativePtr); @Override public int getPrivacy() { isValid(); return getPrivacy(nativePtr); } private native void enableAvpf(long nativePtr, boolean enable); @Override public void enableAvpf(boolean enable) { isValid(); enableAvpf(nativePtr, enable); } private native boolean avpfEnabled(long nativePtr); @Override public boolean avpfEnabled() { isValid(); return avpfEnabled(nativePtr); } private native void setAvpfRRInterval(long nativePtr, int interval); @Override public void setAvpfRRInterval(int interval) { isValid(); setAvpfRRInterval(nativePtr, interval); } private native int getAvpfRRInterval(long nativePtr); @Override public int getAvpfRRInterval() { isValid(); return getAvpfRRInterval(nativePtr); } private native String getContactParameters(long ptr); @Override public String getContactParameters() { isValid(); return getContactParameters(nativePtr); } private native void setContactUriParameters(long ptr, String params); @Override public void setContactUriParameters(String params) { isValid(); setContactUriParameters(nativePtr,params); } private native String getContactUriParameters(long ptr); @Override public String getContactUriParameters() { isValid(); return getContactUriParameters(nativePtr); } private native long getErrorInfo(long nativePtr); @Override public ErrorInfo getErrorInfo() { return new ErrorInfoImpl(getErrorInfo(nativePtr)); } private native void enableQualityReporting(long nativePtr, boolean enable); @Override public void enableQualityReporting(boolean enable) { isValid(); enableQualityReporting(nativePtr, enable); } private native boolean qualityReportingEnabled(long nativePtr); @Override public boolean qualityReportingEnabled() { isValid(); return avpfEnabled(nativePtr); } private native void setQualityReportingInterval(long nativePtr, int interval); @Override public void setQualityReportingInterval(int interval) { isValid(); setQualityReportingInterval(nativePtr, interval); } private native int getQualityReportingInterval(long nativePtr); @Override public int getQualityReportingInterval() { isValid(); return getQualityReportingInterval(nativePtr); } private native void setQualityReportingCollector(long nativePtr, String collector); @Override public void setQualityReportingCollector(String collector) { isValid(); setQualityReportingCollector(nativePtr, collector); } private native String getQualityReportingCollector(long nativePtr); @Override public String getQualityReportingCollector() { isValid(); return getQualityReportingCollector(nativePtr); } private native void setRealm(long nativePtr, String realm); @Override public void setRealm(String realm) { isValid(); setRealm(nativePtr, realm); } private native String getRealm(long nativePtr); @Override public String getRealm() { isValid(); return getRealm(nativePtr); } private native void setPublishExpires(long nativePtr, int expires); @Override public void setPublishExpires(int expires) { isValid(); setPublishExpires(nativePtr, expires); } private native int getPublishExpires(long nativePtr); @Override public int getPublishExpires() { isValid(); return getPublishExpires(nativePtr); } private native boolean isPhoneNumber(long nativePtr,String username); @Override public boolean isPhoneNumber(String username){ return isPhoneNumber(nativePtr,username); } @Override public void setUserData(Object obj) { userData = obj; } @Override public Object getUserData() { return userData; }}
0 0
- linphone-LinphoneProxyConfig.java文件分析
- linphone-LinphoneManager.java文件分析
- linphone-LinphoneCoreFactory.java文件分析
- linphone-LinphoneAddress.java文件分析
- linphone-LpConfig.java文件分析
- linphone-LinponeCore.java文件分析
- linphone-LinphoneContent.java文件分析
- linphone-LinphoneInfoMessage.java文件分析
- linphone-PresenceModel.java文件分析
- linphone-PresenceActivity.java文件分析
- linphone-PresenceService.java文件分析
- linphone-PresencePerson.java文件分析
- linphone-PresenceNote.java文件分析
- linphone-Tunnelconfig.java文件分析
- linphone-KeepAliveReceiver.java文件分析
- linphone-BootReceiver.java文件分析
- linphone-NetworkManger.java文件分析
- linphone-LinphonePreferences.java文件分析
- HDU 3723 Delta Wave(默慈金数)
- 数据结构实验之栈一:进制转换
- JCS和Redis
- 极光推送
- GZIP压缩原理分析(14)——第五章 Deflate算法详解(五05) 预备知识(04) 前缀码、原始哈夫曼编码原理以及deflate所用哈夫曼编码的性质
- linphone-LinphoneProxyConfig.java文件分析
- 中序线索二叉树Java实现
- Java String、StringBuffer和StringBuilder
- mysql error
- requestFeature() must be called before adding content
- iOS开发网络篇之文件下载、大文件下载、断点下载
- C/C++内存管理详解(转载)
- Spring4笔记----AOP概述
- 后缀数组