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