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
48 * Object that represents a SIP address.
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
58 * @ingroup linphone_address
59 * @var LinphoneAddress
61 typedef struct SalAddress LinphoneAddress;
63 LinphoneAddress * linphone_address_new(const char *uri);
64 LinphoneAddress * linphone_address_clone(const LinphoneAddress *uri);
65 const char *linphone_address_get_scheme(const LinphoneAddress *u);
66 const char *linphone_address_get_display_name(const LinphoneAddress* u);
67 char *linphone_address_get_display_name_unquoted(const LinphoneAddress *u);
68 const char *linphone_address_get_username(const LinphoneAddress *u);
69 const char *linphone_address_get_domain(const LinphoneAddress *u);
70 void linphone_address_set_display_name(LinphoneAddress *u, const char *display_name);
71 void linphone_address_set_username(LinphoneAddress *uri, const char *username);
72 void linphone_address_set_domain(LinphoneAddress *uri, const char *host);
73 void linphone_address_set_port(LinphoneAddress *uri, const char *port);
74 void linphone_address_set_port_int(LinphoneAddress *uri, int port);
75 /*remove tags, params etc... so that it is displayable to the user*/
76 void linphone_address_clean(LinphoneAddress *uri);
77 char *linphone_address_as_string(const LinphoneAddress *u);
78 char *linphone_address_as_string_uri_only(const LinphoneAddress *u);
79 void linphone_address_destroy(LinphoneAddress *u);
81 struct _SipSetupContext;
84 * The LinphoneCall object represents a call issued or received by the LinphoneCore
87 typedef struct _LinphoneCall LinphoneCall;
89 typedef enum _LinphoneCallState{
91 LinphoneCallPreEstablishing,
93 LinphoneCallAVRunning,
95 LinphoneCallTerminated
98 LinphoneCallState linphone_call_get_state(const LinphoneCall *call);
99 bool_t linphone_call_asked_to_autoanswer(LinphoneCall *call);
100 bool_t linphone_call_paused(LinphoneCall *call);
101 const LinphoneAddress * linphone_core_get_current_call_remote_address(struct _LinphoneCore *lc);
102 const LinphoneAddress * linphone_call_get_remote_address(const LinphoneCall *call);
103 char *linphone_call_get_remote_address_as_string(const LinphoneCall *call);
104 void linphone_call_ref(LinphoneCall *call);
105 void linphone_call_unref(LinphoneCall *call);
109 * Enum representing the direction of a call.
112 enum _LinphoneCallDir {
113 LinphoneCallOutgoing, /**< outgoing calls*/
114 LinphoneCallIncoming /**< incoming calls*/
121 typedef enum _LinphoneCallDir LinphoneCallDir;
124 * Enum representing the status of a call
127 typedef enum _LinphoneCallStatus {
128 LinphoneCallSuccess, /**< The call was sucessful*/
129 LinphoneCallAborted, /**< The call was aborted */
130 LinphoneCallMissed /**< The call was missed (unanswered)*/
131 } LinphoneCallStatus;
134 * Structure representing a call log.
139 typedef struct _LinphoneCallLog{
140 LinphoneCallDir dir; /**< The direction of the call*/
141 LinphoneCallStatus status; /**< The status of the call*/
142 LinphoneAddress *from; /**<Originator of the call as a LinphoneAddress object*/
143 LinphoneAddress *to; /**<Destination of the call as a LinphoneAddress object*/
144 char start_date[128]; /**<Human readable string containg the start date*/
145 int duration; /**<Duration of the call in seconds*/
148 rtp_stats_t local_stats;
149 rtp_stats_t remote_stats;
150 struct _LinphoneCore *lc;
156 void linphone_call_log_set_user_pointer(LinphoneCallLog *cl, void *up);
157 void *linphone_call_log_get_user_pointer(const LinphoneCallLog *cl);
158 void linphone_call_log_set_ref_key(LinphoneCallLog *cl, const char *refkey);
159 const char *linphone_call_log_get_ref_key(const LinphoneCallLog *cl);
160 const rtp_stats_t *linphone_call_log_get_local_stats(const LinphoneCallLog *cl);
161 const rtp_stats_t *linphone_call_log_get_remote_stats(const LinphoneCallLog *cl);
162 char * linphone_call_log_to_str(LinphoneCallLog *cl);
168 }LinphoneSubscribePolicy;
170 typedef enum _LinphoneOnlineStatus{
171 LINPHONE_STATUS_OFFLINE,
172 LINPHONE_STATUS_ONLINE,
173 LINPHONE_STATUS_BUSY,
174 LINPHONE_STATUS_BERIGHTBACK,
175 LINPHONE_STATUS_AWAY,
176 LINPHONE_STATUS_ONTHEPHONE,
177 LINPHONE_STATUS_OUTTOLUNCH,
178 LINPHONE_STATUS_NOT_DISTURB,
179 LINPHONE_STATUS_MOVED,
180 LINPHONE_STATUS_ALT_SERVICE,
181 LINPHONE_STATUS_PENDING,
183 }LinphoneOnlineStatus;
185 const char *linphone_online_status_to_string(LinphoneOnlineStatus ss);
187 struct _LinphoneFriend;
189 typedef struct _LinphoneFriend LinphoneFriend;
191 LinphoneFriend * linphone_friend_new();
192 LinphoneFriend *linphone_friend_new_with_addr(const char *addr);
193 int linphone_friend_set_sip_addr(LinphoneFriend *fr, const char *uri);
194 int linphone_friend_set_name(LinphoneFriend *fr, const char *name);
195 int linphone_friend_send_subscribe(LinphoneFriend *fr, bool_t val);
196 int linphone_friend_set_inc_subscribe_policy(LinphoneFriend *fr, LinphoneSubscribePolicy pol);
197 void linphone_friend_edit(LinphoneFriend *fr);
198 void linphone_friend_done(LinphoneFriend *fr);
199 void linphone_friend_destroy(LinphoneFriend *lf);
200 const LinphoneAddress *linphone_friend_get_address(const LinphoneFriend *lf);
201 bool_t linphone_friend_get_send_subscribe(const LinphoneFriend *lf);
202 LinphoneSubscribePolicy linphone_friend_get_inc_subscribe_policy(const LinphoneFriend *lf);
203 LinphoneOnlineStatus linphone_friend_get_status(const LinphoneFriend *lf);
204 BuddyInfo * linphone_friend_get_info(const LinphoneFriend *lf);
205 void linphone_friend_set_ref_key(LinphoneFriend *lf, const char *key);
206 const char *linphone_friend_get_ref_key(const LinphoneFriend *lf);
207 bool_t linphone_friend_in_list(const LinphoneFriend *lf);
209 #define linphone_friend_url(lf) ((lf)->url)
213 * @addtogroup proxies
217 * The LinphoneProxyConfig object represents a proxy configuration to be used
218 * by the LinphoneCore object.
219 * Its fields must not be used directly in favour of the accessors methods.
220 * Once created and filled properly the LinphoneProxyConfig can be given to
221 * LinphoneCore with linphone_core_add_proxy_config().
222 * This will automatically triggers the registration, if enabled.
224 * The proxy configuration are persistent to restarts because they are saved
225 * in the configuration file. As a consequence, after linphone_core_new() there
226 * might already be a list of configured proxy that can be examined with
227 * linphone_core_get_proxy_config_list().
229 * The default proxy (see linphone_core_set_default_proxy() ) is the one of the list
230 * that is used by default for calls.
232 typedef struct _LinphoneProxyConfig LinphoneProxyConfig;
234 LinphoneProxyConfig *linphone_proxy_config_new(void);
235 int linphone_proxy_config_set_server_addr(LinphoneProxyConfig *obj, const char *server_addr);
236 int linphone_proxy_config_set_identity(LinphoneProxyConfig *obj, const char *identity);
237 int linphone_proxy_config_set_route(LinphoneProxyConfig *obj, const char *route);
238 void linphone_proxy_config_expires(LinphoneProxyConfig *obj, int expires);
239 void linphone_proxy_config_enable_register(LinphoneProxyConfig *obj, bool_t val);
240 #define linphone_proxy_config_enableregister linphone_proxy_config_enable_register
241 void linphone_proxy_config_edit(LinphoneProxyConfig *obj);
242 int linphone_proxy_config_done(LinphoneProxyConfig *obj);
243 void linphone_proxy_config_enable_publish(LinphoneProxyConfig *obj, bool_t val);
244 void linphone_proxy_config_set_dial_escape_plus(LinphoneProxyConfig *cfg, bool_t val);
245 void linphone_proxy_config_set_dial_prefix(LinphoneProxyConfig *cfg, const char *prefix);
247 bool_t linphone_proxy_config_is_registered(const LinphoneProxyConfig *obj);
248 const char *linphone_proxy_config_get_domain(const LinphoneProxyConfig *cfg);
250 const char *linphone_proxy_config_get_route(const LinphoneProxyConfig *obj);
251 const char *linphone_proxy_config_get_identity(const LinphoneProxyConfig *obj);
252 bool_t linphone_proxy_config_publish_enabled(const LinphoneProxyConfig *obj);
253 const char *linphone_proxy_config_get_addr(const LinphoneProxyConfig *obj);
254 int linphone_proxy_config_get_expires(const LinphoneProxyConfig *obj);
255 bool_t linphone_proxy_config_register_enabled(const LinphoneProxyConfig *obj);
256 struct _LinphoneCore * linphone_proxy_config_get_core(const LinphoneProxyConfig *obj);
258 bool_t linphone_proxy_config_get_dial_escape_plus(const LinphoneProxyConfig *cfg);
259 const char * linphone_proxy_config_get_dial_prefix(const LinphoneProxyConfig *cfg);
261 /* destruction is called automatically when removing the proxy config */
262 void linphone_proxy_config_destroy(LinphoneProxyConfig *cfg);
263 void linphone_proxy_config_set_sip_setup(LinphoneProxyConfig *cfg, const char *type);
264 SipSetupContext *linphone_proxy_config_get_sip_setup_context(LinphoneProxyConfig *cfg);
265 SipSetup *linphone_proxy_config_get_sip_setup(LinphoneProxyConfig *cfg);
267 * normalize a human readable phone number into a basic string. 888-444-222 becomes 888444222
269 int linphone_proxy_config_normalize_number(LinphoneProxyConfig *proxy, const char *username, char *result, size_t result_len);
271 * attached a user data to a proxy config
273 void linphone_proxy_config_set_user_data(LinphoneProxyConfig *cr, void * ud);
275 * get user data to a proxy config. return null if any
277 void * linphone_proxy_config_get_user_data(LinphoneProxyConfig *cr);
283 typedef struct _LinphoneAccountCreator{
284 struct _LinphoneCore *lc;
285 struct _SipSetupContext *ssctx;
290 }LinphoneAccountCreator;
292 LinphoneAccountCreator *linphone_account_creator_new(struct _LinphoneCore *core, const char *type);
293 void linphone_account_creator_set_username(LinphoneAccountCreator *obj, const char *username);
294 void linphone_account_creator_set_password(LinphoneAccountCreator *obj, const char *password);
295 void linphone_account_creator_set_domain(LinphoneAccountCreator *obj, const char *domain);
296 const char * linphone_account_creator_get_username(LinphoneAccountCreator *obj);
297 const char * linphone_account_creator_get_domain(LinphoneAccountCreator *obj);
298 int linphone_account_creator_test_existence(LinphoneAccountCreator *obj);
299 LinphoneProxyConfig * linphone_account_creator_validate(LinphoneAccountCreator *obj);
300 void linphone_account_creator_destroy(LinphoneAccountCreator *obj);
302 struct _LinphoneAuthInfo;
305 * @ingroup authentication
306 * Object holding authentication information.
308 * @note The object's fields should not be accessed directly. Prefer using
309 * the accessor methods.
311 * In most case, authentication information consists of a username and password.
312 * Sometimes, a userid is required by proxy, and realm can be useful to discriminate
313 * different SIP domains.
315 * Once created and filled, a LinphoneAuthInfo must be added to the LinphoneCore in
316 * order to become known and used automatically when needed.
317 * Use linphone_core_add_auth_info() for that purpose.
319 * The LinphoneCore object can take the initiative to request authentication information
320 * when needed to the application through the auth_info_requested callback of the
321 * LinphoneCoreVTable structure.
323 * The application can respond to this information request later using
324 * linphone_core_add_auth_info(). This will unblock all pending authentication
325 * transactions and retry them with authentication headers.
328 typedef struct _LinphoneAuthInfo LinphoneAuthInfo;
330 LinphoneAuthInfo *linphone_auth_info_new(const char *username, const char *userid,
331 const char *passwd, const char *ha1,const char *realm);
332 void linphone_auth_info_set_passwd(LinphoneAuthInfo *info, const char *passwd);
333 void linphone_auth_info_set_username(LinphoneAuthInfo *info, const char *username);
334 void linphone_auth_info_set_userid(LinphoneAuthInfo *info, const char *userid);
336 const char *linphone_auth_info_get_username(const LinphoneAuthInfo *i);
337 const char *linphone_auth_info_get_passwd(const LinphoneAuthInfo *i);
338 const char *linphone_auth_info_get_userid(const LinphoneAuthInfo *i);
340 /* you don't need those function*/
341 void linphone_auth_info_destroy(LinphoneAuthInfo *info);
342 LinphoneAuthInfo * linphone_auth_info_new_from_config_file(struct _LpConfig *config, int pos);
344 struct _LinphoneChatRoom;
345 typedef struct _LinphoneChatRoom LinphoneChatRoom;
347 LinphoneChatRoom * linphone_core_create_chat_room(struct _LinphoneCore *lc, const char *to);
348 void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg);
349 void linphone_chat_room_destroy(LinphoneChatRoom *cr);
350 void linphone_chat_room_set_user_data(LinphoneChatRoom *cr, void * ud);
351 void * linphone_chat_room_get_user_data(LinphoneChatRoom *cr);
353 /* describes the different groups of states */
354 typedef enum _gstate_group {
360 typedef enum _gstate {
361 /* states for GSTATE_GROUP_POWER */
362 GSTATE_POWER_OFF = 0, /* initial state */
363 GSTATE_POWER_STARTUP,
365 GSTATE_POWER_SHUTDOWN,
366 /* states for GSTATE_GROUP_REG */
367 GSTATE_REG_NONE = 10, /* initial state */
370 /* states for GSTATE_GROUP_CALL */
371 GSTATE_CALL_IDLE = 20, /* initial state */
372 GSTATE_CALL_OUT_INVITE,
373 GSTATE_CALL_OUT_CONNECTED,
374 GSTATE_CALL_IN_INVITE,
375 GSTATE_CALL_IN_CONNECTED,
381 struct _LinphoneGeneralState {
384 gstate_group_t group;
387 typedef struct _LinphoneGeneralState LinphoneGeneralState;
389 /* private: set a new state */
390 void gstate_new_state(struct _LinphoneCore *lc, gstate_t new_state, const char *message);
392 void gstate_initialize(struct _LinphoneCore *lc) ;
395 * @addtogroup initializing
399 /** Callback prototype */
400 typedef void (*ShowInterfaceCb)(struct _LinphoneCore *lc);
401 /** Callback prototype */
402 typedef void (*InviteReceivedCb)(struct _LinphoneCore *lc, LinphoneCall *call);
403 /** Callback prototype */
404 typedef void (*ByeReceivedCb)(struct _LinphoneCore *lc, LinphoneCall *call);
405 /** Callback prototype */
406 typedef void (*RingingReceivedCb)(struct _LinphoneCore *lc, LinphoneCall *call);
407 /** Callback prototype */
408 typedef void (*ConnectedReceivedCb)(struct _LinphoneCore *lc, LinphoneCall *call);
409 /** Callback prototype */
410 typedef void (*FailureReceivedCb)(struct _LinphoneCore *lc, LinphoneCall *call, int error_code);
411 /** Callback prototype */
412 typedef void (*PausedReceivedCb)(struct _LinphoneCore *lc, LinphoneCall *call);
413 /** Callback prototype */
414 typedef void (*ResumedReceivedCb)(struct _LinphoneCore *lc, LinphoneCall *call);
415 /** Callback prototype */
416 typedef void (*AckPausedReceivedCb)(struct _LinphoneCore *lc, LinphoneCall *call);
417 /** Callback prototype */
418 typedef void (*AckResumedReceivedCb)(struct _LinphoneCore *lc, LinphoneCall *call);
419 /** Callback prototype */
420 typedef void (*DisplayStatusCb)(struct _LinphoneCore *lc, const char *message);
421 /** Callback prototype */
422 typedef void (*DisplayMessageCb)(struct _LinphoneCore *lc, const char *message);
423 /** Callback prototype */
424 typedef void (*DisplayUrlCb)(struct _LinphoneCore *lc, const char *message, const char *url);
425 /** Callback prototype */
426 typedef void (*DisplayQuestionCb)(struct _LinphoneCore *lc, const char *message);
427 /** Callback prototype */
428 typedef void (*LinphoneCoreCbFunc)(struct _LinphoneCore *lc,void * user_data);
429 /** Callback prototype */
430 typedef void (*NotifyReceivedCb)(struct _LinphoneCore *lc, const char *from, const char *msg);
431 /** Callback prototype */
432 typedef void (*NotifyPresenceReceivedCb)(struct _LinphoneCore *lc, LinphoneFriend * fid);
433 /** Callback prototype */
434 typedef void (*NewUnknownSubscriberCb)(struct _LinphoneCore *lc, LinphoneFriend *lf, const char *url);
435 /** Callback prototype */
436 typedef void (*AuthInfoRequested)(struct _LinphoneCore *lc, const char *realm, const char *username);
437 /** Callback prototype */
438 typedef void (*CallLogUpdated)(struct _LinphoneCore *lc, struct _LinphoneCallLog *newcl);
439 /** Callback prototype */
440 typedef void (*TextMessageReceived)(struct _LinphoneCore *lc, LinphoneChatRoom *room, const char *from, const char *message);
441 /** Callback prototype */
442 typedef void (*GeneralStateChange)(struct _LinphoneCore *lc, LinphoneGeneralState *gstate);
443 /** Callback prototype */
444 typedef void (*DtmfReceived)(struct _LinphoneCore* lc, int dtmf);
445 /** Callback prototype */
446 typedef void (*ReferReceived)(struct _LinphoneCore *lc, LinphoneCall *call, const char *refer_to);
447 /** Callback prototype */
448 typedef void (*BuddyInfoUpdated)(struct _LinphoneCore *lc, LinphoneFriend *lf);
451 * This structure holds all callbacks that the application should implement.
454 typedef struct _LinphoneVTable
456 ShowInterfaceCb show; /**< Notifies the application that it should show up*/
457 InviteReceivedCb inv_recv; /**< Notifies incoming calls */
458 ByeReceivedCb bye_recv; /**< Notify calls terminated by far end*/
459 RingingReceivedCb ringing_recv; /**< Notify that the distant phone is ringing*/
460 ConnectedReceivedCb connected_recv; /**< Notify that the distant phone answered the call*/
461 FailureReceivedCb failure_recv; /**< Notify that the call failed*/
462 PausedReceivedCb paused_recv; /**< Notify that the call has been paused*/
463 ResumedReceivedCb resumed_recv; /**< Notify that the call has been resumed*/
464 AckPausedReceivedCb ack_paused_recv;/**< Notify that the previous command pause sent to the call has been acknowledge*/
465 AckResumedReceivedCb ack_resumed_recv;/**< Notify that the previous command resumed sent to the call has been acknowledge*/
466 NotifyPresenceReceivedCb notify_presence_recv; /**< Notify received presence events*/
467 NewUnknownSubscriberCb new_unknown_subscriber; /**< Notify about unknown subscriber */
468 AuthInfoRequested auth_info_requested; /**< Ask the application some authentication information */
469 DisplayStatusCb display_status; /**< Callback that notifies various events with human readable text.*/
470 DisplayMessageCb display_message;/**< Callback to display a message to the user */
471 DisplayMessageCb display_warning;/** Callback to display a warning to the user */
472 DisplayUrlCb display_url;
473 DisplayQuestionCb display_question;
474 CallLogUpdated call_log_updated; /**< Notifies that call log list has been updated */
475 TextMessageReceived text_received; /**< A text message has been received */
476 GeneralStateChange general_state; /**< State notification callback */
477 DtmfReceived dtmf_received; /**< A dtmf has been received received */
478 ReferReceived refer_received; /**< A refer was received */
479 BuddyInfoUpdated buddy_info_updated; /**< a LinphoneFriend's BuddyInfo has changed*/
480 NotifyReceivedCb notify_recv; /**< Other notifications*/
481 } LinphoneCoreVTable;
487 typedef struct _LCCallbackObj
489 LinphoneCoreCbFunc _func;
495 typedef enum _LinphoneFirewallPolicy{
496 LINPHONE_POLICY_NO_FIREWALL,
497 LINPHONE_POLICY_USE_NAT_ADDRESS,
498 LINPHONE_POLICY_USE_STUN
499 } LinphoneFirewallPolicy;
501 typedef enum _LinphoneWaitingState{
502 LinphoneWaitingStart,
503 LinphoneWaitingProgress,
504 LinphoneWaitingFinished
505 } LinphoneWaitingState;
506 typedef void * (*LinphoneWaitingCallback)(struct _LinphoneCore *lc, void *context, LinphoneWaitingState ws, const char *purpose, float progress);
508 typedef struct _LinphoneCore LinphoneCore;
512 void linphone_core_enable_logs(FILE *file);
513 void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc);
514 void linphone_core_disable_logs(void);
515 /*sets the user-agent string in sip messages, must be set before linphone_core_new() or linphone_core_init() */
516 void linphone_core_set_user_agent(const char *ua_name, const char *version);
517 const char *linphone_core_get_version(void);
519 LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable,
520 const char *config_path, const char *factory_config, void* userdata);
522 /* function to be periodically called in a main loop */
523 void linphone_core_iterate(LinphoneCore *lc);
525 LinphoneAddress * linphone_core_interpret_url(LinphoneCore *lc, const char *url);
527 LinphoneCall * linphone_core_invite(LinphoneCore *lc, const char *url);
529 LinphoneCall * linphone_core_invite_address(LinphoneCore *lc, const LinphoneAddress *addr);
531 int linphone_core_refer(LinphoneCore *lc, LinphoneCall *call, const char *url);
533 bool_t linphone_core_inc_invite_pending(LinphoneCore*lc);
535 bool_t linphone_core_in_call(const LinphoneCore *lc);
537 LinphoneCall *linphone_core_get_current_call(LinphoneCore *lc);
539 int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call);
541 int linphone_core_terminate_call(LinphoneCore *lc, LinphoneCall *call);
543 int linphone_core_terminate_all_calls(LinphoneCore *lc);
545 int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call);
547 int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *call);
549 LinphoneCall *linphone_core_get_call_by_remote_address(LinphoneCore *lc, const char *remote_address);
551 void linphone_core_send_dtmf(LinphoneCore *lc,char dtmf);
553 int linphone_core_set_primary_contact(LinphoneCore *lc, const char *contact);
555 const char *linphone_core_get_primary_contact(LinphoneCore *lc);
557 void linphone_core_set_guess_hostname(LinphoneCore *lc, bool_t val);
558 bool_t linphone_core_get_guess_hostname(LinphoneCore *lc);
560 bool_t linphone_core_ipv6_enabled(LinphoneCore *lc);
561 void linphone_core_enable_ipv6(LinphoneCore *lc, bool_t val);
563 LinphoneAddress *linphone_core_get_primary_contact_parsed(LinphoneCore *lc);
565 /*0= no bandwidth limit*/
566 void linphone_core_set_download_bandwidth(LinphoneCore *lc, int bw);
567 void linphone_core_set_upload_bandwidth(LinphoneCore *lc, int bw);
569 int linphone_core_get_download_bandwidth(const LinphoneCore *lc);
570 int linphone_core_get_upload_bandwidth(const LinphoneCore *lc);
572 * set audio packetization time linphone expect to received from peer
573 * @ingroup media_parameters
576 void linphone_core_set_download_ptime(LinphoneCore *lc, int ptime);
578 * get audio packetization time linphone expect to received from peer, 0 means unspecified
579 * @ingroup media_parameters
581 int linphone_core_get_download_ptime(LinphoneCore *lc);
583 #ifdef VINCENT_MAURY_RSVP
585 int linphone_core_set_rpc_mode(LinphoneCore *lc, int on); /* on = 1 (RPC_ENABLE = 1) */
586 int linphone_core_set_rsvp_mode(LinphoneCore *lc, int on); /* on = 1 (RSVP_ENABLE = 1) */
587 int linphone_core_change_qos(LinphoneCore *lc, int answer); /* answer = 1 for yes, 0 for no */
590 /* returns a MSList of PayloadType */
591 const MSList *linphone_core_get_audio_codecs(const LinphoneCore *lc);
593 int linphone_core_set_audio_codecs(LinphoneCore *lc, MSList *codecs);
594 /* returns a MSList of PayloadType */
595 const MSList *linphone_core_get_video_codecs(const LinphoneCore *lc);
597 int linphone_core_set_video_codecs(LinphoneCore *lc, MSList *codecs);
599 bool_t linphone_core_payload_type_enabled(LinphoneCore *lc, PayloadType *pt);
601 int linphone_core_enable_payload_type(LinphoneCore *lc, PayloadType *pt, bool_t enable);
603 const char *linphone_core_get_payload_type_description(LinphoneCore *lc, PayloadType *pt);
605 bool_t linphone_core_check_payload_type_usability(LinphoneCore *lc, PayloadType *pt);
607 int linphone_core_add_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *config);
609 void linphone_core_clear_proxy_config(LinphoneCore *lc);
611 void linphone_core_remove_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *config);
613 const MSList *linphone_core_get_proxy_config_list(const LinphoneCore *lc);
615 void linphone_core_set_default_proxy(LinphoneCore *lc, LinphoneProxyConfig *config);
617 void linphone_core_set_default_proxy_index(LinphoneCore *lc, int index);
619 int linphone_core_get_default_proxy(LinphoneCore *lc, LinphoneProxyConfig **config);
621 void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info);
623 void linphone_core_remove_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info);
625 const MSList *linphone_core_get_auth_info_list(const LinphoneCore *lc);
627 const LinphoneAuthInfo *linphone_core_find_auth_info(LinphoneCore *lc, const char *realm, const char *username);
629 void linphone_core_abort_authentication(LinphoneCore *lc, LinphoneAuthInfo *info);
631 void linphone_core_clear_all_auth_info(LinphoneCore *lc);
633 int linphone_core_get_audio_jittcomp(LinphoneCore *lc);
635 void linphone_core_set_audio_jittcomp(LinphoneCore *lc, int value);
637 int linphone_core_get_audio_port(const LinphoneCore *lc);
639 int linphone_core_get_video_port(const LinphoneCore *lc);
641 int linphone_core_get_nortp_timeout(const LinphoneCore *lc);
643 void linphone_core_set_audio_port(LinphoneCore *lc, int port);
645 void linphone_core_set_video_port(LinphoneCore *lc, int port);
647 void linphone_core_set_nortp_timeout(LinphoneCore *lc, int port);
649 void linphone_core_set_use_info_for_dtmf(LinphoneCore *lc, bool_t use_info);
651 bool_t linphone_core_get_use_info_for_dtmf(LinphoneCore *lc);
653 void linphone_core_set_use_rfc2833_for_dtmf(LinphoneCore *lc,bool_t use_rfc2833);
655 bool_t linphone_core_get_use_rfc2833_for_dtmf(LinphoneCore *lc);
657 int linphone_core_get_sip_port(LinphoneCore *lc);
659 int linphone_core_set_sip_port(LinphoneCore *lc,int port);
661 ortp_socket_t linphone_core_get_sip_socket(LinphoneCore *lc);
663 void linphone_core_set_inc_timeout(LinphoneCore *lc, int seconds);
665 int linphone_core_get_inc_timeout(LinphoneCore *lc);
667 void linphone_core_set_stun_server(LinphoneCore *lc, const char *server);
669 const char * linphone_core_get_stun_server(const LinphoneCore *lc);
671 void linphone_core_set_nat_address(LinphoneCore *lc, const char *addr);
673 const char *linphone_core_get_nat_address(const LinphoneCore *lc);
675 void linphone_core_set_firewall_policy(LinphoneCore *lc, LinphoneFirewallPolicy pol);
677 LinphoneFirewallPolicy linphone_core_get_firewall_policy(const LinphoneCore *lc);
679 const char * linphone_core_get_relay_addr(const LinphoneCore *lc);
681 int linphone_core_set_relay_addr(LinphoneCore *lc, const char *addr);
683 /* sound functions */
684 /* returns a null terminated static array of string describing the sound devices */
685 const char** linphone_core_get_sound_devices(LinphoneCore *lc);
686 bool_t linphone_core_sound_device_can_capture(LinphoneCore *lc, const char *device);
687 bool_t linphone_core_sound_device_can_playback(LinphoneCore *lc, const char *device);
688 int linphone_core_get_ring_level(LinphoneCore *lc);
689 int linphone_core_get_play_level(LinphoneCore *lc);
690 int linphone_core_get_rec_level(LinphoneCore *lc);
691 void linphone_core_set_ring_level(LinphoneCore *lc, int level);
692 void linphone_core_set_play_level(LinphoneCore *lc, int level);
694 * Allow to control play level before entering sound card: level in db
696 * @ingroup media_parameters
698 void linphone_core_set_soft_play_level(LinphoneCore *lc, float level);
700 * get play level before entering sound card: level in db
702 * @ingroup media_parameters
704 float linphone_core_get_soft_play_level(LinphoneCore *lc);
705 void linphone_core_set_rec_level(LinphoneCore *lc, int level);
706 const char * linphone_core_get_ringer_device(LinphoneCore *lc);
707 const char * linphone_core_get_playback_device(LinphoneCore *lc);
708 const char * linphone_core_get_capture_device(LinphoneCore *lc);
709 int linphone_core_set_ringer_device(LinphoneCore *lc, const char * devid);
710 int linphone_core_set_playback_device(LinphoneCore *lc, const char * devid);
711 int linphone_core_set_capture_device(LinphoneCore *lc, const char * devid);
712 char linphone_core_get_sound_source(LinphoneCore *lc);
713 void linphone_core_set_sound_source(LinphoneCore *lc, char source);
714 void linphone_core_set_ring(LinphoneCore *lc, const char *path);
715 const char *linphone_core_get_ring(const LinphoneCore *lc);
716 void linphone_core_set_ringback(LinphoneCore *lc, const char *path);
717 const char * linphone_core_get_ringback(const LinphoneCore *lc);
718 int linphone_core_preview_ring(LinphoneCore *lc, const char *ring,LinphoneCoreCbFunc func,void * userdata);
719 void linphone_core_enable_echo_cancellation(LinphoneCore *lc, bool_t val);
720 bool_t linphone_core_echo_cancellation_enabled(LinphoneCore *lc);
722 void linphone_core_enable_echo_limiter(LinphoneCore *lc, bool_t val);
723 bool_t linphone_core_echo_limiter_enabled(const LinphoneCore *lc);
725 void linphone_core_enable_agc(LinphoneCore *lc, bool_t val);
726 bool_t linphone_core_agc_enabled(const LinphoneCore *lc);
728 void linphone_core_mute_mic(LinphoneCore *lc, bool_t muted);
732 * @ingroup media_parameters
734 bool_t linphone_core_is_mic_muted(LinphoneCore *lc);
736 void linphone_core_set_presence_info(LinphoneCore *lc,int minutes_away,const char *contact,LinphoneOnlineStatus os);
738 LinphoneOnlineStatus linphone_core_get_presence_info(const LinphoneCore *lc);
740 void linphone_core_interpret_friend_uri(LinphoneCore *lc, const char *uri, char **result);
741 void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *fr);
742 void linphone_core_remove_friend(LinphoneCore *lc, LinphoneFriend *fr);
743 void linphone_core_reject_subscriber(LinphoneCore *lc, LinphoneFriend *lf);
744 /* a list of LinphoneFriend */
745 const MSList * linphone_core_get_friend_list(const LinphoneCore *lc);
746 /* notify all friends that have subscribed */
747 void linphone_core_notify_all_friends(LinphoneCore *lc, LinphoneOnlineStatus os);
748 LinphoneFriend *linphone_core_get_friend_by_address(const LinphoneCore *lc, const char *addr);
749 LinphoneFriend *linphone_core_get_friend_by_ref_key(const LinphoneCore *lc, const char *key);
751 /* returns a list of LinphoneCallLog */
752 const MSList * linphone_core_get_call_logs(LinphoneCore *lc);
753 void linphone_core_clear_call_logs(LinphoneCore *lc);
756 void linphone_core_enable_video(LinphoneCore *lc, bool_t vcap_enabled, bool_t display_enabled);
757 bool_t linphone_core_video_enabled(LinphoneCore *lc);
759 typedef struct MSVideoSizeDef{
763 /* returns a zero terminated table of MSVideoSizeDef*/
764 const MSVideoSizeDef *linphone_core_get_supported_video_sizes(LinphoneCore *lc);
765 void linphone_core_set_preferred_video_size(LinphoneCore *lc, MSVideoSize vsize);
766 MSVideoSize linphone_core_get_preferred_video_size(LinphoneCore *lc);
767 void linphone_core_set_preferred_video_size_by_name(LinphoneCore *lc, const char *name);
769 void linphone_core_enable_video_preview(LinphoneCore *lc, bool_t val);
770 bool_t linphone_core_video_preview_enabled(const LinphoneCore *lc);
772 void linphone_core_enable_self_view(LinphoneCore *lc, bool_t val);
773 bool_t linphone_core_self_view_enabled(const LinphoneCore *lc);
776 /* returns a null terminated static array of string describing the webcams */
777 const char** linphone_core_get_video_devices(const LinphoneCore *lc);
778 int linphone_core_set_video_device(LinphoneCore *lc, const char *id);
779 const char *linphone_core_get_video_device(const LinphoneCore *lc);
781 /* Set static picture to be used when "Static picture" is the video device */
782 int linphone_core_set_static_picture(LinphoneCore *lc, const char *path);
784 /*function to be used for eventually setting window decorations (icons, title...)*/
785 unsigned long linphone_core_get_native_video_window_id(const LinphoneCore *lc);
788 /*play/record support: use files instead of soundcard*/
789 void linphone_core_use_files(LinphoneCore *lc, bool_t yesno);
790 void linphone_core_set_play_file(LinphoneCore *lc, const char *file);
791 void linphone_core_set_record_file(LinphoneCore *lc, const char *file);
793 gstate_t linphone_core_get_state(const LinphoneCore *lc, gstate_group_t group);
794 int linphone_core_get_current_call_duration(const LinphoneCore *lc);
795 const LinphoneAddress *linphone_core_get_remote_address(LinphoneCore *lc);
797 int linphone_core_get_mtu(const LinphoneCore *lc);
798 void linphone_core_set_mtu(LinphoneCore *lc, int mtu);
801 * This method is called by the application to notify the linphone core library when network is reachable.
802 * Calling this method with true trigger linphone to initiate a registration process for all proxy
803 * configuration with parameter register set to enable.
804 * This method disable the automatic registration mode. It means you must call this method after each network state changes
807 void linphone_core_set_network_reachable(LinphoneCore* lc,bool_t value);
809 * return network state either as positioned by the application or by linphone
811 bool_t linphone_core_is_network_reachabled(LinphoneCore* lc);
814 void *linphone_core_get_user_data(LinphoneCore *lc);
816 /* returns LpConfig object to read/write to the config file: usefull if you wish to extend
817 the config file with your own sections */
818 struct _LpConfig *linphone_core_get_config(LinphoneCore *lc);
820 /* attempts to wake up another linphone engine already running.
821 The "show" callback is called for the other linphone, causing gui to show up.
822 call_addr is an optional sip-uri to call immediately after waking up.
823 The method returns 0 if an already running linphone was found*/
825 int linphone_core_wake_up_possible_already_running_instance(
826 const char * config_file, const char * call_addr);
828 /*set a callback for some blocking operations, it takes you informed of the progress of the operation*/
829 void linphone_core_set_waiting_callback(LinphoneCore *lc, LinphoneWaitingCallback cb, void *user_context);
831 /*returns the list of registered SipSetup (linphonecore plugins) */
832 const MSList * linphone_core_get_sip_setups(LinphoneCore *lc);
834 void linphone_core_destroy(LinphoneCore *lc);
836 /*for advanced users:*/
837 void linphone_core_set_audio_transports(LinphoneCore *lc, RtpTransport *rtp, RtpTransport *rtcp);
839 int linphone_core_get_current_call_stats(LinphoneCore *lc, rtp_stats_t *local, rtp_stats_t *remote);
844 MSList *linphone_core_get_calls(LinphoneCore *lc);
845 void *linphone_call_get_user_pointer(LinphoneCall *call);
846 void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer);