]> sjero.net Git - linphone/blob - java/common/org/linphone/core/LinphoneCore.java
144b7dfe22308f7995844ff01611b201be3072b3
[linphone] / java / common / org / linphone / core / LinphoneCore.java
1 /*
2 LinphoneCore.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 import java.util.Vector;
22
23 import org.linphone.core.LinphoneCall.State;
24 import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
25
26 /**
27  * Linphone core main object created by method {@link LinphoneCoreFactory#createLinphoneCore(LinphoneCoreListener, String, String, Object)}.    
28  *
29  */
30
31 public interface LinphoneCore {
32         /**
33          * linphone core states
34          */
35         static public class GlobalState {
36                 
37                 static private Vector<GlobalState> values = new Vector<GlobalState>();
38                 /**
39                  * Off
40                  */
41                 static public GlobalState GlobalOff = new GlobalState(0,"GlobalOff");       
42                 /**
43                  * Startup
44                  */
45                 static public GlobalState GlobalStartup = new GlobalState(1,"GlobalStartup");
46                 /**
47                  * On
48                  */
49                 static public GlobalState GlobalOn = new GlobalState(2,"GlobalOn");
50                 /**
51                  * Shutdown
52                  */
53                 static public GlobalState GlobalShutdown = new GlobalState(3,"GlobalShutdown");
54
55                 private final int mValue;
56                 private final String mStringValue;
57
58                 
59                 private GlobalState(int value,String stringValue) {
60                         mValue = value;
61                         values.addElement(this);
62                         mStringValue=stringValue;
63                 }
64                 public static GlobalState fromInt(int value) {
65
66                         for (int i=0; i<values.size();i++) {
67                                 GlobalState state = (GlobalState) values.elementAt(i);
68                                 if (state.mValue == value) return state;
69                         }
70                         throw new RuntimeException("state not found ["+value+"]");
71                 }
72                 public String toString() {
73                         return mStringValue;
74                 }
75         }
76         /**
77          * Describes proxy registration states.
78          *
79          */
80         static public class RegistrationState {
81                 
82                 private static Vector<RegistrationState> values = new Vector<RegistrationState>();
83                 /**
84                  * None
85                  */
86                 public static RegistrationState RegistrationNone = new RegistrationState(0,"RegistrationNone");       
87                 /**
88                  * In Progress
89                  */
90                 public static RegistrationState RegistrationProgress  = new RegistrationState(1,"RegistrationProgress");
91                 /**
92                  * Ok
93                  */
94                 public static RegistrationState RegistrationOk = new RegistrationState(2,"RegistrationOk");
95                 /**
96                  * Cleared
97                  */
98                 public static RegistrationState RegistrationCleared = new RegistrationState(3,"RegistrationCleared");
99                 /**
100                  * Failed
101                  */
102                 public static RegistrationState RegistrationFailed = new RegistrationState(4,"RegistrationFailed");
103                 private final int mValue;
104                 private final String mStringValue;
105
106                 
107                 private RegistrationState(int value,String stringValue) {
108                         mValue = value;
109                         values.addElement(this);
110                         mStringValue=stringValue;
111                 }
112                 public static RegistrationState fromInt(int value) {
113
114                         for (int i=0; i<values.size();i++) {
115                                 RegistrationState state = (RegistrationState) values.elementAt(i);
116                                 if (state.mValue == value) return state;
117                         }
118                         throw new RuntimeException("state not found ["+value+"]");
119                 }
120                 public String toString() {
121                         return mStringValue;
122                 }
123         }
124         /**
125          * Describes firewall policy.
126          *
127          */
128         static public class FirewallPolicy {
129                 
130                 static private Vector<FirewallPolicy> values = new Vector<FirewallPolicy>();
131                 /**
132                  * No firewall is assumed.
133                  */
134                 static public FirewallPolicy NoFirewall = new FirewallPolicy(0,"NoFirewall");       
135                 /**
136                  * Use NAT address (discouraged)
137                  */
138                 static public FirewallPolicy UseNatAddress  = new FirewallPolicy(1,"UseNatAddress");
139                 /**
140                  * Use stun server to discover RTP addresses and ports.
141                  */
142                 static public FirewallPolicy UseStun = new FirewallPolicy(2,"UseStun");
143                 /**
144                  * Use ICE.
145                  */
146                 static public FirewallPolicy UseIce = new FirewallPolicy(3,"UseIce");
147                 /**
148                  * Use uPnP.
149                  */
150                 static public FirewallPolicy UseUpnp = new FirewallPolicy(4,"UseUpnp");
151                 
152                 private final int mValue;
153                 private final String mStringValue;
154
155                 
156                 private FirewallPolicy(int value,String stringValue) {
157                         mValue = value;
158                         values.addElement(this);
159                         mStringValue=stringValue;
160                 }
161                 public static FirewallPolicy fromInt(int value) {
162
163                         for (int i=0; i<values.size();i++) {
164                                 FirewallPolicy state = (FirewallPolicy) values.elementAt(i);
165                                 if (state.mValue == value) return state;
166                         }
167                         throw new RuntimeException("state not found ["+value+"]");
168                 }
169                 public String toString() {
170                         return mStringValue;
171                 }
172                 public int value(){
173                         return mValue;
174                 }
175         }
176         
177         /**
178          * Linphone core SIP transport ports.
179          * Use with {@link LinphoneCore#setSignalingTransportPorts(Transports)}
180          * @ingroup initializing
181          */
182         static public class Transports {
183                 /**
184                  * udp port to listening on, negative value if not set
185                  * */
186                 public int udp;
187                 /**
188                  * tcp port to listening on, negative value if not set
189                  * */
190                 public int tcp;
191                 /**
192                  * tls port to listening on, negative value if not set
193                  * */
194                 public int tls;
195                 
196                 public Transports() {};
197                 public Transports(Transports t) {
198                         this.udp = t.udp;
199                         this.tcp = t.tcp;
200                         this.tls = t.tls;
201                 }
202                 public String toString() {
203                         return "udp["+udp+"] tcp["+tcp+"] tls["+tls+"]";
204                 }
205         }
206         /**
207          * Media (RTP) encryption enum-like.
208          *
209          */
210         static public final class MediaEncryption {
211                 
212                 static private Vector<MediaEncryption> values = new Vector<MediaEncryption>();
213                 /**
214                  * None
215                  */
216                 static public final MediaEncryption None = new MediaEncryption(0,"None");       
217                 /**
218                  * SRTP
219                  */
220                 static public final MediaEncryption SRTP = new MediaEncryption(1,"SRTP");
221                 /**
222                  * ZRTP
223                  */
224                 static public final MediaEncryption ZRTP = new MediaEncryption(2,"ZRTP");
225                 protected final int mValue;
226                 private final String mStringValue;
227
228                 
229                 private MediaEncryption(int value,String stringValue) {
230                         mValue = value;
231                         values.addElement(this);
232                         mStringValue=stringValue;
233                 }
234                 public static MediaEncryption fromInt(int value) {
235
236                         for (int i=0; i<values.size();i++) {
237                                 MediaEncryption menc = (MediaEncryption) values.elementAt(i);
238                                 if (menc.mValue == value) return menc;
239                         }
240                         throw new RuntimeException("MediaEncryption not found ["+value+"]");
241                 }
242                 public String toString() {
243                         return mStringValue;
244                 }
245         }
246         /**
247          *      EC Calibrator Status
248          */
249         static public class EcCalibratorStatus {
250                 
251                 static private Vector<EcCalibratorStatus> values = new Vector<EcCalibratorStatus>();
252                 /* Do not change the values of these constants or the strings associated with them to prevent breaking
253                    the collection of echo canceller calibration results during the wizard! */
254                 public static final int IN_PROGRESS_STATUS=0;
255                 public static final int DONE_STATUS=1;
256                 public static final int FAILED_STATUS=2;
257                 public static final int DONE_NO_ECHO_STATUS=3;
258                 /**
259                  * Calibration in progress
260                  */
261                 static public EcCalibratorStatus InProgress = new EcCalibratorStatus(IN_PROGRESS_STATUS,"InProgress");
262                 /**
263                  * Calibration done that produced an echo delay measure
264                  */
265                 static public EcCalibratorStatus Done = new EcCalibratorStatus(DONE_STATUS,"Done");
266                 /**
267                  * Calibration failed
268                  */
269                 static public EcCalibratorStatus Failed = new EcCalibratorStatus(FAILED_STATUS,"Failed");
270                 /**
271                  * Calibration done with no echo detected
272                  */
273                 static public EcCalibratorStatus DoneNoEcho = new EcCalibratorStatus(DONE_NO_ECHO_STATUS, "DoneNoEcho");
274
275                 private final int mValue;
276                 private final String mStringValue;
277
278                 
279                 private EcCalibratorStatus(int value,String stringValue) {
280                         mValue = value;
281                         values.addElement(this);
282                         mStringValue=stringValue;
283                 }
284                 public static EcCalibratorStatus fromInt(int value) {
285
286                         for (int i=0; i<values.size();i++) {
287                                 EcCalibratorStatus status = (EcCalibratorStatus) values.elementAt(i);
288                                 if (status.mValue == value) return status;
289                         }
290                         throw new RuntimeException("status not found ["+value+"]");
291                 }
292                 public String toString() {
293                         return mStringValue;
294                 }
295                 public int value(){
296                         return mValue;
297                 }
298         }
299         
300         static public class UpnpState {
301                 static private Vector<UpnpState> values = new Vector<UpnpState>();
302                 /**
303                  * Idle 
304                  */
305                 static public UpnpState Idle = new UpnpState(0, "Idle");
306                 /**
307                  * Pending
308                  */
309                 static public UpnpState Pending = new UpnpState(1, "Pending");
310                 /**
311                  * Adding
312                  */
313                 static public UpnpState Adding = new UpnpState(2, "Adding");
314                 /**
315                  * Removing
316                  */
317                 static public UpnpState Removing = new UpnpState(3, "Removing");
318                 /**
319                  * Not Available
320                  */
321                 static public UpnpState NotAvailable = new UpnpState(4, "Not available");
322                 /**
323                  * Ok
324                  */
325                 static public UpnpState Ok = new UpnpState(5, "Ok");
326                 /**
327                  * Ko 
328                  */
329                 static public UpnpState Ko = new UpnpState(6, "Ko");
330                 protected final int mValue;
331                 private final String mStringValue;
332
333                 private UpnpState(int value, String stringValue) {
334                         mValue = value;
335                         values.addElement(this);
336                         mStringValue = stringValue;
337                 }
338                 public static UpnpState fromInt(int value) {
339                         for (int i = 0; i < values.size(); i++) {
340                                 UpnpState mstate = (UpnpState) values.elementAt(i);
341                                 if (mstate.mValue == value) return mstate;
342                         }
343                         throw new RuntimeException("UpnpState not found [" + value + "]");
344                 }
345                 public String toString() {
346                         return mStringValue;
347                 }
348         }
349
350         /**
351          * Set the context of creation of the LinphoneCore.
352          */
353         public void setContext(Object context);
354
355         /**
356          * clear all added proxy configs
357          */
358         public void clearProxyConfigs();
359         /**
360          * Add a proxy configuration. This will start registration on the proxy, if registration is enabled.
361          * @param proxyCfg
362          * @throws LinphoneCoreException
363          */
364         public void addProxyConfig(LinphoneProxyConfig proxyCfg) throws LinphoneCoreException;
365         /**
366          * Sets the default proxy.
367          *<br>
368          * This default proxy must be part of the list of already entered {@link LinphoneProxyConfig}. 
369          * Toggling it as default will make LinphoneCore use the identity associated with the proxy configuration in all incoming and outgoing calls.
370          * @param proxyCfg 
371          */
372         public void setDefaultProxyConfig(LinphoneProxyConfig proxyCfg);
373         
374         /**
375          * get he default proxy configuration, that is the one used to determine the current identity.
376          * @return null if no default proxy config 
377          */
378         public LinphoneProxyConfig getDefaultProxyConfig() ;
379         
380         /**
381          * clear all the added auth info
382          */
383         void clearAuthInfos();
384         /**
385          * Adds authentication information to the LinphoneCore.
386          * <br>This information will be used during all SIP transacations that require authentication.
387          * @param info
388          */
389         void addAuthInfo(LinphoneAuthInfo info);
390         
391         /**
392          * Build an address according to the current proxy config. In case destination is not a sip address, the default proxy domain is automatically appended
393          * @param destination
394          * @return
395          * @throws If no LinphoneAddress can be built from destination
396          */
397         public LinphoneAddress interpretUrl(String destination) throws LinphoneCoreException;
398         
399         /**
400          * Starts a call given a destination. Internally calls {@link #interpretUrl(String)} then {@link #invite(LinphoneAddress)}.
401          * @param uri
402          */
403         public LinphoneCall invite(String destination)throws LinphoneCoreException;
404         /**
405          * Initiates an outgoing call given a destination LinphoneAddress
406          *<br>The LinphoneAddress can be constructed directly using {@link LinphoneCoreFactory#createLinphoneAddress} , or created {@link LinphoneCore#interpretUrl(String)}. .
407          * @param to the destination of the call (sip address).
408          * @return linphone call
409          * @throws LinphoneCoreException if linphone call cannot be created
410          */
411         public LinphoneCall invite(LinphoneAddress to)throws LinphoneCoreException;
412         /**
413          * Terminates a call.
414          * @param aCall to be terminated
415          */
416         public void terminateCall(LinphoneCall aCall);
417         /**
418          * Declines an incoming call, providing a reason for declining it.
419          * @param call the LinphoneCall, must be in the {@link LinphoneCall.State#IncomingReceived} state.
420          * @param reason the reason for rejecting the call: {@link Reason#Declined}  or {@link Reason#Busy}
421          */
422         public void declineCall(LinphoneCall aCall, Reason reason);
423         /**
424          * Returns The LinphoneCall the current call if one is in call
425          *
426         **/
427         public LinphoneCall getCurrentCall(); 
428         
429         /**
430          * get current call remote address in case of in/out call
431          * @return null if no call engaged yet
432          */
433         public LinphoneAddress getRemoteAddress();
434         /**
435          *  
436          * @return  true if there is a call running or pending.
437          */
438         public boolean isIncall();
439         /**
440          * 
441          * @return Returns true if in incoming call is pending, ie waiting for being answered or declined.
442          */
443         public boolean isInComingInvitePending();
444         /**
445          * Main loop function. It is crucial that your application call it periodically.
446          *
447          *      #iterate() performs various backgrounds tasks:
448          * <li>receiving of SIP messages
449          * <li> handles timers and timeout
450          * <li> performs registration to proxies
451          * <li> authentication retries The application MUST call this function from periodically, in its main loop. 
452          * <br> Be careful that this function must be call from the same thread as other liblinphone methods. In not the case make sure all liblinphone calls are serialized with a mutex.
453
454          */
455         public void iterate();
456         /**
457          * Accept an incoming call.
458          *
459          * Basically the application is notified of incoming calls within the
460          * {@link LinphoneCoreListener#callState} listener method.
461          * The application can later respond positively to the call using
462          * this method.
463          * @throws LinphoneCoreException 
464          */
465         public void acceptCall(LinphoneCall aCall) throws LinphoneCoreException;
466         
467         /**
468          * Accept an incoming call.
469          *
470          * Basically the application is notified of incoming calls within the
471          * {@link LinphoneCoreListener#callState} listener method.
472          * The application can later respond positively to the call using
473          * this method.
474          * @throws LinphoneCoreException 
475          */
476         public void acceptCallWithParams(LinphoneCall aCall, LinphoneCallParams params) throws LinphoneCoreException;
477         
478         /**
479          * Accept call modifications initiated by other end.
480          *
481          * Basically the application is notified of incoming calls within the
482          * {@link LinphoneCoreListener#callState} listener method.
483          * The application can later respond positively to the call using
484          * this method.
485          * @throws LinphoneCoreException 
486          */
487         public void acceptCallUpdate(LinphoneCall aCall, LinphoneCallParams params) throws LinphoneCoreException;
488         
489         
490         /**
491          * Prevent LinphoneCore from performing an automatic answer
492          *
493          * Basically the application is notified of incoming calls within the
494          * {@link LinphoneCoreListener#callState} listener method.
495          * The application can later respond positively to the call using
496          * this method.
497          * @throws LinphoneCoreException 
498          */
499         public void deferCallUpdate(LinphoneCall aCall) throws LinphoneCoreException;
500
501         /**
502          * @return a list of LinphoneCallLog 
503          */
504         public LinphoneCallLog[] getCallLogs();
505         
506         /**
507          * This method is called by the application to notify the Linphone core library when network is reachable.
508          * Calling this method with true trigger Linphone to initiate a registration process for all proxy
509          * configuration with parameter register set to enable.
510          * This method disable the automatic registration mode. It means you must call this method after each network state changes
511          * @param network state  
512          *
513          */
514         public void setNetworkReachable(boolean isReachable);
515         /**
516          * Get network state has known by {@link LinphoneCore}
517          * @return if false, there is no network connection.
518          */
519         public boolean isNetworkReachable();
520         /**
521          * destroy linphone core and free all underlying resources
522          */
523         public void destroy();
524         /**
525          * Allow to control play level before entering  sound card:  
526          * @param level in db
527          */
528         public void setPlaybackGain(float gain);
529         /**
530          * get play level before entering  sound card:  
531          * @return level in db
532          */
533         public float getPlaybackGain();
534         /**
535          * set play level
536          * @param level [0..100]
537          */
538         public void setPlayLevel(int level);
539         /**
540          * get playback level [0..100];
541          * -1 if not cannot be determined
542          * @return
543          */
544         public int getPlayLevel();
545         /**
546          *  Mutes or unmutes the local microphone.
547          * @param isMuted
548          */
549         void muteMic(boolean isMuted);
550         /**
551          * 
552          * @return true is mic is muted
553          */
554         boolean isMicMuted();
555
556         /**
557          * Initiate a dtmf signal if in call
558          * @param send dtmf ['0'..'9'] | '#', '*'
559          */
560         void sendDtmf(char number);
561         /**
562          * Initiate a dtmf signal to the speaker if not in call.
563          * Sending of the DTMF is done in another function.
564          * @param dtmf ['0'..'9'] | '#', '*'
565          * @param duration in ms , -1 for unlimited
566          */
567         void playDtmf(char dtmf,int duration);
568         /**
569          * stop current dtmf
570          */
571         void stopDtmf();
572         
573         /**
574          * remove all call logs
575          */
576         void clearCallLogs();
577         
578         
579         
580         
581         /**
582          * Get payload type from mime type and clock rate
583          *
584          * This function searches in audio and video codecs for the given payload type name and clockrate.
585          * @param mime payload mime type (I.E SPEEX, PCMU, VP8)
586          * @param clockRate (I.E 8000, 16000, 90000, ...) 
587          * @param channels  number of channels
588          * @return Returns null if not found.
589          */     
590         PayloadType findPayloadType(String mime, int clockRate, int channels); 
591         /***
592          * get payload type  from mime type and clock rate..
593          * Same as @{link {@link #findPayloadType(String, int, int)} but ignoring channels params
594          * @param mime payload mime type (I.E SPEEX, PCMU, VP8)
595          * @param clockRate (I.E 8000, 16000, 90000, ...) 
596          * @return null if not found
597          */
598         PayloadType findPayloadType(String mime, int clockRate); 
599         
600         /***
601          * get payload type  from mime type 
602          * Same as @{link {@link #findPayloadType(String, int, int)} but ignoring channels and clock rate params
603          * @param mime payload mime type (I.E SPEEX, PCMU, VP8)
604          * @return null if not found
605          */
606         PayloadType findPayloadType(String mime); 
607         
608         /**
609          * Enable payload type
610          * @param pt payload type to enable, can be retrieve from {@link #findPayloadType}
611          * @param true if enabled
612          * @exception LinphoneCoreException
613          *
614          */
615         void enablePayloadType(PayloadType pt, boolean enable) throws LinphoneCoreException;
616         /**
617          * Enables or disable echo cancellation.
618          * @param enable
619          */
620         void enableEchoCancellation(boolean enable);
621         /**
622          * get EC status 
623          * @return true if echo cancellation is enabled.
624          */
625         boolean isEchoCancellationEnabled();
626         /**
627          * Get echo limiter status (another method of doing echo suppression, more brute force)
628          * @return true if echo limiter is enabled
629          */
630         boolean isEchoLimiterEnabled();
631         /**
632          * Set transport ports linphone core will listen on
633          * @param local transports ports used for signaling (TCP, UDP and TLS)
634          */
635         void setSignalingTransportPorts(Transports transports);
636         /**Get 
637          * @return transports used for signaling (TCP, UDP, TLS)
638          */
639         Transports getSignalingTransportPorts();
640         /**
641          * Activates or deactivates the speaker.
642          * @param value
643          */
644         void enableSpeaker(boolean value);
645         /**
646          * Tells whether the speaker is activated.
647          * @return true if speaker enabled, false otherwise
648          */
649         boolean isSpeakerEnabled();
650         /**
651          * add a friend to the current buddy list, if subscription attribute is set, a SIP SUBSCRIBE message is sent.
652          * @param lf LinphoenFriend to add
653          * @throws LinphoneCoreException
654          */
655         void addFriend(LinphoneFriend lf) throws LinphoneCoreException;
656
657         /**
658          * Set my presence status
659          * @param minute_away how long in away
660          * @param status sip uri used to redirect call in state LinphoneStatusMoved
661          */
662         void setPresenceInfo(int minute_away,String alternative_contact, OnlineStatus status);
663         /**
664          * Create a new chat room for messaging from a sip uri like sip:joe@sip.linphone.org
665          * @param to    destination address for messages 
666          *
667          * @return {@link LinphoneChatRoom} where messaging can take place.
668          */
669         LinphoneChatRoom createChatRoom(String to);
670         /**
671          * Set the native video window id where the video is to be displayed.
672          * On Android, it must be of type {@link AndroidVideoWindowImpl}
673          * @param video window of type {@link AndroidVideoWindowImpl}
674         **/
675         void setVideoWindow(Object w);
676         /**
677          * Set the native video window id where the video preview is to be displayed.
678          * On Android, it must of type {@link SurfaceView}
679          * @param video window of type {@link SurfaceView}
680         **/
681         void setPreviewWindow(Object w);
682         /**
683          * Tells the core the device current orientation. This can be used by capture filters
684          * on mobile devices to select between portrait/landscape mode and to produce properly
685          * oriented images. The exact meaning of the value in rotation if left to each device
686          * specific implementations.
687          *@param rotation . Android supported values are 0, 90, 180 and 270.
688          *
689         **/
690         void setDeviceRotation(int rotation);
691         /**
692          * Sets the active video device.
693          *
694          * @param id  of the video device as returned by {@link AndroidCameraConfiguration#retrieveCameras}
695         **/
696         void setVideoDevice(int id);
697         /**
698          * Returns the id of the currently active video device as found in {@link AndroidCameraConfiguration#retrieveCameras}.
699         **/
700         int getVideoDevice();
701         
702         /**
703          * Enables video globally.
704          *
705          * 
706          * This function does not have any effect during calls. It just indicates #LinphoneCore to
707          * initiate future calls with video or not. The two boolean parameters indicate in which
708          * direction video is enabled. Setting both to false disables video entirely.
709          *
710          * @param vcap_enabled indicates whether video capture is enabled
711          * @param display_enabled indicates whether video display should be shown
712          *
713         **/
714         void enableVideo(boolean vcap_enabled, boolean display_enabled);
715         /**
716          * Returns TRUE if video is enabled, FALSE otherwise.
717          *      
718          ***/
719         boolean isVideoEnabled();
720         
721         /**
722          * Specify a STUN server to help firewall traversal.
723          * @param stun_server Stun server address and port, such as stun.linphone.org or stun.linphone.org:3478
724          */
725         void setStunServer(String stun_server);
726         /**
727          * Get STUN server
728          * @return stun server address if previously set.
729          */
730         String getStunServer();
731         
732         /**
733          * Sets policy regarding workarounding NATs
734          * @param pol one of the FirewallPolicy members.
735         **/
736         void setFirewallPolicy(FirewallPolicy pol);
737         /**
738          * @return previously set firewall policy.
739          */
740         FirewallPolicy getFirewallPolicy();
741         /**
742          * Initiates an outgoing call given a destination LinphoneAddress
743          *
744          * @param addr the destination of the call {@link #LinphoneAddress }.
745          * @param params call parameters {@link #LinphoneCallParams }
746          *
747          *<br>The LinphoneAddress can be constructed directly using {@link LinphoneCoreFactory#createLinphoneAddress} , or created {@link LinphoneCore#interpretUrl(String)}. .
748          *
749          * @return a {@link #LinphoneCall LinphoneCall} object 
750          * @throws LinphoneCoreException  in case of failure
751         **/
752         LinphoneCall inviteAddressWithParams(LinphoneAddress destination, LinphoneCallParams params) throws LinphoneCoreException ;
753         /**
754          * Updates a running call according to supplied call parameters or parameters changed in the LinphoneCore.
755          *
756          * In this version this is limited to the following use cases:
757          * - setting up/down the video stream according to the video parameter of the {@link LinphoneCallParams} (see {@link LinphoneCallParams#enableVideo} ).
758          * - changing the size of the transmitted video after calling {@link LinphoneCore#setPreferredVideoSize(VideoSize)}
759          *
760          * In case no changes are requested through the {@link LinphoneCallParams} argument, then this argument can be omitted and set to null.
761          * @param call the {@link LinphoneCall} to be updated
762          * @param params the new  {@link  LinphoneCallParams call parameters} to use. (may be NULL)
763          * @return 0 if successful, -1 otherwise.
764         **/
765         int updateCall(LinphoneCall call, LinphoneCallParams params);
766         /**
767          * Get default call parameters reflecting current linphone core configuration
768          * @return  LinphoneCallParams
769          */
770         LinphoneCallParams createDefaultCallParameters();
771
772         /**
773          * Sets the path to a wav file used for ringing.
774          *
775          * @param path The file must be a wav 16bit linear. Local ring is disabled if null
776          */
777         void setRing(String path);
778         /**
779          * gets the path to a wav file used for ringing.
780          *
781          * @return null if not set
782          */
783         String getRing();
784         
785         /**
786          * Sets file or folder containing trusted root CAs
787          *
788          * @param path path to file with multiple PEM certif or to folder with multiple PEM files
789          */     
790         void setRootCA(String path);
791         
792         void setUploadBandwidth(int bw);
793         /**
794          * Sets maximum available download bandwidth
795          *
796          *
797          * This is IP bandwidth, in kbit/s.
798          * This information is used signaled to other parties during
799          * calls (within SDP messages) so that the remote end can have
800          * sufficient knowledge to properly configure its audio & video
801          * codec output bitrate to not overflow available bandwidth.
802          *
803          * @param bw the bandwidth in kbits/s, 0 for infinite
804          */
805         void setDownloadBandwidth(int bw);
806         
807         /**
808          * Sets audio packetization interval suggested for remote end.
809          * @param ptime packetization interval in milliseconds
810          */
811         void setDownloadPtime(int ptime);
812         
813         /**
814          * Sets audio packetization interval sent to remote end.
815          * @param ptime packetization interval in milliseconds
816          */
817         void setUploadPtime(int ptime);
818         /**
819          * Sets the preferred video size.
820          *
821          * This applies only to the stream that is captured and sent to the remote party,
822          * since we accept all standard video size on the receive path.
823          * @param vSize
824          * 
825         **/
826         void setPreferredVideoSize(VideoSize vSize);
827         /**
828          * get current preferred video size for sending.
829          * @return  video size
830          *
831         **/
832         VideoSize getPreferredVideoSize();
833         
834         /**
835          * Returns the currently supported audio codecs, as PayloadType elements
836          * @return
837          */
838         PayloadType[] getAudioCodecs();
839         /**
840          * Returns the currently supported video codecs, as PayloadType elements
841          * @return
842          */
843         PayloadType[] getVideoCodecs();
844         /**
845          * enable signaling keep alive. small udp packet sent periodically to keep udp NAT association
846          */
847         void enableKeepAlive(boolean enable);
848         /**
849          * get keep elive mode
850          * @return true if enable
851          */
852         boolean isKeepAliveEnabled();
853         /**
854          * Start an echo calibration of the sound devices, in order to find adequate settings for the echo canceler automatically.
855          * status is notified to {@link LinphoneCoreListener#ecCalibrationStatus(EcCalibratorStatus, int, Object)}
856          * @param User object
857          * @throws LinphoneCoreException if operation is still in progress;
858         **/
859         void startEchoCalibration(Object data) throws LinphoneCoreException;
860
861         /**
862          * Returns true if echo calibration is recommended.
863          * If the device has a builtin echo canceller or calibration value is already known, it will return false.
864          */
865         boolean needsEchoCalibration();
866         
867         void enableIpv6(boolean enable);
868         /**
869          * @deprecated
870          * @param i
871          */
872         void adjustSoftwareVolume(int i);
873         
874         /**
875          * Pauses a call. If a music file has been setup using {@link LinphoneCore#setPlayFile(String)},
876          * this file will be played to the remote user.
877          *
878         **/
879         boolean pauseCall(LinphoneCall call);
880         /**
881          * Resume a call.
882         **/
883         boolean resumeCall(LinphoneCall call);
884         /**
885          * Pause all currently running calls.
886         **/
887         boolean pauseAllCalls();
888         
889         void setZrtpSecretsCache(String file);
890         void enableEchoLimiter(boolean val);
891
892         /**
893          * Indicates whether the local user is part of the conference.
894         **/
895         boolean isInConference();
896         /**
897          * Moves the local participant inside the conference.
898          * 
899          * Makes the local participant to join the conference. 
900          * Typically, the local participant is by default always part of the conference when joining an active call into a conference.
901          * However, by calling {@link #leaveConference()} and {@link #enterConference()} the application can decide to temporarily
902          * move out and in the local participant from the conference.
903          * 
904          * @returns true if successful
905         **/
906         boolean enterConference();
907         /**
908          * Moves the local participant out of the conference.
909          * When the local participant is out of the conference, the remote participants can continue to talk normally.
910         **/
911         void leaveConference();
912
913         /**
914          * Merge a call into a conference.
915          * 
916          * If this is the first call that enters the conference, the virtual conference will be created automatically.
917          * If the local user was actively part of the call (ie not in paused state), then the local user is automatically entered into the conference.
918          * If the call was in paused state, then it is automatically resumed when entering into the conference.
919          * @param call an established call, either in {@link LinphoneCall.State#StreamsRunning} or {@link LinphoneCall.State#Paused} state.
920          * 
921         **/
922         void addToConference(LinphoneCall call);
923         /**
924          * Remove a call from the conference.
925          * @param call a call that has been previously merged into the conference.
926          * 
927          * After removing the remote participant belonging to the supplied call, the call becomes a normal call in paused state.
928          * If one single remote participant is left alone together with the local user in the conference after the removal, then the conference is
929          * automatically transformed into a simple call in StreamsRunning state.
930          * The conference's resources are then automatically destroyed.
931          * 
932          * In other words, unless {@link #leaveConference()} is explicitely called, the last remote participant of a conference is automatically
933          * put in a simple call in running state.
934          * 
935          **/
936         void removeFromConference(LinphoneCall call);
937         /**
938          * Add all calls into a conference.
939          * 
940          * Merge all established calls (either in {@link LinphoneCall.State#StreamsRunning} or {@link LinphoneCall.State#Paused}) into a conference.
941          * 
942         **/
943         void addAllToConference();
944         
945         /**
946          * Terminates the conference and the calls associated with it.
947          * 
948          * All the calls that were merged to the conference are terminated, and the conference resources are destroyed.
949          * 
950         **/
951         void terminateConference();
952         /**
953          * Returns the number of participants to the conference, including the local participant.
954          * 
955          * Typically, after merging two calls into the conference, there is total of 3 participants:
956          * the local participant (or local user), and two remote participants that were the destinations of the two previously establised calls.
957          * 
958          * @returns the number of participants to the conference
959         **/
960         int getConferenceSize();
961
962         /**
963          * Request recording of the conference into a supplied file path.
964          * The format is wav.
965          * @param path where to write recording file
966         **/
967         void startConferenceRecording(String path);
968         
969         /**
970          * Stop recording of the conference.
971         **/
972         void stopConferenceRecording();
973         /**
974          * Terminates all the calls.
975          */
976         void terminateAllCalls();
977         /**
978          * Returns all calls.
979          * @return an array with all call currently handle by Linphone core
980         **/
981         LinphoneCall[] getCalls();
982         /**
983          * Get number of calls currently handled by Linphone core
984          * @returns number of calls
985          * */
986         int getCallsNb();
987
988         /**
989          * Performs a simple call transfer to the specified destination.
990          *
991          * @param call The current local call remains active and thus can be later paused or terminated.
992          * @param  referTo The remote call party endpoint is expected to issue a new call to this specified destination.
993         **/
994         void transferCall(LinphoneCall call, String referTo);
995         /**
996          * Transfer a call to destination of another running call. This is used for "attended transfer" scenarios.
997          * The transfered call is supposed to be in paused state, so that it is able to accept the transfer immediately.
998          * The destination call is a call previously established to introduce the transfered person.
999          * This method will send a transfer request to the transfered person. The phone of the transfered is then
1000          * expected to automatically call to the destination of the transfer. The receiver of the transfer will then automatically
1001          * close the call with us (the 'dest' call).
1002          * @param call a running call you want to transfer
1003          * @param dest a running call whose remote person will receive the transfer
1004         **/
1005         void transferCallToAnother(LinphoneCall callToTransfer, LinphoneCall destination);
1006         /**
1007          * Search from the list of current calls if a remote address match uri
1008          * @param uri which should match call remote uri
1009          * @return LinphoneCall or NULL is no match is found
1010          */
1011         LinphoneCall findCallFromUri(String uri);
1012         /**
1013          * Get the maximum number of simultaneous calls Linphone core can manage at a time. All new call above this limit are declined with a busy answer
1014          * @return max number of simultaneous calls
1015          */
1016         int getMaxCalls();
1017         /**
1018          * Set the maximum number of simultaneous calls Linphone core can manage at a time. All new call above this limit are declined with a busy answer
1019          * @param max number of simultaneous calls
1020          */
1021         void setMaxCalls(int max);
1022         /**
1023          * @deprecated
1024          * @param uri
1025          * @return
1026          */
1027         boolean isMyself(String uri);
1028
1029         /**
1030          * Use this method to check the calls state and forbid proposing actions
1031          * which could result in an active call.
1032          * Eg: don't start a new call if one is in outgoing ringing.
1033          * Eg: don't merge to conference either as it could result
1034          *     in two active calls (conference and accepted call). 
1035          * @return
1036          */
1037         boolean soundResourcesLocked();
1038         /**
1039          * Returns whether given media encryption is supported by liblinphone.
1040          */
1041         boolean mediaEncryptionSupported(MediaEncryption menc);
1042         /**
1043          * set media encryption (rtp) to use
1044          * @params menc: MediaEncryption.None, MediaEncryption.SRTP or MediaEncryption.ZRTP
1045          */
1046         void setMediaEncryption(MediaEncryption menc);
1047         /**
1048          * return selected media encryption
1049          * @return MediaEncryption.None, MediaEncryption.SRTP or MediaEncryption.ZRTP
1050          */
1051         MediaEncryption getMediaEncryption();
1052 /**
1053          * Set media encryption required for outgoing calls
1054          */
1055         void setMediaEncryptionMandatory(boolean yesno);
1056         /**
1057          * @return if media encryption is required for outgoing calls
1058          */
1059         boolean isMediaEncryptionMandatory();
1060
1061         /**
1062          * @param path path to music file played to remote side when on hold.
1063          */
1064         void setPlayFile(String path);
1065         void tunnelEnable(boolean enable);
1066         void tunnelAutoDetect();
1067         void tunnelCleanServers();
1068         void tunnelSetHttpProxy(String proxy_host, int port, String username, String password);
1069         /**
1070          * @param host tunnel server ip address
1071          * @param port tunnel server tls port, recommended value is 443
1072          * @param udpMirrorPort remote port on the tunnel server side  used to test udp reachability
1073          * @param roundTripDelay udp packet round trip delay in ms considered as acceptable. recommended value is 1000 ms
1074          */
1075         void tunnelAddServerAndMirror(String host, int port, int udpMirrorPort, int roundTripDelay);
1076
1077         boolean isTunnelAvailable();
1078         /**
1079          * Returns an unmodifiable list of entered proxy configurations.
1080          * @return list of proxy config
1081         **/
1082         LinphoneProxyConfig[] getProxyConfigList();
1083         /**
1084          * Sets the default policy for video.
1085          * This policy defines whether:
1086          * @param autoInitiate video shall be initiated by default for outgoing calls
1087          * @param autoAccept video shall be accepter by default for incoming calls
1088         **/
1089         void setVideoPolicy(boolean autoInitiate, boolean autoAccept);
1090         /** Set static picture to be used when "Static picture" is the video device 
1091          * @param path to the static picture file
1092          * */
1093         void setStaticPicture(String path);
1094         /**
1095          * Sets the user agent string used in SIP messages.
1096          * @param user agent name
1097          * @param user agent version
1098         **/
1099         void setUserAgent(String name, String version);
1100         /**
1101          * Set the number of cores used for media processing
1102          * */
1103         void setCpuCount(int count);
1104         
1105         /**
1106          * remove a call log
1107          */
1108         public void removeCallLog(LinphoneCallLog log);
1109         
1110         /**
1111          * @return count of missed calls
1112          */
1113         public int getMissedCallsCount();
1114         
1115         /**
1116          * Set missed calls count to zero
1117          */
1118         public void resetMissedCallsCount();
1119         /**
1120          * re-initiates registration if network is up.
1121          */
1122         public void refreshRegisters();
1123
1124         /**
1125          * return the version code of linphone core
1126          */
1127         public String getVersion();
1128         
1129         /**
1130          * remove a linphone friend from linphone core and linphonerc
1131          */
1132         void removeFriend(LinphoneFriend lf);
1133         
1134         /**
1135          * return a linphone friend (if exists) that matches the sip address
1136          */
1137         LinphoneFriend findFriendByAddress(String sipUri);
1138         
1139         /**
1140          * Sets the UDP port used for audio streaming.
1141         **/
1142         void setAudioPort(int port);
1143         
1144         /**
1145          * Sets the UDP port range from which to randomly select the port used for audio streaming.
1146          */
1147         void setAudioPortRange(int minPort, int maxPort);
1148         
1149         /**
1150          * Sets the UDP port used for video streaming.
1151         **/
1152         void setVideoPort(int port);
1153         
1154         /**
1155          * Sets the UDP port range from which to randomly select the port used for video streaming.
1156          */
1157         void setVideoPortRange(int minPort, int maxPort);
1158         
1159         /**
1160          * Set the incoming call timeout in seconds.
1161          * If an incoming call isn't answered for this timeout period, it is
1162          * automatically declined.
1163         **/
1164         void setIncomingTimeout(int timeout);
1165         
1166         /**
1167          * Set the call timeout in seconds.
1168          * Once this time is elapsed (ringing included), the call is automatically hung up.
1169         **/
1170         void setInCallTimeout(int timeout);
1171         /**
1172          * Allow to control microphone level:  
1173          * @param gain in db
1174         **/
1175         void setMicrophoneGain(float gain);
1176         
1177         /**
1178          * Set username and display name to use if no LinphoneProxyConfig configured
1179          */
1180         void setPrimaryContact(String displayName, String username);
1181         
1182         /**
1183          * Enable/Disable the use of SIP INFO for DTMFs
1184          */
1185         void setUseSipInfoForDtmfs(boolean use);
1186         
1187         /**
1188          * Enable/Disable the use of inband DTMFs
1189          */
1190         void setUseRfc2833ForDtmfs(boolean use);
1191
1192         /**
1193          * @return returns LpConfig object to read/write to the config file: usefull if you wish to extend
1194          * the config file with your own sections
1195          */
1196         LpConfig getConfig();
1197
1198
1199         /**
1200          * Return the availability of uPnP.
1201          *
1202          * @return true if uPnP is available otherwise return false. 
1203          */
1204         public boolean upnpAvailable();
1205
1206         /**
1207          * Return the internal state of uPnP. 
1208          *
1209          * @return an UpnpState. 
1210          */
1211         public UpnpState getUpnpState();
1212
1213         /**
1214          * Return the external ip address of router. 
1215          * In some cases the uPnP can have an external ip address but not a usable uPnP
1216          * (state different of Ok). 
1217          *
1218          * @return a null terminated string containing the external ip address. If the
1219          * the external ip address is not available return null. 
1220          */
1221         public String getUpnpExternalIpaddress();
1222
1223 }