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