3 Copyright (C) 2000 - 2010 Simon MORLAT (simon.morlat@linphone.org)
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.
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.
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.
19 #ifndef LINPHONECORE_H
20 #define LINPHONECORE_H
22 #include "ortp/ortp.h"
23 #include "ortp/payloadtype.h"
24 #include "mediastreamer2/mscommon.h"
25 #include "mediastreamer2/msvideo.h"
30 #include "linphone/sipsetup.h"
33 #define LINPHONE_IPADDR_SIZE 64
34 #define LINPHONE_HOSTNAME_SIZE 128
47 struct _LCSipTransports{
54 typedef struct _LCSipTransports LCSipTransports;
57 * Object that represents a SIP address.
59 * The LinphoneAddress is an opaque object to represents SIP addresses, ie
60 * the content of SIP's 'from' and 'to' headers.
61 * A SIP address is made of display name, username, domain name, port, and various
62 * uri headers (such as tags). It looks like 'Alice <sip:alice@example.net>'.
63 * The LinphoneAddress has methods to extract and manipulate all parts of the address.
64 * When some part of the address (for example the username) is empty, the accessor methods
67 * @ingroup linphone_address
68 * @var LinphoneAddress
70 typedef struct SalAddress LinphoneAddress;
72 LinphoneAddress * linphone_address_new(const char *uri);
73 LinphoneAddress * linphone_address_clone(const LinphoneAddress *uri);
74 const char *linphone_address_get_scheme(const LinphoneAddress *u);
75 const char *linphone_address_get_display_name(const LinphoneAddress* u);
76 const char *linphone_address_get_username(const LinphoneAddress *u);
77 const char *linphone_address_get_domain(const LinphoneAddress *u);
79 * Get port number as an integer value.
82 int linphone_address_get_port_int(const LinphoneAddress *u);
84 * Get port number, null if not present.
86 const char* linphone_address_get_port(const LinphoneAddress *u);
87 void linphone_address_set_display_name(LinphoneAddress *u, const char *display_name);
88 void linphone_address_set_username(LinphoneAddress *uri, const char *username);
89 void linphone_address_set_domain(LinphoneAddress *uri, const char *host);
90 void linphone_address_set_port(LinphoneAddress *uri, const char *port);
91 void linphone_address_set_port_int(LinphoneAddress *uri, int port);
92 /*remove tags, params etc... so that it is displayable to the user*/
93 void linphone_address_clean(LinphoneAddress *uri);
94 char *linphone_address_as_string(const LinphoneAddress *u);
95 char *linphone_address_as_string_uri_only(const LinphoneAddress *u);
96 void linphone_address_destroy(LinphoneAddress *u);
98 struct _SipSetupContext;
102 * Enum representing the direction of a call.
105 enum _LinphoneCallDir {
106 LinphoneCallOutgoing, /**< outgoing calls*/
107 LinphoneCallIncoming /**< incoming calls*/
114 typedef enum _LinphoneCallDir LinphoneCallDir;
117 * Enum representing the status of a call
120 typedef enum _LinphoneCallStatus {
121 LinphoneCallSuccess, /**< The call was sucessful*/
122 LinphoneCallAborted, /**< The call was aborted */
123 LinphoneCallMissed /**< The call was missed (unanswered)*/
124 } LinphoneCallStatus;
127 * Structure representing a call log.
132 typedef struct _LinphoneCallLog{
133 LinphoneCallDir dir; /**< The direction of the call*/
134 LinphoneCallStatus status; /**< The status of the call*/
135 LinphoneAddress *from; /**<Originator of the call as a LinphoneAddress object*/
136 LinphoneAddress *to; /**<Destination of the call as a LinphoneAddress object*/
137 char start_date[128]; /**<Human readable string containg the start date*/
138 int duration; /**<Duration of the call in seconds*/
141 rtp_stats_t local_stats;
142 rtp_stats_t remote_stats;
143 struct _LinphoneCore *lc;
149 void linphone_call_log_set_user_pointer(LinphoneCallLog *cl, void *up);
150 void *linphone_call_log_get_user_pointer(const LinphoneCallLog *cl);
151 void linphone_call_log_set_ref_key(LinphoneCallLog *cl, const char *refkey);
152 const char *linphone_call_log_get_ref_key(const LinphoneCallLog *cl);
153 const rtp_stats_t *linphone_call_log_get_local_stats(const LinphoneCallLog *cl);
154 const rtp_stats_t *linphone_call_log_get_remote_stats(const LinphoneCallLog *cl);
155 char * linphone_call_log_to_str(LinphoneCallLog *cl);
159 * The LinphoneCall object represents a call issued or received by the LinphoneCore
161 struct _LinphoneCall;
162 typedef struct _LinphoneCall LinphoneCall;
165 enum _LinphoneCallState linphone_call_get_state(const LinphoneCall *call);
166 bool_t linphone_call_asked_to_autoanswer(LinphoneCall *call);
167 const LinphoneAddress * linphone_core_get_current_call_remote_address(struct _LinphoneCore *lc);
168 const LinphoneAddress * linphone_call_get_remote_address(const LinphoneCall *call);
169 char *linphone_call_get_remote_address_as_string(const LinphoneCall *call);
170 LinphoneCallDir linphone_call_get_dir(const LinphoneCall *call);
171 void linphone_call_ref(LinphoneCall *call);
172 void linphone_call_unref(LinphoneCall *call);
173 LinphoneCallLog *linphone_call_get_call_log(const LinphoneCall *call);
174 const char *linphone_call_get_refer_to(const LinphoneCall *call);
175 bool_t linphone_call_has_transfer_pending(const LinphoneCall *call);
176 void *linphone_call_get_user_pointer(LinphoneCall *call);
177 void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer);
183 }LinphoneSubscribePolicy;
185 typedef enum _LinphoneOnlineStatus{
186 LinphoneStatusOffline,
187 LinphoneStatusOnline,
189 LinphoneStatusBeRightBack,
191 LinphoneStatusOnThePhone,
192 LinphoneStatusOutToLunch,
193 LinphoneStatusDoNotDisturb,
195 LinphoneStatusAltService,
196 LinphoneStatusPending,
198 }LinphoneOnlineStatus;
200 const char *linphone_online_status_to_string(LinphoneOnlineStatus ss);
202 struct _LinphoneFriend;
204 typedef struct _LinphoneFriend LinphoneFriend;
206 LinphoneFriend * linphone_friend_new();
207 LinphoneFriend *linphone_friend_new_with_addr(const char *addr);
208 int linphone_friend_set_sip_addr(LinphoneFriend *fr, const char *uri);
209 int linphone_friend_set_name(LinphoneFriend *fr, const char *name);
210 int linphone_friend_send_subscribe(LinphoneFriend *fr, bool_t val);
211 int linphone_friend_set_inc_subscribe_policy(LinphoneFriend *fr, LinphoneSubscribePolicy pol);
212 void linphone_friend_edit(LinphoneFriend *fr);
213 void linphone_friend_done(LinphoneFriend *fr);
214 void linphone_friend_destroy(LinphoneFriend *lf);
215 const LinphoneAddress *linphone_friend_get_address(const LinphoneFriend *lf);
216 bool_t linphone_friend_get_send_subscribe(const LinphoneFriend *lf);
217 LinphoneSubscribePolicy linphone_friend_get_inc_subscribe_policy(const LinphoneFriend *lf);
218 LinphoneOnlineStatus linphone_friend_get_status(const LinphoneFriend *lf);
219 BuddyInfo * linphone_friend_get_info(const LinphoneFriend *lf);
220 void linphone_friend_set_ref_key(LinphoneFriend *lf, const char *key);
221 const char *linphone_friend_get_ref_key(const LinphoneFriend *lf);
222 bool_t linphone_friend_in_list(const LinphoneFriend *lf);
224 #define linphone_friend_url(lf) ((lf)->url)
228 * @addtogroup proxies
232 * The LinphoneProxyConfig object represents a proxy configuration to be used
233 * by the LinphoneCore object.
234 * Its fields must not be used directly in favour of the accessors methods.
235 * Once created and filled properly the LinphoneProxyConfig can be given to
236 * LinphoneCore with linphone_core_add_proxy_config().
237 * This will automatically triggers the registration, if enabled.
239 * The proxy configuration are persistent to restarts because they are saved
240 * in the configuration file. As a consequence, after linphone_core_new() there
241 * might already be a list of configured proxy that can be examined with
242 * linphone_core_get_proxy_config_list().
244 * The default proxy (see linphone_core_set_default_proxy() ) is the one of the list
245 * that is used by default for calls.
247 typedef struct _LinphoneProxyConfig LinphoneProxyConfig;
249 LinphoneProxyConfig *linphone_proxy_config_new(void);
250 int linphone_proxy_config_set_server_addr(LinphoneProxyConfig *obj, const char *server_addr);
251 int linphone_proxy_config_set_identity(LinphoneProxyConfig *obj, const char *identity);
252 int linphone_proxy_config_set_route(LinphoneProxyConfig *obj, const char *route);
253 void linphone_proxy_config_expires(LinphoneProxyConfig *obj, int expires);
254 void linphone_proxy_config_enable_register(LinphoneProxyConfig *obj, bool_t val);
255 #define linphone_proxy_config_enableregister linphone_proxy_config_enable_register
256 void linphone_proxy_config_edit(LinphoneProxyConfig *obj);
257 int linphone_proxy_config_done(LinphoneProxyConfig *obj);
258 void linphone_proxy_config_enable_publish(LinphoneProxyConfig *obj, bool_t val);
259 void linphone_proxy_config_set_dial_escape_plus(LinphoneProxyConfig *cfg, bool_t val);
260 void linphone_proxy_config_set_dial_prefix(LinphoneProxyConfig *cfg, const char *prefix);
262 bool_t linphone_proxy_config_is_registered(const LinphoneProxyConfig *obj);
263 const char *linphone_proxy_config_get_domain(const LinphoneProxyConfig *cfg);
265 const char *linphone_proxy_config_get_route(const LinphoneProxyConfig *obj);
266 const char *linphone_proxy_config_get_identity(const LinphoneProxyConfig *obj);
267 bool_t linphone_proxy_config_publish_enabled(const LinphoneProxyConfig *obj);
268 const char *linphone_proxy_config_get_addr(const LinphoneProxyConfig *obj);
269 int linphone_proxy_config_get_expires(const LinphoneProxyConfig *obj);
270 bool_t linphone_proxy_config_register_enabled(const LinphoneProxyConfig *obj);
271 struct _LinphoneCore * linphone_proxy_config_get_core(const LinphoneProxyConfig *obj);
273 bool_t linphone_proxy_config_get_dial_escape_plus(const LinphoneProxyConfig *cfg);
274 const char * linphone_proxy_config_get_dial_prefix(const LinphoneProxyConfig *cfg);
276 /* destruction is called automatically when removing the proxy config */
277 void linphone_proxy_config_destroy(LinphoneProxyConfig *cfg);
278 void linphone_proxy_config_set_sip_setup(LinphoneProxyConfig *cfg, const char *type);
279 SipSetupContext *linphone_proxy_config_get_sip_setup_context(LinphoneProxyConfig *cfg);
280 SipSetup *linphone_proxy_config_get_sip_setup(LinphoneProxyConfig *cfg);
282 * normalize a human readable phone number into a basic string. 888-444-222 becomes 888444222
284 int linphone_proxy_config_normalize_number(LinphoneProxyConfig *proxy, const char *username, char *result, size_t result_len);
286 * attached a user data to a proxy config
288 void linphone_proxy_config_set_user_data(LinphoneProxyConfig *cr, void * ud);
290 * get user data to a proxy config. return null if any
292 void * linphone_proxy_config_get_user_data(LinphoneProxyConfig *cr);
298 typedef struct _LinphoneAccountCreator{
299 struct _LinphoneCore *lc;
300 struct _SipSetupContext *ssctx;
305 }LinphoneAccountCreator;
307 LinphoneAccountCreator *linphone_account_creator_new(struct _LinphoneCore *core, const char *type);
308 void linphone_account_creator_set_username(LinphoneAccountCreator *obj, const char *username);
309 void linphone_account_creator_set_password(LinphoneAccountCreator *obj, const char *password);
310 void linphone_account_creator_set_domain(LinphoneAccountCreator *obj, const char *domain);
311 const char * linphone_account_creator_get_username(LinphoneAccountCreator *obj);
312 const char * linphone_account_creator_get_domain(LinphoneAccountCreator *obj);
313 int linphone_account_creator_test_existence(LinphoneAccountCreator *obj);
314 LinphoneProxyConfig * linphone_account_creator_validate(LinphoneAccountCreator *obj);
315 void linphone_account_creator_destroy(LinphoneAccountCreator *obj);
317 struct _LinphoneAuthInfo;
320 * @ingroup authentication
321 * Object holding authentication information.
323 * @note The object's fields should not be accessed directly. Prefer using
324 * the accessor methods.
326 * In most case, authentication information consists of a username and password.
327 * Sometimes, a userid is required by proxy, and realm can be useful to discriminate
328 * different SIP domains.
330 * Once created and filled, a LinphoneAuthInfo must be added to the LinphoneCore in
331 * order to become known and used automatically when needed.
332 * Use linphone_core_add_auth_info() for that purpose.
334 * The LinphoneCore object can take the initiative to request authentication information
335 * when needed to the application through the auth_info_requested callback of the
336 * LinphoneCoreVTable structure.
338 * The application can respond to this information request later using
339 * linphone_core_add_auth_info(). This will unblock all pending authentication
340 * transactions and retry them with authentication headers.
343 typedef struct _LinphoneAuthInfo LinphoneAuthInfo;
345 LinphoneAuthInfo *linphone_auth_info_new(const char *username, const char *userid,
346 const char *passwd, const char *ha1,const char *realm);
347 void linphone_auth_info_set_passwd(LinphoneAuthInfo *info, const char *passwd);
348 void linphone_auth_info_set_username(LinphoneAuthInfo *info, const char *username);
349 void linphone_auth_info_set_userid(LinphoneAuthInfo *info, const char *userid);
351 const char *linphone_auth_info_get_username(const LinphoneAuthInfo *i);
352 const char *linphone_auth_info_get_passwd(const LinphoneAuthInfo *i);
353 const char *linphone_auth_info_get_userid(const LinphoneAuthInfo *i);
355 /* you don't need those function*/
356 void linphone_auth_info_destroy(LinphoneAuthInfo *info);
357 LinphoneAuthInfo * linphone_auth_info_new_from_config_file(struct _LpConfig *config, int pos);
359 struct _LinphoneChatRoom;
360 typedef struct _LinphoneChatRoom LinphoneChatRoom;
362 LinphoneChatRoom * linphone_core_create_chat_room(struct _LinphoneCore *lc, const char *to);
363 void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg);
364 void linphone_chat_room_destroy(LinphoneChatRoom *cr);
365 void linphone_chat_room_set_user_data(LinphoneChatRoom *cr, void * ud);
366 void * linphone_chat_room_get_user_data(LinphoneChatRoom *cr);
368 typedef enum _LinphoneCallState{
370 LinphoneCallIncomingReceived,
371 LinphoneCallOutgoingInit,
372 LinphoneCallOutgoingProgress,
373 LinphoneCallOutgoingRinging,
374 LinphoneCallOutgoingEarlyMedia,
375 LinphoneCallConnected,
376 LinphoneCallStreamsRunning,
379 LinphoneCallResuming,
385 typedef enum _LinphoneGlobalState{
387 LinphoneGlobalStartup,
389 LinphoneGlobalShutdown
390 }LinphoneGlobalState;
392 typedef enum _LinphoneRegistrationState{
393 LinphoneRegistrationNone,
394 LinphoneRegistrationProgress,
395 LinphoneRegistrationOk,
396 LinphoneRegistrationCleared,
397 LinphoneRegistrationFailed
398 }LinphoneRegistrationState;
401 * @addtogroup initializing
406 /**Call state notification callback prototype*/
407 typedef void (*LinphoneGlobalStateCb)(struct _LinphoneCore *lc, LinphoneGlobalState gstate, const char *message);
408 /**Call state notification callback prototype*/
409 typedef void (*LinphoneCallStateCb)(struct _LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *message);
410 /**Registration state notification callback prototype*/
411 typedef void (*LinphoneRegistrationStateCb)(struct _LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneCallState cstate, const char *message);
412 /** Callback prototype */
413 typedef void (*ShowInterfaceCb)(struct _LinphoneCore *lc);
414 /** Callback prototype */
415 typedef void (*DisplayStatusCb)(struct _LinphoneCore *lc, const char *message);
416 /** Callback prototype */
417 typedef void (*DisplayMessageCb)(struct _LinphoneCore *lc, const char *message);
418 /** Callback prototype */
419 typedef void (*DisplayUrlCb)(struct _LinphoneCore *lc, const char *message, const char *url);
420 /** Callback prototype */
421 typedef void (*LinphoneCoreCbFunc)(struct _LinphoneCore *lc,void * user_data);
422 /** Callback prototype */
423 typedef void (*NotifyReceivedCb)(struct _LinphoneCore *lc, LinphoneCall *call, const char *from, const char *event);
424 /** Callback prototype */
425 typedef void (*NotifyPresenceReceivedCb)(struct _LinphoneCore *lc, LinphoneFriend * fid);
426 /** Callback prototype */
427 typedef void (*NewUnknownSubscriberCb)(struct _LinphoneCore *lc, LinphoneFriend *lf, const char *url);
428 /** Callback prototype */
429 typedef void (*AuthInfoRequested)(struct _LinphoneCore *lc, const char *realm, const char *username);
430 /** Callback prototype */
431 typedef void (*CallLogUpdated)(struct _LinphoneCore *lc, struct _LinphoneCallLog *newcl);
432 /** Callback prototype */
433 typedef void (*TextMessageReceived)(struct _LinphoneCore *lc, LinphoneChatRoom *room, const char *from, const char *message);
434 /** Callback prototype */
435 typedef void (*DtmfReceived)(struct _LinphoneCore* lc, LinphoneCall *call, int dtmf);
436 /** Callback prototype */
437 typedef void (*ReferReceived)(struct _LinphoneCore *lc, const char *refer_to);
438 /** Callback prototype */
439 typedef void (*BuddyInfoUpdated)(struct _LinphoneCore *lc, LinphoneFriend *lf);
442 * This structure holds all callbacks that the application should implement.
445 typedef struct _LinphoneVTable{
446 LinphoneGlobalStateCb global_state_changed; /**<Notifies globlal state changes*/
447 LinphoneRegistrationStateCb registration_state_changed;/**<Notifies registration state changes*/
448 LinphoneCallStateCb call_state_changed;/**<Notifies call state changes*/
449 NotifyPresenceReceivedCb notify_presence_recv; /**< Notify received presence events*/
450 NewUnknownSubscriberCb new_unknown_subscriber; /**< Notify about unknown subscriber */
451 AuthInfoRequested auth_info_requested; /**< Ask the application some authentication information */
452 CallLogUpdated call_log_updated; /**< Notifies that call log list has been updated */
453 TextMessageReceived text_received; /**< A text message has been received */
454 DtmfReceived dtmf_received; /**< A dtmf has been received received */
455 ReferReceived refer_received; /**< An out of call refer was received */
456 BuddyInfoUpdated buddy_info_updated; /**< a LinphoneFriend's BuddyInfo has changed*/
457 NotifyReceivedCb notify_recv; /**< Other notifications*/
458 DisplayStatusCb display_status; /**< Callback that notifies various events with human readable text.*/
459 DisplayMessageCb display_message;/**< Callback to display a message to the user */
460 DisplayMessageCb display_warning;/** Callback to display a warning to the user */
461 DisplayUrlCb display_url;
462 ShowInterfaceCb show; /**< Notifies the application that it should show up*/
463 } LinphoneCoreVTable;
469 typedef struct _LCCallbackObj
471 LinphoneCoreCbFunc _func;
477 typedef enum _LinphoneFirewallPolicy{
478 LinphonePolicyNoFirewall,
479 LinphonePolicyUseNatAddress,
480 LinphonePolicyUseStun
481 } LinphoneFirewallPolicy;
483 typedef enum _LinphoneWaitingState{
484 LinphoneWaitingStart,
485 LinphoneWaitingProgress,
486 LinphoneWaitingFinished
487 } LinphoneWaitingState;
488 typedef void * (*LinphoneWaitingCallback)(struct _LinphoneCore *lc, void *context, LinphoneWaitingState ws, const char *purpose, float progress);
490 typedef struct _LinphoneCore LinphoneCore;
494 void linphone_core_enable_logs(FILE *file);
495 void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc);
496 void linphone_core_disable_logs(void);
497 /*sets the user-agent string in sip messages, must be set before linphone_core_new() or linphone_core_init() */
498 void linphone_core_set_user_agent(const char *ua_name, const char *version);
499 const char *linphone_core_get_version(void);
501 LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable,
502 const char *config_path, const char *factory_config, void* userdata);
504 /* function to be periodically called in a main loop */
505 void linphone_core_iterate(LinphoneCore *lc);
507 LinphoneAddress * linphone_core_interpret_url(LinphoneCore *lc, const char *url);
509 LinphoneCall * linphone_core_invite(LinphoneCore *lc, const char *url);
511 LinphoneCall * linphone_core_invite_address(LinphoneCore *lc, const LinphoneAddress *addr);
513 int linphone_core_transfer_call(LinphoneCore *lc, LinphoneCall *call, const char *refer_to);
515 bool_t linphone_core_inc_invite_pending(LinphoneCore*lc);
517 bool_t linphone_core_in_call(const LinphoneCore *lc);
519 LinphoneCall *linphone_core_get_current_call(const LinphoneCore *lc);
521 int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call);
523 int linphone_core_terminate_call(LinphoneCore *lc, LinphoneCall *call);
525 int linphone_core_terminate_all_calls(LinphoneCore *lc);
527 int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call);
529 int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *call);
531 LinphoneCall *linphone_core_get_call_by_remote_address(LinphoneCore *lc, const char *remote_address);
533 void linphone_core_send_dtmf(LinphoneCore *lc,char dtmf);
535 int linphone_core_set_primary_contact(LinphoneCore *lc, const char *contact);
537 const char *linphone_core_get_primary_contact(LinphoneCore *lc);
539 void linphone_core_set_guess_hostname(LinphoneCore *lc, bool_t val);
540 bool_t linphone_core_get_guess_hostname(LinphoneCore *lc);
542 bool_t linphone_core_ipv6_enabled(LinphoneCore *lc);
543 void linphone_core_enable_ipv6(LinphoneCore *lc, bool_t val);
545 LinphoneAddress *linphone_core_get_primary_contact_parsed(LinphoneCore *lc);
547 /*0= no bandwidth limit*/
548 void linphone_core_set_download_bandwidth(LinphoneCore *lc, int bw);
549 void linphone_core_set_upload_bandwidth(LinphoneCore *lc, int bw);
551 int linphone_core_get_download_bandwidth(const LinphoneCore *lc);
552 int linphone_core_get_upload_bandwidth(const LinphoneCore *lc);
554 * set audio packetization time linphone expect to received from peer
555 * @ingroup media_parameters
558 void linphone_core_set_download_ptime(LinphoneCore *lc, int ptime);
560 * get audio packetization time linphone expect to received from peer, 0 means unspecified
561 * @ingroup media_parameters
563 int linphone_core_get_download_ptime(LinphoneCore *lc);
565 /* returns a MSList of PayloadType */
566 const MSList *linphone_core_get_audio_codecs(const LinphoneCore *lc);
568 int linphone_core_set_audio_codecs(LinphoneCore *lc, MSList *codecs);
569 /* returns a MSList of PayloadType */
570 const MSList *linphone_core_get_video_codecs(const LinphoneCore *lc);
572 int linphone_core_set_video_codecs(LinphoneCore *lc, MSList *codecs);
574 bool_t linphone_core_payload_type_enabled(LinphoneCore *lc, PayloadType *pt);
576 int linphone_core_enable_payload_type(LinphoneCore *lc, PayloadType *pt, bool_t enable);
578 PayloadType* linphone_core_find_payload_type(LinphoneCore* lc, const char* type, int rate) ;
580 const char *linphone_core_get_payload_type_description(LinphoneCore *lc, PayloadType *pt);
582 bool_t linphone_core_check_payload_type_usability(LinphoneCore *lc, PayloadType *pt);
584 int linphone_core_add_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *config);
586 void linphone_core_clear_proxy_config(LinphoneCore *lc);
588 void linphone_core_remove_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *config);
590 const MSList *linphone_core_get_proxy_config_list(const LinphoneCore *lc);
592 void linphone_core_set_default_proxy(LinphoneCore *lc, LinphoneProxyConfig *config);
594 void linphone_core_set_default_proxy_index(LinphoneCore *lc, int index);
596 int linphone_core_get_default_proxy(LinphoneCore *lc, LinphoneProxyConfig **config);
598 void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info);
600 void linphone_core_remove_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info);
602 const MSList *linphone_core_get_auth_info_list(const LinphoneCore *lc);
604 const LinphoneAuthInfo *linphone_core_find_auth_info(LinphoneCore *lc, const char *realm, const char *username);
606 void linphone_core_abort_authentication(LinphoneCore *lc, LinphoneAuthInfo *info);
608 void linphone_core_clear_all_auth_info(LinphoneCore *lc);
610 int linphone_core_get_audio_jittcomp(LinphoneCore *lc);
612 void linphone_core_set_audio_jittcomp(LinphoneCore *lc, int value);
614 int linphone_core_get_audio_port(const LinphoneCore *lc);
616 int linphone_core_get_video_port(const LinphoneCore *lc);
618 int linphone_core_get_nortp_timeout(const LinphoneCore *lc);
620 void linphone_core_set_audio_port(LinphoneCore *lc, int port);
622 void linphone_core_set_video_port(LinphoneCore *lc, int port);
624 void linphone_core_set_nortp_timeout(LinphoneCore *lc, int port);
626 void linphone_core_set_use_info_for_dtmf(LinphoneCore *lc, bool_t use_info);
628 bool_t linphone_core_get_use_info_for_dtmf(LinphoneCore *lc);
630 void linphone_core_set_use_rfc2833_for_dtmf(LinphoneCore *lc,bool_t use_rfc2833);
632 bool_t linphone_core_get_use_rfc2833_for_dtmf(LinphoneCore *lc);
634 void linphone_core_set_sip_port(LinphoneCore *lc, int port);
636 int linphone_core_get_sip_port(LinphoneCore *lc);
638 int linphone_core_set_sip_transports(LinphoneCore *lc, const LCSipTransports *transports);
640 int linphone_core_get_sip_transports(LinphoneCore *lc, LCSipTransports *transports);
642 ortp_socket_t linphone_core_get_sip_socket(LinphoneCore *lc);
644 void linphone_core_set_inc_timeout(LinphoneCore *lc, int seconds);
646 int linphone_core_get_inc_timeout(LinphoneCore *lc);
648 void linphone_core_set_stun_server(LinphoneCore *lc, const char *server);
650 const char * linphone_core_get_stun_server(const LinphoneCore *lc);
652 void linphone_core_set_nat_address(LinphoneCore *lc, const char *addr);
654 const char *linphone_core_get_nat_address(const LinphoneCore *lc);
656 void linphone_core_set_firewall_policy(LinphoneCore *lc, LinphoneFirewallPolicy pol);
658 LinphoneFirewallPolicy linphone_core_get_firewall_policy(const LinphoneCore *lc);
660 const char * linphone_core_get_relay_addr(const LinphoneCore *lc);
662 int linphone_core_set_relay_addr(LinphoneCore *lc, const char *addr);
664 /* sound functions */
665 /* returns a null terminated static array of string describing the sound devices */
666 const char** linphone_core_get_sound_devices(LinphoneCore *lc);
667 bool_t linphone_core_sound_device_can_capture(LinphoneCore *lc, const char *device);
668 bool_t linphone_core_sound_device_can_playback(LinphoneCore *lc, const char *device);
669 int linphone_core_get_ring_level(LinphoneCore *lc);
670 int linphone_core_get_play_level(LinphoneCore *lc);
671 int linphone_core_get_rec_level(LinphoneCore *lc);
672 void linphone_core_set_ring_level(LinphoneCore *lc, int level);
673 void linphone_core_set_play_level(LinphoneCore *lc, int level);
675 void linphone_core_set_playback_gain_db(LinphoneCore *lc, float level);
677 float linphone_core_get_playback_gain_db(LinphoneCore *lc);
678 void linphone_core_set_rec_level(LinphoneCore *lc, int level);
679 const char * linphone_core_get_ringer_device(LinphoneCore *lc);
680 const char * linphone_core_get_playback_device(LinphoneCore *lc);
681 const char * linphone_core_get_capture_device(LinphoneCore *lc);
682 int linphone_core_set_ringer_device(LinphoneCore *lc, const char * devid);
683 int linphone_core_set_playback_device(LinphoneCore *lc, const char * devid);
684 int linphone_core_set_capture_device(LinphoneCore *lc, const char * devid);
685 char linphone_core_get_sound_source(LinphoneCore *lc);
686 void linphone_core_set_sound_source(LinphoneCore *lc, char source);
687 void linphone_core_set_ring(LinphoneCore *lc, const char *path);
688 const char *linphone_core_get_ring(const LinphoneCore *lc);
689 void linphone_core_set_ringback(LinphoneCore *lc, const char *path);
690 const char * linphone_core_get_ringback(const LinphoneCore *lc);
691 int linphone_core_preview_ring(LinphoneCore *lc, const char *ring,LinphoneCoreCbFunc func,void * userdata);
692 void linphone_core_enable_echo_cancellation(LinphoneCore *lc, bool_t val);
693 bool_t linphone_core_echo_cancellation_enabled(LinphoneCore *lc);
695 void linphone_core_enable_echo_limiter(LinphoneCore *lc, bool_t val);
696 bool_t linphone_core_echo_limiter_enabled(const LinphoneCore *lc);
698 void linphone_core_enable_agc(LinphoneCore *lc, bool_t val);
699 bool_t linphone_core_agc_enabled(const LinphoneCore *lc);
701 void linphone_core_mute_mic(LinphoneCore *lc, bool_t muted);
705 * @ingroup media_parameters
707 bool_t linphone_core_is_mic_muted(LinphoneCore *lc);
709 bool_t linphone_core_is_audio_muted(LinphoneCore *lc);
710 bool_t linphone_core_is_rtp_muted(LinphoneCore *lc);
712 bool_t linphone_core_get_rtp_no_xmit_on_audio_mute(const LinphoneCore *lc);
713 void linphone_core_set_rtp_no_xmit_on_audio_mute(LinphoneCore *lc, bool_t val);
715 void linphone_core_set_presence_info(LinphoneCore *lc,int minutes_away,const char *contact,LinphoneOnlineStatus os);
717 LinphoneOnlineStatus linphone_core_get_presence_info(const LinphoneCore *lc);
719 void linphone_core_interpret_friend_uri(LinphoneCore *lc, const char *uri, char **result);
720 void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *fr);
721 void linphone_core_remove_friend(LinphoneCore *lc, LinphoneFriend *fr);
722 void linphone_core_reject_subscriber(LinphoneCore *lc, LinphoneFriend *lf);
723 /* a list of LinphoneFriend */
724 const MSList * linphone_core_get_friend_list(const LinphoneCore *lc);
725 /* notify all friends that have subscribed */
726 void linphone_core_notify_all_friends(LinphoneCore *lc, LinphoneOnlineStatus os);
727 LinphoneFriend *linphone_core_get_friend_by_address(const LinphoneCore *lc, const char *addr);
728 LinphoneFriend *linphone_core_get_friend_by_ref_key(const LinphoneCore *lc, const char *key);
730 /* returns a list of LinphoneCallLog */
731 const MSList * linphone_core_get_call_logs(LinphoneCore *lc);
732 void linphone_core_clear_call_logs(LinphoneCore *lc);
735 void linphone_core_enable_video(LinphoneCore *lc, bool_t vcap_enabled, bool_t display_enabled);
736 bool_t linphone_core_video_enabled(LinphoneCore *lc);
738 typedef struct MSVideoSizeDef{
742 /* returns a zero terminated table of MSVideoSizeDef*/
743 const MSVideoSizeDef *linphone_core_get_supported_video_sizes(LinphoneCore *lc);
744 void linphone_core_set_preferred_video_size(LinphoneCore *lc, MSVideoSize vsize);
745 MSVideoSize linphone_core_get_preferred_video_size(LinphoneCore *lc);
746 void linphone_core_set_preferred_video_size_by_name(LinphoneCore *lc, const char *name);
748 void linphone_core_enable_video_preview(LinphoneCore *lc, bool_t val);
749 bool_t linphone_core_video_preview_enabled(const LinphoneCore *lc);
751 void linphone_core_enable_self_view(LinphoneCore *lc, bool_t val);
752 bool_t linphone_core_self_view_enabled(const LinphoneCore *lc);
755 /* returns a null terminated static array of string describing the webcams */
756 const char** linphone_core_get_video_devices(const LinphoneCore *lc);
757 int linphone_core_set_video_device(LinphoneCore *lc, const char *id);
758 const char *linphone_core_get_video_device(const LinphoneCore *lc);
760 /* Set static picture to be used when "Static picture" is the video device */
761 int linphone_core_set_static_picture(LinphoneCore *lc, const char *path);
763 /*function to be used for eventually setting window decorations (icons, title...)*/
764 unsigned long linphone_core_get_native_video_window_id(const LinphoneCore *lc);
767 /*play/record support: use files instead of soundcard*/
768 void linphone_core_use_files(LinphoneCore *lc, bool_t yesno);
769 void linphone_core_set_play_file(LinphoneCore *lc, const char *file);
770 void linphone_core_set_record_file(LinphoneCore *lc, const char *file);
772 int linphone_core_get_current_call_duration(const LinphoneCore *lc);
773 const LinphoneAddress *linphone_core_get_remote_address(LinphoneCore *lc);
775 int linphone_core_get_mtu(const LinphoneCore *lc);
776 void linphone_core_set_mtu(LinphoneCore *lc, int mtu);
779 * This method is called by the application to notify the linphone core library when network is reachable.
780 * Calling this method with true trigger linphone to initiate a registration process for all proxy
781 * configuration with parameter register set to enable.
782 * This method disable the automatic registration mode. It means you must call this method after each network state changes
785 void linphone_core_set_network_reachable(LinphoneCore* lc,bool_t value);
787 * return network state either as positioned by the application or by linphone
789 bool_t linphone_core_is_network_reachabled(LinphoneCore* lc);
792 void *linphone_core_get_user_data(LinphoneCore *lc);
794 /* returns LpConfig object to read/write to the config file: usefull if you wish to extend
795 the config file with your own sections */
796 struct _LpConfig *linphone_core_get_config(LinphoneCore *lc);
798 /* attempts to wake up another linphone engine already running.
799 The "show" callback is called for the other linphone, causing gui to show up.
800 call_addr is an optional sip-uri to call immediately after waking up.
801 The method returns 0 if an already running linphone was found*/
803 int linphone_core_wake_up_possible_already_running_instance(
804 const char * config_file, const char * call_addr);
806 /*set a callback for some blocking operations, it takes you informed of the progress of the operation*/
807 void linphone_core_set_waiting_callback(LinphoneCore *lc, LinphoneWaitingCallback cb, void *user_context);
809 /*returns the list of registered SipSetup (linphonecore plugins) */
810 const MSList * linphone_core_get_sip_setups(LinphoneCore *lc);
812 void linphone_core_destroy(LinphoneCore *lc);
814 /*for advanced users:*/
815 void linphone_core_set_audio_transports(LinphoneCore *lc, RtpTransport *rtp, RtpTransport *rtcp);
817 int linphone_core_get_current_call_stats(LinphoneCore *lc, rtp_stats_t *local, rtp_stats_t *remote);
819 const MSList *linphone_core_get_calls(LinphoneCore *lc);