2 LinphoneProxyConfig.java
3 Copyright (C) 2010 Belledonne Communications, Grenoble, France
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 package org.linphone.core;
21 * 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.
22 * 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.
23 *<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()} .
26 public interface LinphoneProxyConfig {
29 *Starts editing a proxy configuration.
30 *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).
31 *Once the modifications are done, then the application must call {@link #done()} to commit the changes.
35 * Commits modification made to the proxy configuration.
39 * Sets the user identity as a SIP address.
40 * @param identy 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.
42 public void setIdentity(String identity) throws LinphoneCoreException;
44 *get the SIP identity that belongs to this proxy configuration.
46 * @return The SIP identity is a SIP address (Display Name <sip:username> )
48 public String getIdentity();
50 *Sets the proxy address
51 * Examples of valid sip proxy address are:
52 *<li>IP address: sip:87.98.157.38
53 *<li>IP address with port: sip:87.98.157.38:5062
54 *<li>hostnames : sip:sip.example.net
56 * @throws LinphoneCoreException
58 public void setProxy(String proxyUri) throws LinphoneCoreException;
60 * get the proxy's SIP address.
63 public String getProxy();
65 * Enable register for this proxy config.
66 * Register message is issued after call to {@link #done()}
68 * @throws LinphoneCoreException
70 public void enableRegister(boolean value) throws LinphoneCoreException;
72 * @return true if registration to the proxy is enabled.
74 public boolean registerEnabled();
77 * normalize a human readable phone number into a basic string. 888-444-222 becomes 888444222
81 public String normalizePhoneNumber(String number);
83 * Useful function to automatically add international prefix to e164 phone numbers
86 public void setDialPrefix(String prefix);
88 * * Sets whether liblinphone should replace "+" by "00" in dialed numbers (passed to
89 * {@link LinphoneCore#invite(String)}).
90 * @param value default value is false
92 public void setDialEscapePlus(boolean value);
95 * get domain host name or ip
98 public String getDomain();
101 * @return a boolean indicating that the user is successfully registered on the proxy.
103 public boolean isRegistered();
105 * 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()} ).
106 * @param routeUri ex sip:git.linphone.org
107 * @throws LinphoneCoreException
109 public void setRoute(String routeUri) throws LinphoneCoreException;
112 * @return the route set for this proxy configuration.
114 public String getRoute();
116 * Indicates either or not, PUBLISH must be issued for this #LinphoneProxyConfig .
117 * <br> In case this #LinphoneProxyConfig has been added to #LinphoneCore, follows the linphone_proxy_config_edit() rule.
118 * @param obj object pointer
119 * @param val if true, publish will be engaged
122 public void enablePublish(boolean enable);
124 * returns publish state for this proxy config (see {@link #enablePublish(boolean)} )
126 public boolean publishEnabled();
129 LinphoneCore.RegistrationState getState();
132 * Sets the registration expiration time.
133 * @param delay expiration time in seconds
135 void setExpires(int delay);
138 * Sets parameters for the contact
139 * @param parameters to add
141 public void setContactParameters(String params);
144 * Return the international prefix for the given country
145 * @param country iso code
147 public int lookupCCCFromIso(String iso);