]> sjero.net Git - linphone/blob - java/common/org/linphone/core/LinphoneProxyConfig.java
Added lookupCCCFromIso method to JNI
[linphone] / java / common / org / linphone / core / LinphoneProxyConfig.java
1 /*
2 LinphoneProxyConfig.java
3 Copyright (C) 2010  Belledonne Communications, Grenoble, France
4
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.
9
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.
14
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.
18 */
19 package org.linphone.core;
20 /**
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()} .
24  *
25  */
26 public interface LinphoneProxyConfig {
27         
28         /**
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.
32          */
33         public void edit();
34         /**
35          * Commits modification made to the proxy configuration.
36          */
37         public void done();
38         /**
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.
41          */
42         public void setIdentity(String identity) throws LinphoneCoreException;
43         /**
44          *get  the SIP identity that belongs to this proxy configuration.
45          *
46          * @return The SIP identity is a SIP address (Display Name <sip:username> )
47          */
48         public String getIdentity();
49         /**
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
55          * @param proxyUri
56          * @throws LinphoneCoreException
57          */
58         public void setProxy(String proxyUri) throws LinphoneCoreException;
59         /**
60          * get the proxy's SIP address.
61          *  
62          */
63         public String getProxy();
64         /**
65          * Enable register for this proxy config.
66          * Register message is issued after call to {@link #done()}
67          * @param value
68          * @throws LinphoneCoreException
69          */     
70         public void enableRegister(boolean value) throws LinphoneCoreException;
71         /**
72          * @return true if registration to the proxy is enabled.
73          */
74         public boolean registerEnabled();
75         
76         /**
77          * normalize a human readable phone number into a basic string. 888-444-222 becomes 888444222
78          * @param number
79          * @return
80          */
81         public String normalizePhoneNumber(String number);
82         /**
83          * Useful function to automatically add international prefix to e164 phone numbers
84          * @param prefix
85          */
86         public void setDialPrefix(String prefix);
87         /**
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
91          */
92         public void setDialEscapePlus(boolean value);
93         
94         /**
95          * get domain host name or ip
96          * @return may be null
97          */
98         public String getDomain();
99         /**
100          * 
101          * @return  a boolean indicating that the user is successfully registered on the proxy.
102          */
103         public boolean isRegistered();
104         /**
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
108          */
109         public void setRoute(String routeUri) throws LinphoneCoreException;
110         /**
111          * 
112          * @return  the route set for this proxy configuration.
113          */
114         public String getRoute();
115         /**
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
120          *
121          */
122         public void enablePublish(boolean enable);
123         /**
124          * returns publish state for this proxy config (see {@link #enablePublish(boolean)} )
125          */
126         public boolean publishEnabled();
127         
128         
129         LinphoneCore.RegistrationState getState();
130         
131         /**
132          * Sets the registration expiration time.
133          * @param delay expiration time in seconds
134          */
135         void setExpires(int delay);
136         
137         /**
138          * Sets parameters for the contact
139          * @param parameters to add
140          */
141         public void setContactParameters(String params);
142         
143         /**
144          * Return the international prefix for the given country
145          * @param country iso code
146          */
147         public int lookupCCCFromIso(String iso);
148 }