]> sjero.net Git - linphone/blob - coreapi/linphonecore.h
fix warning
[linphone] / coreapi / linphonecore.h
1 /*
2 linphone
3 Copyright (C) 2000 - 2010 Simon MORLAT (simon.morlat@linphone.org)
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 #ifndef LINPHONECORE_H
20 #define LINPHONECORE_H
21
22 #include "ortp/ortp.h"
23 #include "ortp/payloadtype.h"
24 #include "mediastreamer2/mscommon.h"
25 #include "mediastreamer2/msvideo.h"
26
27 #ifdef IN_LINPHONE
28 #include "sipsetup.h"
29 #else
30 #include "linphone/sipsetup.h"
31 #endif
32
33 #define LINPHONE_IPADDR_SIZE 64
34 #define LINPHONE_HOSTNAME_SIZE 128
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 struct _MSSndCard;
41 struct _LinphoneCore;
42 struct SalOp;
43
44 struct _LpConfig;
45
46
47 struct _LCSipTransports{
48         int udp_port;
49         int tcp_port;
50         int dtls_port;
51         int tls_port;
52 };
53
54 typedef struct _LCSipTransports LCSipTransports;
55
56 /**
57  * Object that represents a SIP address.
58  *
59  * The LinphoneAddress is an opaque object to represents SIP addresses, ie
60  * the content of SIP's 'from' and 'to' headers.
61  * A SIP address is made of display name, username, domain name, port, and various
62  * uri headers (such as tags). It looks like 'Alice <sip:alice@example.net>'.
63  * The LinphoneAddress has methods to extract and manipulate all parts of the address.
64  * When some part of the address (for example the username) is empty, the accessor methods
65  * return NULL.
66  * 
67  * @ingroup linphone_address
68  * @var LinphoneAddress
69  */
70 typedef struct SalAddress LinphoneAddress;
71
72 LinphoneAddress * linphone_address_new(const char *uri);
73 LinphoneAddress * linphone_address_clone(const LinphoneAddress *uri);
74 const char *linphone_address_get_scheme(const LinphoneAddress *u);
75 const char *linphone_address_get_display_name(const LinphoneAddress* u);
76 const char *linphone_address_get_username(const LinphoneAddress *u);
77 const char *linphone_address_get_domain(const LinphoneAddress *u);
78 /**
79  * Get port number as an integer value.
80  *
81  */
82 int linphone_address_get_port_int(const LinphoneAddress *u);
83 /**
84  * Get port number, null if not present.
85  */
86 const char* linphone_address_get_port(const LinphoneAddress *u);
87 void linphone_address_set_display_name(LinphoneAddress *u, const char *display_name);
88 void linphone_address_set_username(LinphoneAddress *uri, const char *username);
89 void linphone_address_set_domain(LinphoneAddress *uri, const char *host);
90 void linphone_address_set_port(LinphoneAddress *uri, const char *port);
91 void linphone_address_set_port_int(LinphoneAddress *uri, int port);
92 /*remove tags, params etc... so that it is displayable to the user*/
93 void linphone_address_clean(LinphoneAddress *uri);
94 char *linphone_address_as_string(const LinphoneAddress *u);
95 char *linphone_address_as_string_uri_only(const LinphoneAddress *u);
96 void linphone_address_destroy(LinphoneAddress *u);
97
98 struct _SipSetupContext;
99
100
101 /**
102  * Enum representing the direction of a call.
103  * @ingroup call_logs
104 **/
105 enum _LinphoneCallDir {
106         LinphoneCallOutgoing, /**< outgoing calls*/
107         LinphoneCallIncoming  /**< incoming calls*/
108 };
109
110 /**
111  * Typedef for enum
112  * @ingroup call_logs
113 **/
114 typedef enum _LinphoneCallDir LinphoneCallDir;
115
116 /**
117  * Enum representing the status of a call
118  * @ingroup call_logs
119 **/
120 typedef enum _LinphoneCallStatus { 
121         LinphoneCallSuccess, /**< The call was sucessful*/
122         LinphoneCallAborted, /**< The call was aborted */
123         LinphoneCallMissed /**< The call was missed (unanswered)*/
124 } LinphoneCallStatus;
125
126 /**
127  * Structure representing a call log.
128  *
129  * @ingroup call_logs
130  * 
131 **/
132 typedef struct _LinphoneCallLog{
133         LinphoneCallDir dir; /**< The direction of the call*/
134         LinphoneCallStatus status; /**< The status of the call*/
135         LinphoneAddress *from; /**<Originator of the call as a LinphoneAddress object*/
136         LinphoneAddress *to; /**<Destination of the call as a LinphoneAddress object*/
137         char start_date[128]; /**<Human readable string containg the start date*/
138         int duration; /**<Duration of the call in seconds*/
139         char *refkey;
140         void *user_pointer;
141         rtp_stats_t local_stats;
142         rtp_stats_t remote_stats;
143         struct _LinphoneCore *lc;
144 } LinphoneCallLog;
145
146
147
148 /*public: */
149 void linphone_call_log_set_user_pointer(LinphoneCallLog *cl, void *up);
150 void *linphone_call_log_get_user_pointer(const LinphoneCallLog *cl);
151 void linphone_call_log_set_ref_key(LinphoneCallLog *cl, const char *refkey);
152 const char *linphone_call_log_get_ref_key(const LinphoneCallLog *cl);
153 const rtp_stats_t *linphone_call_log_get_local_stats(const LinphoneCallLog *cl);
154 const rtp_stats_t *linphone_call_log_get_remote_stats(const LinphoneCallLog *cl);
155 char * linphone_call_log_to_str(LinphoneCallLog *cl);
156
157
158 /**
159  * The LinphoneCall object represents a call issued or received by the LinphoneCore
160 **/
161 struct _LinphoneCall;
162 typedef struct _LinphoneCall LinphoneCall;
163
164 typedef enum _LinphoneCallState{
165         LinphoneCallIdle,
166         LinphoneCallIncomingReceived,
167         LinphoneCallOutgoingInit,
168         LinphoneCallOutgoingProgress,
169         LinphoneCallOutgoingRinging,
170         LinphoneCallOutgoingEarlyMedia,
171         LinphoneCallConnected,
172         LinphoneCallStreamsRunning,
173         LinphoneCallPausing,
174         LinphoneCallPaused,
175         LinphoneCallResuming,
176         LinphoneCallRefered,
177         LinphoneCallError,
178         LinphoneCallEnd,
179         LinphoneCallPausedByRemote
180 } LinphoneCallState;
181
182 const char *linphone_call_state_to_string(LinphoneCallState cs);
183
184
185 LinphoneCallState linphone_call_get_state(const LinphoneCall *call);
186 bool_t linphone_call_asked_to_autoanswer(LinphoneCall *call);
187 const LinphoneAddress * linphone_core_get_current_call_remote_address(struct _LinphoneCore *lc);
188 const LinphoneAddress * linphone_call_get_remote_address(const LinphoneCall *call);
189 char *linphone_call_get_remote_address_as_string(const LinphoneCall *call);
190 LinphoneCallDir linphone_call_get_dir(const LinphoneCall *call);
191 void linphone_call_ref(LinphoneCall *call);
192 void linphone_call_unref(LinphoneCall *call);
193 LinphoneCallLog *linphone_call_get_call_log(const LinphoneCall *call);
194 const char *linphone_call_get_refer_to(const LinphoneCall *call);
195 bool_t linphone_call_has_transfer_pending(const LinphoneCall *call);
196 int linphone_call_get_duration(const LinphoneCall *call);
197 void *linphone_call_get_user_pointer(LinphoneCall *call);
198 void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer);
199
200 typedef enum{
201         LinphoneSPWait,
202         LinphoneSPDeny,
203         LinphoneSPAccept
204 }LinphoneSubscribePolicy;
205
206 typedef enum _LinphoneOnlineStatus{
207         LinphoneStatusOffline,
208         LinphoneStatusOnline,
209         LinphoneStatusBusy,
210         LinphoneStatusBeRightBack,
211         LinphoneStatusAway,
212         LinphoneStatusOnThePhone,
213         LinphoneStatusOutToLunch,
214         LinphoneStatusDoNotDisturb,
215         LinphoneStatusMoved,
216         LinphoneStatusAltService,
217         LinphoneStatusPending,
218         LinphoneStatusEnd
219 }LinphoneOnlineStatus;
220
221 const char *linphone_online_status_to_string(LinphoneOnlineStatus ss);
222
223 struct _LinphoneFriend;
224
225 typedef struct _LinphoneFriend LinphoneFriend;
226
227 LinphoneFriend * linphone_friend_new();
228 LinphoneFriend *linphone_friend_new_with_addr(const char *addr);
229 int linphone_friend_set_sip_addr(LinphoneFriend *fr, const char *uri);
230 int linphone_friend_set_name(LinphoneFriend *fr, const char *name);
231 int linphone_friend_send_subscribe(LinphoneFriend *fr, bool_t val);
232 int linphone_friend_set_inc_subscribe_policy(LinphoneFriend *fr, LinphoneSubscribePolicy pol);
233 void linphone_friend_edit(LinphoneFriend *fr);
234 void linphone_friend_done(LinphoneFriend *fr);
235 void linphone_friend_destroy(LinphoneFriend *lf);
236 const LinphoneAddress *linphone_friend_get_address(const LinphoneFriend *lf);
237 bool_t linphone_friend_get_send_subscribe(const LinphoneFriend *lf);
238 LinphoneSubscribePolicy linphone_friend_get_inc_subscribe_policy(const LinphoneFriend *lf);
239 LinphoneOnlineStatus linphone_friend_get_status(const LinphoneFriend *lf);
240 BuddyInfo * linphone_friend_get_info(const LinphoneFriend *lf);
241 void linphone_friend_set_ref_key(LinphoneFriend *lf, const char *key);
242 const char *linphone_friend_get_ref_key(const LinphoneFriend *lf);
243 bool_t linphone_friend_in_list(const LinphoneFriend *lf);
244
245 #define linphone_friend_url(lf) ((lf)->url)
246
247
248 /**
249  * @addtogroup proxies
250  * @{
251 **/
252 /**
253  * The LinphoneProxyConfig object represents a proxy configuration to be used
254  * by the LinphoneCore object.
255  * Its fields must not be used directly in favour of the accessors methods.
256  * Once created and filled properly the LinphoneProxyConfig can be given to
257  * LinphoneCore with linphone_core_add_proxy_config().
258  * This will automatically triggers the registration, if enabled.
259  *
260  * The proxy configuration are persistent to restarts because they are saved
261  * in the configuration file. As a consequence, after linphone_core_new() there
262  * might already be a list of configured proxy that can be examined with
263  * linphone_core_get_proxy_config_list().
264  *
265  * The default proxy (see linphone_core_set_default_proxy() ) is the one of the list
266  * that is used by default for calls.
267 **/
268 typedef struct _LinphoneProxyConfig LinphoneProxyConfig;
269
270 /**
271  * LinphoneRegistrationState describes proxy registration states.
272 **/
273 typedef enum _LinphoneRegistrationState{
274         LinphoneRegistrationNone,
275         LinphoneRegistrationProgress,
276         LinphoneRegistrationOk,
277         LinphoneRegistrationCleared,
278         LinphoneRegistrationFailed
279 }LinphoneRegistrationState;
280
281 const char *linphone_registration_state_to_string(LinphoneRegistrationState cs);
282
283 LinphoneProxyConfig *linphone_proxy_config_new(void);
284 int linphone_proxy_config_set_server_addr(LinphoneProxyConfig *obj, const char *server_addr);
285 int linphone_proxy_config_set_identity(LinphoneProxyConfig *obj, const char *identity);
286 int linphone_proxy_config_set_route(LinphoneProxyConfig *obj, const char *route);
287 void linphone_proxy_config_expires(LinphoneProxyConfig *obj, int expires);
288 void linphone_proxy_config_enable_register(LinphoneProxyConfig *obj, bool_t val);
289 #define linphone_proxy_config_enableregister linphone_proxy_config_enable_register
290 void linphone_proxy_config_edit(LinphoneProxyConfig *obj);
291 int linphone_proxy_config_done(LinphoneProxyConfig *obj);
292 void linphone_proxy_config_enable_publish(LinphoneProxyConfig *obj, bool_t val);
293 void linphone_proxy_config_set_dial_escape_plus(LinphoneProxyConfig *cfg, bool_t val);
294 void linphone_proxy_config_set_dial_prefix(LinphoneProxyConfig *cfg, const char *prefix);
295
296 LinphoneRegistrationState linphone_proxy_config_get_state(const LinphoneProxyConfig *obj);
297 bool_t linphone_proxy_config_is_registered(const LinphoneProxyConfig *obj);
298 const char *linphone_proxy_config_get_domain(const LinphoneProxyConfig *cfg);
299
300 const char *linphone_proxy_config_get_route(const LinphoneProxyConfig *obj);
301 const char *linphone_proxy_config_get_identity(const LinphoneProxyConfig *obj);
302 bool_t linphone_proxy_config_publish_enabled(const LinphoneProxyConfig *obj);
303 const char *linphone_proxy_config_get_addr(const LinphoneProxyConfig *obj);
304 int linphone_proxy_config_get_expires(const LinphoneProxyConfig *obj);
305 bool_t linphone_proxy_config_register_enabled(const LinphoneProxyConfig *obj);
306 struct _LinphoneCore * linphone_proxy_config_get_core(const LinphoneProxyConfig *obj);
307
308 bool_t linphone_proxy_config_get_dial_escape_plus(const LinphoneProxyConfig *cfg);
309 const char * linphone_proxy_config_get_dial_prefix(const LinphoneProxyConfig *cfg);
310
311 /* destruction is called automatically when removing the proxy config */
312 void linphone_proxy_config_destroy(LinphoneProxyConfig *cfg);
313 void linphone_proxy_config_set_sip_setup(LinphoneProxyConfig *cfg, const char *type);
314 SipSetupContext *linphone_proxy_config_get_sip_setup_context(LinphoneProxyConfig *cfg);
315 SipSetup *linphone_proxy_config_get_sip_setup(LinphoneProxyConfig *cfg);
316 /**
317  * normalize a human readable phone number into a basic string. 888-444-222 becomes 888444222
318  */
319 int linphone_proxy_config_normalize_number(LinphoneProxyConfig *proxy, const char *username, char *result, size_t result_len);
320 /*
321  *  attached a user data to a proxy config
322  */
323 void linphone_proxy_config_set_user_data(LinphoneProxyConfig *cr, void * ud);
324 /*
325  *  get user data to a proxy config. return null if any
326  */
327 void * linphone_proxy_config_get_user_data(LinphoneProxyConfig *cr);
328
329 /**
330  * @}
331 **/
332
333 typedef struct _LinphoneAccountCreator{
334         struct _LinphoneCore *lc;
335         struct _SipSetupContext *ssctx;
336         char *username;
337         char *password;
338         char *domain;
339         bool_t succeeded;
340 }LinphoneAccountCreator;
341
342 LinphoneAccountCreator *linphone_account_creator_new(struct _LinphoneCore *core, const char *type);
343 void linphone_account_creator_set_username(LinphoneAccountCreator *obj, const char *username);
344 void linphone_account_creator_set_password(LinphoneAccountCreator *obj, const char *password);
345 void linphone_account_creator_set_domain(LinphoneAccountCreator *obj, const char *domain);
346 const char * linphone_account_creator_get_username(LinphoneAccountCreator *obj);
347 const char * linphone_account_creator_get_domain(LinphoneAccountCreator *obj);
348 int linphone_account_creator_test_existence(LinphoneAccountCreator *obj);
349 LinphoneProxyConfig * linphone_account_creator_validate(LinphoneAccountCreator *obj);
350 void linphone_account_creator_destroy(LinphoneAccountCreator *obj);
351
352 struct _LinphoneAuthInfo;
353
354 /**
355  * @ingroup authentication
356  * Object holding authentication information.
357  *
358  * @note The object's fields should not be accessed directly. Prefer using
359  * the accessor methods.
360  *
361  * In most case, authentication information consists of a username and password.
362  * Sometimes, a userid is required by proxy, and realm can be useful to discriminate
363  * different SIP domains.
364  *
365  * Once created and filled, a LinphoneAuthInfo must be added to the LinphoneCore in
366  * order to become known and used automatically when needed. 
367  * Use linphone_core_add_auth_info() for that purpose.
368  *
369  * The LinphoneCore object can take the initiative to request authentication information
370  * when needed to the application through the auth_info_requested callback of the
371  * LinphoneCoreVTable structure.
372  *
373  * The application can respond to this information request later using 
374  * linphone_core_add_auth_info(). This will unblock all pending authentication 
375  * transactions and retry them with authentication headers.
376  *
377 **/
378 typedef struct _LinphoneAuthInfo LinphoneAuthInfo;
379
380 LinphoneAuthInfo *linphone_auth_info_new(const char *username, const char *userid,
381                 const char *passwd, const char *ha1,const char *realm);
382 void linphone_auth_info_set_passwd(LinphoneAuthInfo *info, const char *passwd);
383 void linphone_auth_info_set_username(LinphoneAuthInfo *info, const char *username);
384 void linphone_auth_info_set_userid(LinphoneAuthInfo *info, const char *userid);
385
386 const char *linphone_auth_info_get_username(const LinphoneAuthInfo *i);
387 const char *linphone_auth_info_get_passwd(const LinphoneAuthInfo *i);
388 const char *linphone_auth_info_get_userid(const LinphoneAuthInfo *i);
389
390 /* you don't need those function*/
391 void linphone_auth_info_destroy(LinphoneAuthInfo *info);
392 LinphoneAuthInfo * linphone_auth_info_new_from_config_file(struct _LpConfig *config, int pos);
393
394 struct _LinphoneChatRoom;
395 typedef struct _LinphoneChatRoom LinphoneChatRoom;
396
397 LinphoneChatRoom * linphone_core_create_chat_room(struct _LinphoneCore *lc, const char *to);
398 void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg);
399 void linphone_chat_room_destroy(LinphoneChatRoom *cr);
400 void linphone_chat_room_set_user_data(LinphoneChatRoom *cr, void * ud);
401 void * linphone_chat_room_get_user_data(LinphoneChatRoom *cr);
402
403 typedef enum _LinphoneGlobalState{
404         LinphoneGlobalOff,
405         LinphoneGlobalStartup,
406         LinphoneGlobalOn,
407         LinphoneGlobalShutdown
408 }LinphoneGlobalState;
409
410 const char *linphone_global_state_to_string(LinphoneGlobalState gs);
411
412 /**
413  * @addtogroup initializing
414  * @{
415 **/
416
417
418 /**Call state notification callback prototype*/
419 typedef void (*LinphoneGlobalStateCb)(struct _LinphoneCore *lc, LinphoneGlobalState gstate, const char *message);
420 /**Call state notification callback prototype*/
421 typedef void (*LinphoneCallStateCb)(struct _LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *message);
422 /**Registration state notification callback prototype*/
423 typedef void (*LinphoneRegistrationStateCb)(struct _LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const char *message);
424 /** Callback prototype */
425 typedef void (*ShowInterfaceCb)(struct _LinphoneCore *lc);
426 /** Callback prototype */
427 typedef void (*DisplayStatusCb)(struct _LinphoneCore *lc, const char *message);
428 /** Callback prototype */
429 typedef void (*DisplayMessageCb)(struct _LinphoneCore *lc, const char *message);
430 /** Callback prototype */
431 typedef void (*DisplayUrlCb)(struct _LinphoneCore *lc, const char *message, const char *url);
432 /** Callback prototype */
433 typedef void (*LinphoneCoreCbFunc)(struct _LinphoneCore *lc,void * user_data);
434 /** Callback prototype */
435 typedef void (*NotifyReceivedCb)(struct _LinphoneCore *lc, LinphoneCall *call, const char *from, const char *event);
436 /** Callback prototype */
437 typedef void (*NotifyPresenceReceivedCb)(struct _LinphoneCore *lc, LinphoneFriend * fid);
438 /** Callback prototype */
439 typedef void (*NewUnknownSubscriberCb)(struct _LinphoneCore *lc, LinphoneFriend *lf, const char *url);
440 /** Callback prototype */
441 typedef void (*AuthInfoRequested)(struct _LinphoneCore *lc, const char *realm, const char *username);
442 /** Callback prototype */
443 typedef void (*CallLogUpdated)(struct _LinphoneCore *lc, struct _LinphoneCallLog *newcl);
444 /** Callback prototype */
445 typedef void (*TextMessageReceived)(struct _LinphoneCore *lc, LinphoneChatRoom *room, const char *from, const char *message);
446 /** Callback prototype */
447 typedef void (*DtmfReceived)(struct _LinphoneCore* lc, LinphoneCall *call, int dtmf);
448 /** Callback prototype */
449 typedef void (*ReferReceived)(struct _LinphoneCore *lc, const char *refer_to);
450 /** Callback prototype */
451 typedef void (*BuddyInfoUpdated)(struct _LinphoneCore *lc, LinphoneFriend *lf);
452
453 /**
454  * This structure holds all callbacks that the application should implement.
455  *  None is mandatory.
456 **/
457 typedef struct _LinphoneVTable{
458         LinphoneGlobalStateCb global_state_changed; /**<Notifies globlal state changes*/
459         LinphoneRegistrationStateCb registration_state_changed;/**<Notifies registration state changes*/
460         LinphoneCallStateCb call_state_changed;/**<Notifies call state changes*/
461         NotifyPresenceReceivedCb notify_presence_recv; /**< Notify received presence events*/
462         NewUnknownSubscriberCb new_unknown_subscriber; /**< Notify about unknown subscriber */
463         AuthInfoRequested auth_info_requested; /**< Ask the application some authentication information */
464         CallLogUpdated call_log_updated; /**< Notifies that call log list has been updated */
465         TextMessageReceived text_received; /**< A text message has been received */
466         DtmfReceived dtmf_received; /**< A dtmf has been received received */
467         ReferReceived refer_received; /**< An out of call refer was received */
468         BuddyInfoUpdated buddy_info_updated; /**< a LinphoneFriend's BuddyInfo has changed*/
469         NotifyReceivedCb notify_recv; /**< Other notifications*/
470         DisplayStatusCb display_status; /**< Callback that notifies various events with human readable text.*/
471         DisplayMessageCb display_message;/**< Callback to display a message to the user */
472         DisplayMessageCb display_warning;/** Callback to display a warning to the user */
473         DisplayUrlCb display_url;
474         ShowInterfaceCb show; /**< Notifies the application that it should show up*/
475 } LinphoneCoreVTable;
476
477 /**
478  * @}
479 **/
480
481 typedef struct _LCCallbackObj
482 {
483   LinphoneCoreCbFunc _func;
484   void * _user_data;
485 }LCCallbackObj;
486
487
488
489 typedef enum _LinphoneFirewallPolicy{
490         LinphonePolicyNoFirewall,
491         LinphonePolicyUseNatAddress,
492         LinphonePolicyUseStun
493 } LinphoneFirewallPolicy;
494
495 typedef enum _LinphoneWaitingState{
496         LinphoneWaitingStart,
497         LinphoneWaitingProgress,
498         LinphoneWaitingFinished
499 } LinphoneWaitingState;
500 typedef void * (*LinphoneWaitingCallback)(struct _LinphoneCore *lc, void *context, LinphoneWaitingState ws, const char *purpose, float progress);
501
502 typedef struct _LinphoneCore LinphoneCore;
503
504 /* THE main API */
505
506 void linphone_core_enable_logs(FILE *file);
507 void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc);
508 void linphone_core_disable_logs(void);
509 /*sets the user-agent string in sip messages, must be set before linphone_core_new() or linphone_core_init() */
510 void linphone_core_set_user_agent(const char *ua_name, const char *version);
511 const char *linphone_core_get_version(void);
512
513 LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable,
514                                                 const char *config_path, const char *factory_config, void* userdata);
515
516 /* function to be periodically called in a main loop */
517 void linphone_core_iterate(LinphoneCore *lc);
518
519 LinphoneAddress * linphone_core_interpret_url(LinphoneCore *lc, const char *url);
520
521 LinphoneCall * linphone_core_invite(LinphoneCore *lc, const char *url);
522
523 LinphoneCall * linphone_core_invite_address(LinphoneCore *lc, const LinphoneAddress *addr);
524
525 int linphone_core_transfer_call(LinphoneCore *lc, LinphoneCall *call, const char *refer_to);
526
527 bool_t linphone_core_inc_invite_pending(LinphoneCore*lc);
528
529 bool_t linphone_core_in_call(const LinphoneCore *lc);
530
531 LinphoneCall *linphone_core_get_current_call(const LinphoneCore *lc);
532
533 int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call);
534
535 int linphone_core_terminate_call(LinphoneCore *lc, LinphoneCall *call);
536
537 int linphone_core_terminate_all_calls(LinphoneCore *lc);
538
539 int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call);
540
541 int linphone_core_pause_all_calls(LinphoneCore *lc);
542
543 int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *call);
544
545 LinphoneCall *linphone_core_get_call_by_remote_address(LinphoneCore *lc, const char *remote_address);
546
547 void linphone_core_send_dtmf(LinphoneCore *lc,char dtmf);
548
549 int linphone_core_set_primary_contact(LinphoneCore *lc, const char *contact);
550
551 const char *linphone_core_get_primary_contact(LinphoneCore *lc);
552
553 void linphone_core_set_guess_hostname(LinphoneCore *lc, bool_t val);
554 bool_t linphone_core_get_guess_hostname(LinphoneCore *lc);
555
556 bool_t linphone_core_ipv6_enabled(LinphoneCore *lc);
557 void linphone_core_enable_ipv6(LinphoneCore *lc, bool_t val);
558
559 LinphoneAddress *linphone_core_get_primary_contact_parsed(LinphoneCore *lc);
560 const char * linphone_core_get_identity(LinphoneCore *lc);
561 /*0= no bandwidth limit*/
562 void linphone_core_set_download_bandwidth(LinphoneCore *lc, int bw);
563 void linphone_core_set_upload_bandwidth(LinphoneCore *lc, int bw);
564
565 int linphone_core_get_download_bandwidth(const LinphoneCore *lc);
566 int linphone_core_get_upload_bandwidth(const LinphoneCore *lc);
567 /**
568  * set audio packetization time linphone expect to received from peer
569  * @ingroup media_parameters
570  *
571  */
572 void linphone_core_set_download_ptime(LinphoneCore *lc, int ptime);
573 /**
574  * get audio packetization time linphone expect to received from peer, 0 means unspecified
575  * @ingroup media_parameters
576  */
577 int  linphone_core_get_download_ptime(LinphoneCore *lc);
578
579 /* returns a MSList of PayloadType */
580 const MSList *linphone_core_get_audio_codecs(const LinphoneCore *lc);
581
582 int linphone_core_set_audio_codecs(LinphoneCore *lc, MSList *codecs);
583 /* returns a MSList of PayloadType */
584 const MSList *linphone_core_get_video_codecs(const LinphoneCore *lc);
585
586 int linphone_core_set_video_codecs(LinphoneCore *lc, MSList *codecs);
587
588 bool_t linphone_core_payload_type_enabled(LinphoneCore *lc, PayloadType *pt);
589
590 int linphone_core_enable_payload_type(LinphoneCore *lc, PayloadType *pt, bool_t enable);
591
592 PayloadType* linphone_core_find_payload_type(LinphoneCore* lc, const char* type, int rate) ;
593
594 const char *linphone_core_get_payload_type_description(LinphoneCore *lc, PayloadType *pt);
595
596 bool_t linphone_core_check_payload_type_usability(LinphoneCore *lc, PayloadType *pt);
597
598 int linphone_core_add_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *config);
599
600 void linphone_core_clear_proxy_config(LinphoneCore *lc);
601
602 void linphone_core_remove_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *config);
603
604 const MSList *linphone_core_get_proxy_config_list(const LinphoneCore *lc);
605
606 void linphone_core_set_default_proxy(LinphoneCore *lc, LinphoneProxyConfig *config);
607
608 void linphone_core_set_default_proxy_index(LinphoneCore *lc, int index);
609
610 int linphone_core_get_default_proxy(LinphoneCore *lc, LinphoneProxyConfig **config);
611
612 void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info);
613
614 void linphone_core_remove_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info);
615
616 const MSList *linphone_core_get_auth_info_list(const LinphoneCore *lc);
617
618 const LinphoneAuthInfo *linphone_core_find_auth_info(LinphoneCore *lc, const char *realm, const char *username);
619
620 void linphone_core_abort_authentication(LinphoneCore *lc,  LinphoneAuthInfo *info);
621
622 void linphone_core_clear_all_auth_info(LinphoneCore *lc);
623
624 int linphone_core_get_audio_jittcomp(LinphoneCore *lc);
625
626 void linphone_core_set_audio_jittcomp(LinphoneCore *lc, int value);
627
628 int linphone_core_get_audio_port(const LinphoneCore *lc);
629
630 int linphone_core_get_video_port(const LinphoneCore *lc);
631
632 int linphone_core_get_nortp_timeout(const LinphoneCore *lc);
633
634 void linphone_core_set_audio_port(LinphoneCore *lc, int port);
635
636 void linphone_core_set_video_port(LinphoneCore *lc, int port);
637
638 void linphone_core_set_nortp_timeout(LinphoneCore *lc, int port);
639
640 void linphone_core_set_use_info_for_dtmf(LinphoneCore *lc, bool_t use_info);
641
642 bool_t linphone_core_get_use_info_for_dtmf(LinphoneCore *lc);
643
644 void linphone_core_set_use_rfc2833_for_dtmf(LinphoneCore *lc,bool_t use_rfc2833);
645
646 bool_t linphone_core_get_use_rfc2833_for_dtmf(LinphoneCore *lc);
647
648 void linphone_core_set_sip_port(LinphoneCore *lc, int port);
649
650 int linphone_core_get_sip_port(LinphoneCore *lc);
651
652 int linphone_core_set_sip_transports(LinphoneCore *lc, const LCSipTransports *transports);
653
654 int linphone_core_get_sip_transports(LinphoneCore *lc, LCSipTransports *transports);
655
656 ortp_socket_t linphone_core_get_sip_socket(LinphoneCore *lc);
657
658 void linphone_core_set_inc_timeout(LinphoneCore *lc, int seconds);
659
660 int linphone_core_get_inc_timeout(LinphoneCore *lc);
661
662 void linphone_core_set_stun_server(LinphoneCore *lc, const char *server);
663
664 const char * linphone_core_get_stun_server(const LinphoneCore *lc);
665
666 void linphone_core_set_nat_address(LinphoneCore *lc, const char *addr);
667
668 const char *linphone_core_get_nat_address(const LinphoneCore *lc);
669
670 void linphone_core_set_firewall_policy(LinphoneCore *lc, LinphoneFirewallPolicy pol);
671
672 LinphoneFirewallPolicy linphone_core_get_firewall_policy(const LinphoneCore *lc);
673
674 const char * linphone_core_get_relay_addr(const LinphoneCore *lc);
675
676 int linphone_core_set_relay_addr(LinphoneCore *lc, const char *addr);
677
678 /* sound functions */
679 /* returns a null terminated static array of string describing the sound devices */ 
680 const char**  linphone_core_get_sound_devices(LinphoneCore *lc);
681 bool_t linphone_core_sound_device_can_capture(LinphoneCore *lc, const char *device);
682 bool_t linphone_core_sound_device_can_playback(LinphoneCore *lc, const char *device);
683 int linphone_core_get_ring_level(LinphoneCore *lc);
684 int linphone_core_get_play_level(LinphoneCore *lc);
685 int linphone_core_get_rec_level(LinphoneCore *lc);
686 void linphone_core_set_ring_level(LinphoneCore *lc, int level);
687 void linphone_core_set_play_level(LinphoneCore *lc, int level);
688
689 void linphone_core_set_playback_gain_db(LinphoneCore *lc, float level);
690
691 float linphone_core_get_playback_gain_db(LinphoneCore *lc);
692 void linphone_core_set_rec_level(LinphoneCore *lc, int level);
693 const char * linphone_core_get_ringer_device(LinphoneCore *lc);
694 const char * linphone_core_get_playback_device(LinphoneCore *lc);
695 const char * linphone_core_get_capture_device(LinphoneCore *lc);
696 int linphone_core_set_ringer_device(LinphoneCore *lc, const char * devid);
697 int linphone_core_set_playback_device(LinphoneCore *lc, const char * devid);
698 int linphone_core_set_capture_device(LinphoneCore *lc, const char * devid);
699 char linphone_core_get_sound_source(LinphoneCore *lc);
700 void linphone_core_set_sound_source(LinphoneCore *lc, char source);
701 void linphone_core_set_ring(LinphoneCore *lc, const char *path);
702 const char *linphone_core_get_ring(const LinphoneCore *lc);
703 void linphone_core_set_ringback(LinphoneCore *lc, const char *path);
704 const char * linphone_core_get_ringback(const LinphoneCore *lc);
705 int linphone_core_preview_ring(LinphoneCore *lc, const char *ring,LinphoneCoreCbFunc func,void * userdata);
706 void linphone_core_enable_echo_cancellation(LinphoneCore *lc, bool_t val);
707 bool_t linphone_core_echo_cancellation_enabled(LinphoneCore *lc);
708
709 void linphone_core_enable_echo_limiter(LinphoneCore *lc, bool_t val);
710 bool_t linphone_core_echo_limiter_enabled(const LinphoneCore *lc);
711
712 void linphone_core_enable_agc(LinphoneCore *lc, bool_t val);
713 bool_t linphone_core_agc_enabled(const LinphoneCore *lc);
714
715 void linphone_core_mute_mic(LinphoneCore *lc, bool_t muted);
716 /**
717  * return mic state.
718  *
719  * @ingroup media_parameters
720 **/
721 bool_t linphone_core_is_mic_muted(LinphoneCore *lc);
722
723 bool_t linphone_core_is_audio_muted(LinphoneCore *lc);
724 bool_t linphone_core_is_rtp_muted(LinphoneCore *lc);
725
726 bool_t linphone_core_get_rtp_no_xmit_on_audio_mute(const LinphoneCore *lc);
727 void linphone_core_set_rtp_no_xmit_on_audio_mute(LinphoneCore *lc, bool_t val);
728
729 void linphone_core_set_presence_info(LinphoneCore *lc,int minutes_away,const char *contact,LinphoneOnlineStatus os);
730
731 LinphoneOnlineStatus linphone_core_get_presence_info(const LinphoneCore *lc);
732
733 void linphone_core_interpret_friend_uri(LinphoneCore *lc, const char *uri, char **result);
734 void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *fr);
735 void linphone_core_remove_friend(LinphoneCore *lc, LinphoneFriend *fr);
736 void linphone_core_reject_subscriber(LinphoneCore *lc, LinphoneFriend *lf);
737 /* a list of LinphoneFriend */
738 const MSList * linphone_core_get_friend_list(const LinphoneCore *lc);
739 /* notify all friends that have subscribed */
740 void linphone_core_notify_all_friends(LinphoneCore *lc, LinphoneOnlineStatus os);
741 LinphoneFriend *linphone_core_get_friend_by_address(const LinphoneCore *lc, const char *addr);
742 LinphoneFriend *linphone_core_get_friend_by_ref_key(const LinphoneCore *lc, const char *key);
743
744 /* returns a list of LinphoneCallLog */
745 const MSList * linphone_core_get_call_logs(LinphoneCore *lc);
746 void linphone_core_clear_call_logs(LinphoneCore *lc);
747
748 /* video support */
749 void linphone_core_enable_video(LinphoneCore *lc, bool_t vcap_enabled, bool_t display_enabled);
750 bool_t linphone_core_video_enabled(LinphoneCore *lc);
751
752 typedef struct MSVideoSizeDef{
753         MSVideoSize vsize;
754         const char *name;
755 }MSVideoSizeDef;
756 /* returns a zero terminated table of MSVideoSizeDef*/
757 const MSVideoSizeDef *linphone_core_get_supported_video_sizes(LinphoneCore *lc);
758 void linphone_core_set_preferred_video_size(LinphoneCore *lc, MSVideoSize vsize);
759 MSVideoSize linphone_core_get_preferred_video_size(LinphoneCore *lc);
760 void linphone_core_set_preferred_video_size_by_name(LinphoneCore *lc, const char *name);
761
762 void linphone_core_enable_video_preview(LinphoneCore *lc, bool_t val);
763 bool_t linphone_core_video_preview_enabled(const LinphoneCore *lc);
764
765 void linphone_core_enable_self_view(LinphoneCore *lc, bool_t val);
766 bool_t linphone_core_self_view_enabled(const LinphoneCore *lc);
767
768
769 /* returns a null terminated static array of string describing the webcams */ 
770 const char**  linphone_core_get_video_devices(const LinphoneCore *lc);
771 int linphone_core_set_video_device(LinphoneCore *lc, const char *id);
772 const char *linphone_core_get_video_device(const LinphoneCore *lc);
773
774 /* Set static picture to be used when "Static picture" is the video device */
775 int linphone_core_set_static_picture(LinphoneCore *lc, const char *path);
776
777 /* Set and get frame rate for static picture */
778 int linphone_core_set_static_picture_fps(LinphoneCore *lc, float fps);
779 float linphone_core_get_static_picture_fps(LinphoneCore *lc);
780
781 /*function to be used for eventually setting window decorations (icons, title...)*/
782 unsigned long linphone_core_get_native_video_window_id(const LinphoneCore *lc);
783
784
785 /*play/record support: use files instead of soundcard*/
786 void linphone_core_use_files(LinphoneCore *lc, bool_t yesno);
787 void linphone_core_set_play_file(LinphoneCore *lc, const char *file);
788 void linphone_core_set_record_file(LinphoneCore *lc, const char *file);
789
790 void linphone_core_play_dtmf(LinphoneCore *lc, char dtmf, int duration_ms);
791 void linphone_core_stop_dtmf(LinphoneCore *lc);
792
793
794 int linphone_core_get_current_call_duration(const LinphoneCore *lc);
795
796
797 int linphone_core_get_mtu(const LinphoneCore *lc);
798 void linphone_core_set_mtu(LinphoneCore *lc, int mtu);
799
800 /**
801  * This method is called by the application to notify the linphone core library when network is reachable.
802  * Calling this method with true trigger linphone to initiate a registration process for all proxy
803  * configuration with parameter register set to enable.
804  * This method disable the automatic registration mode. It means you must call this method after each network state changes
805  *
806  */
807 void linphone_core_set_network_reachable(LinphoneCore* lc,bool_t value);
808 /**
809  * return network state either as positioned by the application or by linphone
810  */
811 bool_t linphone_core_is_network_reachabled(LinphoneCore* lc);
812
813
814 void *linphone_core_get_user_data(LinphoneCore *lc);
815
816 /* returns LpConfig object to read/write to the config file: usefull if you wish to extend
817 the config file with your own sections */
818 struct _LpConfig *linphone_core_get_config(LinphoneCore *lc);
819
820 /* attempts to wake up another linphone engine already running.
821 The "show" callback is called for the other linphone, causing gui to show up.
822 call_addr is an optional sip-uri to call immediately after waking up.
823 The method returns 0 if an already running linphone was found*/
824
825 int linphone_core_wake_up_possible_already_running_instance(
826     const char * config_file, const char * call_addr);
827
828 /*set a callback for some blocking operations, it takes you informed of the progress of the operation*/
829 void linphone_core_set_waiting_callback(LinphoneCore *lc, LinphoneWaitingCallback cb, void *user_context);
830
831 /*returns the list of registered SipSetup (linphonecore plugins) */
832 const MSList * linphone_core_get_sip_setups(LinphoneCore *lc);
833
834 void linphone_core_destroy(LinphoneCore *lc);
835
836 /*for advanced users:*/
837 void linphone_core_set_audio_transports(LinphoneCore *lc, RtpTransport *rtp, RtpTransport *rtcp);
838
839 int linphone_core_get_current_call_stats(LinphoneCore *lc, rtp_stats_t *local, rtp_stats_t *remote);
840
841 const MSList *linphone_core_get_calls(LinphoneCore *lc);
842
843 LinphoneGlobalState linphone_core_get_global_state(const LinphoneCore *lc);
844
845 #ifdef __cplusplus
846 }
847 #endif
848
849
850
851 #endif