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