3 Copyright (C) 2000 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
43 bool_t payload_type_enabled(struct _PayloadType *pt);
44 void payload_type_set_enable(struct _PayloadType *pt,int value);
45 const char *payload_type_get_description(struct _PayloadType *pt);
46 int payload_type_get_bitrate(PayloadType *pt);
47 const char *payload_type_get_mime(PayloadType *pt);
48 int payload_type_get_rate(PayloadType *pt);
53 typedef struct sip_config
56 char *guessed_contact;
59 MSList *deleted_proxies;
60 int inc_timeout; /*timeout after an un-answered incoming call is rejected*/
62 bool_t use_rfc2833; /*force RFC2833 to be sent*/
63 bool_t guess_hostname;
67 bool_t only_one_codec; /*in SDP answers*/
68 bool_t register_only_when_network_is_up;
71 typedef struct rtp_config
75 int audio_jitt_comp; /*jitter compensation*/
76 int video_jitt_comp; /*jitter compensation*/
82 typedef struct net_config
95 typedef struct sound_config
97 struct _MSSndCard * ring_sndcard; /* the playback sndcard currently used */
98 struct _MSSndCard * play_sndcard; /* the playback sndcard currently used */
99 struct _MSSndCard * capt_sndcard; /* the capture sndcard currently used */
101 int latency; /* latency in samples of the current used sound device */
113 typedef struct codecs_config
115 MSList *audio_codecs; /* list of audio codecs in order of preference*/
116 MSList *video_codecs; /* for later use*/
119 typedef struct video_config{
120 struct _MSWebCam *device;
126 bool_t selfview; /*during calls*/
129 typedef struct ui_config
133 unsigned int timer_id; /* the timer id for registration */
138 typedef struct autoreplier_config
141 int after_seconds; /* accept the call after x seconds*/
142 int max_users; /* maximum number of user that can call simultaneously */
143 int max_rec_time; /* the max time of incoming voice recorded */
144 int max_rec_msg; /* maximum number of recorded messages */
145 const char *message; /* the path of the file to be played */
146 }autoreplier_config_t;
151 * Object that represents a SIP address.
153 * The LinphoneAddress is an opaque object to represents SIP addresses, ie
154 * the content of SIP's 'from' and 'to' headers.
155 * A SIP address is made of display name, username, domain name, port, and various
156 * uri headers (such as tags). It looks like 'Alice <sip:alice@example.net>'.
157 * The LinphoneAddress has methods to extract and manipulate all parts of the address.
158 * When some part of the address (for example the username) is empty, the accessor methods
161 * @ingroup linphone_address
162 * @var LinphoneAddress
164 typedef struct osip_from LinphoneAddress;
166 LinphoneAddress * linphone_address_new(const char *uri);
167 LinphoneAddress * linphone_address_clone(const LinphoneAddress *uri);
168 const char *linphone_address_get_scheme(const LinphoneAddress *u);
169 const char *linphone_address_get_display_name(const LinphoneAddress* u);
170 const char *linphone_address_get_username(const LinphoneAddress *u);
171 const char *linphone_address_get_domain(const LinphoneAddress *u);
172 void linphone_address_set_display_name(LinphoneAddress *u, const char *display_name);
173 void linphone_address_set_username(LinphoneAddress *uri, const char *username);
174 void linphone_address_set_domain(LinphoneAddress *uri, const char *host);
175 void linphone_address_set_port(LinphoneAddress *uri, const char *port);
176 void linphone_address_set_port_int(LinphoneAddress *uri, int port);
177 /*remove tags, params etc... so that it is displayable to the user*/
178 void linphone_address_clean(LinphoneAddress *uri);
179 char *linphone_address_as_string(const LinphoneAddress *u);
180 char *linphone_address_as_string_uri_only(const LinphoneAddress *u);
181 void linphone_address_destroy(LinphoneAddress *u);
183 struct _LinphoneCore;
185 struct _SipSetupContext;
186 struct _LinphoneCall;
189 * Enum representing the direction of a call.
192 enum _LinphoneCallDir {
193 LinphoneCallOutgoing, /**< outgoing calls*/
194 LinphoneCallIncoming /**< incoming calls*/
201 typedef enum _LinphoneCallDir LinphoneCallDir;
204 * Enum representing the status of a call
207 typedef enum _LinphoneCallStatus {
208 LinphoneCallSuccess, /**< The call was sucessful*/
209 LinphoneCallAborted, /**< The call was aborted */
210 LinphoneCallMissed /**< The call was missed (unanswered)*/
211 } LinphoneCallStatus;
214 * Structure representing a call log.
219 typedef struct _LinphoneCallLog{
220 LinphoneCallDir dir; /**< The direction of the call*/
221 LinphoneCallStatus status; /**< The status of the call*/
222 LinphoneAddress *from; /**<Originator of the call as a LinphoneAddress object*/
223 LinphoneAddress *to; /**<Destination of the call as a LinphoneAddress object*/
224 char start_date[128]; /**<Human readable string containg the start date*/
225 int duration; /**<Duration of the call in seconds*/
228 struct _LinphoneCore *lc;
234 void linphone_call_log_set_user_pointer(LinphoneCallLog *cl, void *up);
235 void *linphone_call_log_get_user_pointer(const LinphoneCallLog *cl);
236 void linphone_call_log_set_ref_key(LinphoneCallLog *cl, const char *refkey);
237 const char *linphone_call_log_get_ref_key(const LinphoneCallLog *cl);
238 char * linphone_call_log_to_str(LinphoneCallLog *cl);
244 }LinphoneSubscribePolicy;
246 typedef enum _LinphoneOnlineStatus{
247 LINPHONE_STATUS_UNKNOWN,
248 LINPHONE_STATUS_ONLINE,
249 LINPHONE_STATUS_BUSY,
250 LINPHONE_STATUS_BERIGHTBACK,
251 LINPHONE_STATUS_AWAY,
252 LINPHONE_STATUS_ONTHEPHONE,
253 LINPHONE_STATUS_OUTTOLUNCH,
254 LINPHONE_STATUS_NOT_DISTURB,
255 LINPHONE_STATUS_MOVED,
256 LINPHONE_STATUS_ALT_SERVICE,
257 LINPHONE_STATUS_OFFLINE,
258 LINPHONE_STATUS_PENDING,
259 LINPHONE_STATUS_CLOSED,
261 }LinphoneOnlineStatus;
263 const char *linphone_online_status_to_string(LinphoneOnlineStatus ss);
265 typedef struct _LinphoneFriend{
266 LinphoneAddress *uri;
271 LinphoneSubscribePolicy pol;
272 LinphoneOnlineStatus status;
273 struct _LinphoneProxyConfig *proxy;
274 struct _LinphoneCore *lc;
278 bool_t inc_subscribe_pending;
281 LinphoneFriend * linphone_friend_new();
282 LinphoneFriend *linphone_friend_new_with_addr(const char *addr);
283 int linphone_friend_set_sip_addr(LinphoneFriend *fr, const char *uri);
284 int linphone_friend_set_name(LinphoneFriend *fr, const char *name);
285 int linphone_friend_send_subscribe(LinphoneFriend *fr, bool_t val);
286 int linphone_friend_set_inc_subscribe_policy(LinphoneFriend *fr, LinphoneSubscribePolicy pol);
287 int linphone_friend_set_proxy(LinphoneFriend *fr, struct _LinphoneProxyConfig *cfg);
288 void linphone_friend_edit(LinphoneFriend *fr);
289 void linphone_friend_done(LinphoneFriend *fr);
290 void linphone_friend_destroy(LinphoneFriend *lf);
291 const LinphoneAddress *linphone_friend_get_uri(const LinphoneFriend *lf);
292 bool_t linphone_friend_get_send_subscribe(const LinphoneFriend *lf);
293 LinphoneSubscribePolicy linphone_friend_get_inc_subscribe_policy(const LinphoneFriend *lf);
294 LinphoneOnlineStatus linphone_friend_get_status(const LinphoneFriend *lf);
295 BuddyInfo * linphone_friend_get_info(const LinphoneFriend *lf);
296 void linphone_friend_set_ref_key(LinphoneFriend *lf, const char *key);
297 const char *linphone_friend_get_ref_key(const LinphoneFriend *lf);
298 #define linphone_friend_in_list(lf) ((lf)->lc!=NULL)
300 #define linphone_friend_url(lf) ((lf)->url)
303 * @addtogroup proxies
307 * The LinphoneProxyConfig object represents a proxy configuration to be used
308 * by the LinphoneCore object.
309 * Its fields must not be used directly in favour of the accessors methods.
310 * Once created and filled properly the LinphoneProxyConfig can be given to
311 * LinphoneCore with linphone_core_add_proxy_config().
312 * This will automatically triggers the registration, if enabled.
314 * The proxy configuration are persistent to restarts because they are saved
315 * in the configuration file. As a consequence, after linphone_core_new() there
316 * might already be a list of configured proxy that can be examined with
317 * linphone_core_get_proxy_config_list().
319 * The default proxy (see linphone_core_set_default_proxy() ) is the one of the list
320 * that is used by default for calls.
322 typedef struct _LinphoneProxyConfig
324 struct _LinphoneCore *lc;
333 struct _SipSetupContext *ssctx;
335 char *contact_addr; /* our IP address as seen by the proxy, read from via 's received= parameter*/
336 int contact_port; /*our IP port as seen by the proxy, read from via's rport= parameter */
339 bool_t reg_sendregister;
342 bool_t dial_escape_plus;
343 } LinphoneProxyConfig;
345 LinphoneProxyConfig *linphone_proxy_config_new(void);
346 int linphone_proxy_config_set_server_addr(LinphoneProxyConfig *obj, const char *server_addr);
347 void linphone_proxy_config_set_identity(LinphoneProxyConfig *obj, const char *identity);
348 void linphone_proxy_config_set_route(LinphoneProxyConfig *obj, const char *route);
349 void linphone_proxy_config_expires(LinphoneProxyConfig *obj, int expires);
350 void linphone_proxy_config_enable_register(LinphoneProxyConfig *obj, bool_t val);
351 #define linphone_proxy_config_enableregister linphone_proxy_config_enable_register
352 void linphone_proxy_config_edit(LinphoneProxyConfig *obj);
353 int linphone_proxy_config_done(LinphoneProxyConfig *obj);
354 void linphone_proxy_config_enable_publish(LinphoneProxyConfig *obj, bool_t val);
355 bool_t linphone_proxy_config_is_registered(const LinphoneProxyConfig *obj);
356 const char *linphone_proxy_config_get_domain(const LinphoneProxyConfig *cfg);
357 /** Returns the proxy configured identity as a const char * */
358 #define linphone_proxy_config_get_route(obj) ((obj)->reg_route)
359 /** Returns the proxy configured identity as a const char * */
360 #define linphone_proxy_config_get_identity(obj) ((obj)->reg_identity)
361 #define linphone_proxy_config_publish_enabled(obj) ((obj)->publish)
362 /** Returns the proxy sip address as const char * */
363 #define linphone_proxy_config_get_addr(obj) ((obj)->reg_proxy)
364 /** Returns the 'expire' time of the registration */
365 #define linphone_proxy_config_get_expires(obj) ((obj)->expires)
366 /** Returns TRUE if registration is enabled, FALSE otherwise */
367 #define linphone_proxy_config_register_enabled(obj) ((obj)->reg_sendregister)
368 #define linphone_proxy_config_get_core(obj) ((obj)->lc)
369 /* destruction is called automatically when removing the proxy config */
370 void linphone_proxy_config_destroy(LinphoneProxyConfig *cfg);
371 void linphone_proxy_config_set_sip_setup(LinphoneProxyConfig *cfg, const char *type);
372 SipSetupContext *linphone_proxy_config_get_sip_setup_context(LinphoneProxyConfig *cfg);
373 SipSetup *linphone_proxy_config_get_sip_setup(LinphoneProxyConfig *cfg);
379 typedef struct _LinphoneAccountCreator{
380 struct _LinphoneCore *lc;
381 struct _SipSetupContext *ssctx;
386 }LinphoneAccountCreator;
388 LinphoneAccountCreator *linphone_account_creator_new(struct _LinphoneCore *core, const char *type);
389 void linphone_account_creator_set_username(LinphoneAccountCreator *obj, const char *username);
390 void linphone_account_creator_set_password(LinphoneAccountCreator *obj, const char *password);
391 void linphone_account_creator_set_domain(LinphoneAccountCreator *obj, const char *domain);
392 const char * linphone_account_creator_get_username(LinphoneAccountCreator *obj);
393 const char * linphone_account_creator_get_domain(LinphoneAccountCreator *obj);
394 int linphone_account_creator_test_existence(LinphoneAccountCreator *obj);
395 LinphoneProxyConfig * linphone_account_creator_validate(LinphoneAccountCreator *obj);
396 void linphone_account_creator_destroy(LinphoneAccountCreator *obj);
399 * @ingroup authentication
400 * Object holding authentication information.
402 * @note The object's fields should not be accessed directly. Prefer using
403 * the accessor methods.
405 * In most case, authentication information consists of a username and password.
406 * Sometimes, a userid is required by proxy, and realm can be useful to discriminate
407 * different SIP domains.
409 * Once created and filled, a LinphoneAuthInfo must be added to the LinphoneCore in
410 * order to become known and used automatically when needed.
411 * Use linphone_core_add_auth_info() for that purpose.
413 * The LinphoneCore object can take the initiative to request authentication information
414 * when needed to the application through the auth_info_requested callback of the
415 * LinphoneCoreVTable structure.
417 * The application can respond to this information request later using
418 * linphone_core_add_auth_info(). This will unblock all pending authentication
419 * transactions and retry them with authentication headers.
422 typedef struct _LinphoneAuthInfo
433 LinphoneAuthInfo *linphone_auth_info_new(const char *username, const char *userid,
434 const char *passwd, const char *ha1,const char *realm);
435 void linphone_auth_info_set_passwd(LinphoneAuthInfo *info, const char *passwd);
436 void linphone_auth_info_set_username(LinphoneAuthInfo *info, const char *username);
437 void linphone_auth_info_set_userid(LinphoneAuthInfo *info, const char *userid);
438 /* you don't need those function*/
439 void linphone_auth_info_destroy(LinphoneAuthInfo *info);
440 LinphoneAuthInfo * linphone_auth_info_new_from_config_file(struct _LpConfig *config, int pos);
442 struct _LinphoneChatRoom{
443 struct _LinphoneCore *lc;
446 LinphoneAddress *peer_url;
449 typedef struct _LinphoneChatRoom LinphoneChatRoom;
451 LinphoneChatRoom * linphone_core_create_chat_room(struct _LinphoneCore *lc, const char *to);
452 void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg);
453 void linphone_chat_room_destroy(LinphoneChatRoom *cr);
454 void linphone_chat_room_set_user_data(LinphoneChatRoom *cr, void * ud);
455 void * linphone_chat_room_get_user_data(LinphoneChatRoom *cr);
457 /* describes the different groups of states */
458 typedef enum _gstate_group {
464 typedef enum _gstate {
465 /* states for GSTATE_GROUP_POWER */
466 GSTATE_POWER_OFF = 0, /* initial state */
467 GSTATE_POWER_STARTUP,
469 GSTATE_POWER_SHUTDOWN,
470 /* states for GSTATE_GROUP_REG */
471 GSTATE_REG_NONE = 10, /* initial state */
474 /* states for GSTATE_GROUP_CALL */
475 GSTATE_CALL_IDLE = 20, /* initial state */
476 GSTATE_CALL_OUT_INVITE,
477 GSTATE_CALL_OUT_CONNECTED,
478 GSTATE_CALL_IN_INVITE,
479 GSTATE_CALL_IN_CONNECTED,
485 struct _LinphoneGeneralState {
488 gstate_group_t group;
491 typedef struct _LinphoneGeneralState LinphoneGeneralState;
493 /* private: set a new state */
494 void gstate_new_state(struct _LinphoneCore *lc, gstate_t new_state, const char *message);
496 void gstate_initialize(struct _LinphoneCore *lc) ;
499 * @addtogroup initializing
503 /** Callback prototype */
504 typedef void (*ShowInterfaceCb)(struct _LinphoneCore *lc);
505 /** Callback prototype */
506 typedef void (*InviteReceivedCb)(struct _LinphoneCore *lc, const char *from);
507 /** Callback prototype */
508 typedef void (*ByeReceivedCb)(struct _LinphoneCore *lc, const char *from);
509 /** Callback prototype */
510 typedef void (*DisplayStatusCb)(struct _LinphoneCore *lc, const char *message);
511 /** Callback prototype */
512 typedef void (*DisplayMessageCb)(struct _LinphoneCore *lc, const char *message);
513 /** Callback prototype */
514 typedef void (*DisplayUrlCb)(struct _LinphoneCore *lc, const char *message, const char *url);
515 /** Callback prototype */
516 typedef void (*DisplayQuestionCb)(struct _LinphoneCore *lc, const char *message);
517 /** Callback prototype */
518 typedef void (*LinphoneCoreCbFunc)(struct _LinphoneCore *lc,void * user_data);
519 /** Callback prototype */
520 typedef void (*NotifyReceivedCb)(struct _LinphoneCore *lc, LinphoneFriend * fid, const char *url, const char *status, const char *img);
521 /** Callback prototype */
522 typedef void (*NewUnknownSubscriberCb)(struct _LinphoneCore *lc, LinphoneFriend *lf, const char *url);
523 /** Callback prototype */
524 typedef void (*AuthInfoRequested)(struct _LinphoneCore *lc, const char *realm, const char *username);
525 /** Callback prototype */
526 typedef void (*CallLogUpdated)(struct _LinphoneCore *lc, struct _LinphoneCallLog *newcl);
527 /** Callback prototype */
528 typedef void (*TextMessageReceived)(struct _LinphoneCore *lc, LinphoneChatRoom *room, const char *from, const char *message);
529 /** Callback prototype */
530 typedef void (*GeneralStateChange)(struct _LinphoneCore *lc, LinphoneGeneralState *gstate);
531 /** Callback prototype */
532 typedef void (*DtmfReceived)(struct _LinphoneCore* lc, int dtmf);
533 /** Callback prototype */
534 typedef void (*ReferReceived)(struct _LinphoneCore *lc, const char *refer_to);
535 /** Callback prototype */
536 typedef void (*BuddyInfoUpdated)(struct _LinphoneCore *lc, LinphoneFriend *lf);
539 * This structure holds all callbacks that the application should implement.
542 typedef struct _LinphoneVTable
544 ShowInterfaceCb show; /**< Notifies the application that it should show up*/
545 InviteReceivedCb inv_recv; /**< Notifies incoming calls */
546 ByeReceivedCb bye_recv; /**< Notify calls terminated by far end*/
547 NotifyReceivedCb notify_recv; /**< Notify received presence events*/
548 NewUnknownSubscriberCb new_unknown_subscriber; /**< Notify about unknown subscriber */
549 AuthInfoRequested auth_info_requested; /**< Ask the application some authentication information */
550 DisplayStatusCb display_status; /**< Callback that notifies various events with human readable text.*/
551 DisplayMessageCb display_message;/**< Callback to display a message to the user */
552 #ifdef VINCENT_MAURY_RSVP
553 /* the yes/no dialog box */
554 DisplayMessageCb display_yes_no;
556 DisplayMessageCb display_warning;/** Callback to display a warning to the user */
557 DisplayUrlCb display_url;
558 DisplayQuestionCb display_question;
559 CallLogUpdated call_log_updated; /**< Notifies that call log list has been updated */
560 TextMessageReceived text_received; /**< A text message has been received */
561 GeneralStateChange general_state; /**< State notification callback */
562 DtmfReceived dtmf_received; /**< A dtmf has been received received */
563 ReferReceived refer_received; /**< A refer was received */
564 BuddyInfoUpdated buddy_info_updated; /**< a LinphoneFriend's BuddyInfo has changed*/
565 } LinphoneCoreVTable;
571 typedef struct _LCCallbackObj
573 LinphoneCoreCbFunc _func;
579 typedef enum _LinphoneFirewallPolicy{
580 LINPHONE_POLICY_NO_FIREWALL,
581 LINPHONE_POLICY_USE_NAT_ADDRESS,
582 LINPHONE_POLICY_USE_STUN
583 } LinphoneFirewallPolicy;
585 typedef enum _LinphoneWaitingState{
586 LinphoneWaitingStart,
587 LinphoneWaitingProgress,
588 LinphoneWaitingFinished
589 } LinphoneWaitingState;
590 typedef void * (*LinphoneWaitingCallback)(struct _LinphoneCore *lc, void *context, LinphoneWaitingState ws, const char *purpose, float progress);
593 typedef struct _LinphoneCore
595 LinphoneCoreVTable vtable;
596 struct _LpConfig *config;
597 net_config_t net_conf;
598 sip_config_t sip_conf;
599 rtp_config_t rtp_conf;
600 sound_config_t sound_conf;
601 video_config_t video_conf;
602 codecs_config_t codecs_conf;
604 autoreplier_config_t autoreplier_conf;
605 LinphoneProxyConfig *default_proxy;
608 struct _RingStream *ringstream;
609 LCCallbackObj preview_finished_cb;
610 bool_t preview_finished;
611 struct _LinphoneCall *call; /* the current call, in the future it will be a list of calls (conferencing)*/
612 int rid; /*registration id*/
613 MSList *queued_calls; /* used by the autoreplier */
618 struct _AudioStream *audiostream; /**/
619 struct _VideoStream *videostream;
620 struct _VideoStream *previewstream;
621 RtpTransport *a_rtp,*a_rtcp;
622 struct _RtpProfile *local_profile;
624 MSList *subscribers; /* unknown subscribers */
626 LinphoneOnlineStatus presence_mode;
627 LinphoneOnlineStatus prev_mode;
639 int automatic_action;
640 gstate_t gstate_power;
642 gstate_t gstate_call;
643 LinphoneWaitingCallback wait_cb;
646 bool_t apply_nat_settings;
649 #ifdef VINCENT_MAURY_RSVP
660 void linphone_core_enable_logs(FILE *file);
661 void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc);
662 void linphone_core_disable_logs(void);
663 /*sets the user-agent string in sip messages, must be set before linphone_core_new() or linphone_core_init() */
664 void linphone_core_set_user_agent(const char *ua_name, const char *version);
665 const char *linphone_core_get_version(void);
667 LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable,
668 const char *config_path, const char *factory_config, void* userdata);
670 /* function to be periodically called in a main loop */
671 void linphone_core_iterate(LinphoneCore *lc);
673 int linphone_core_invite(LinphoneCore *lc, const char *url);
675 int linphone_core_refer(LinphoneCore *lc, const char *url);
677 bool_t linphone_core_inc_invite_pending(LinphoneCore*lc);
679 bool_t linphone_core_in_call(const LinphoneCore *lc);
681 int linphone_core_accept_call(LinphoneCore *lc, const char *url);
683 int linphone_core_terminate_call(LinphoneCore *lc, const char *url);
685 void linphone_core_send_dtmf(LinphoneCore *lc,char dtmf);
687 int linphone_core_set_primary_contact(LinphoneCore *lc, const char *contact);
689 const char *linphone_core_get_primary_contact(LinphoneCore *lc);
691 void linphone_core_set_guess_hostname(LinphoneCore *lc, bool_t val);
692 bool_t linphone_core_get_guess_hostname(LinphoneCore *lc);
694 bool_t linphone_core_ipv6_enabled(LinphoneCore *lc);
695 void linphone_core_enable_ipv6(LinphoneCore *lc, bool_t val);
697 LinphoneAddress *linphone_core_get_primary_contact_parsed(LinphoneCore *lc);
699 /*0= no bandwidth limit*/
700 void linphone_core_set_download_bandwidth(LinphoneCore *lc, int bw);
701 void linphone_core_set_upload_bandwidth(LinphoneCore *lc, int bw);
703 int linphone_core_get_download_bandwidth(const LinphoneCore *lc);
704 int linphone_core_get_upload_bandwidth(const LinphoneCore *lc);
707 #ifdef VINCENT_MAURY_RSVP
709 int linphone_core_set_rpc_mode(LinphoneCore *lc, int on); /* on = 1 (RPC_ENABLE = 1) */
710 int linphone_core_set_rsvp_mode(LinphoneCore *lc, int on); /* on = 1 (RSVP_ENABLE = 1) */
711 int linphone_core_change_qos(LinphoneCore *lc, int answer); /* answer = 1 for yes, 0 for no */
714 /* returns a MSList of PayloadType */
715 const MSList *linphone_core_get_audio_codecs(const LinphoneCore *lc);
717 int linphone_core_set_audio_codecs(LinphoneCore *lc, MSList *codecs);
718 /* returns a MSList of PayloadType */
719 const MSList *linphone_core_get_video_codecs(const LinphoneCore *lc);
721 int linphone_core_set_video_codecs(LinphoneCore *lc, MSList *codecs);
723 bool_t linphone_core_check_payload_type_usability(LinphoneCore *lc, PayloadType *pt);
725 int linphone_core_add_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *config);
727 void linphone_core_clear_proxy_config(LinphoneCore *lc);
729 void linphone_core_remove_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *config);
731 const MSList *linphone_core_get_proxy_config_list(const LinphoneCore *lc);
733 void linphone_core_set_default_proxy(LinphoneCore *lc, LinphoneProxyConfig *config);
735 void linphone_core_set_default_proxy_index(LinphoneCore *lc, int index);
737 int linphone_core_get_default_proxy(LinphoneCore *lc, LinphoneProxyConfig **config);
739 void linphone_core_add_auth_info(LinphoneCore *lc, LinphoneAuthInfo *info);
741 void linphone_core_remove_auth_info(LinphoneCore *lc, LinphoneAuthInfo *info);
743 const MSList *linphone_core_get_auth_info_list(const LinphoneCore *lc);
745 LinphoneAuthInfo *linphone_core_find_auth_info(LinphoneCore *lc, const char *realm, const char *username);
747 void linphone_core_abort_authentication(LinphoneCore *lc, LinphoneAuthInfo *info);
749 void linphone_core_clear_all_auth_info(LinphoneCore *lc);
751 int linphone_core_get_audio_jittcomp(LinphoneCore *lc);
753 void linphone_core_set_audio_jittcomp(LinphoneCore *lc, int value);
755 int linphone_core_get_audio_port(const LinphoneCore *lc);
757 int linphone_core_get_video_port(const LinphoneCore *lc);
759 int linphone_core_get_nortp_timeout(const LinphoneCore *lc);
761 void linphone_core_set_audio_port(LinphoneCore *lc, int port);
763 void linphone_core_set_video_port(LinphoneCore *lc, int port);
765 void linphone_core_set_nortp_timeout(LinphoneCore *lc, int port);
767 void linphone_core_set_use_info_for_dtmf(LinphoneCore *lc, bool_t use_info);
769 bool_t linphone_core_get_use_info_for_dtmf(LinphoneCore *lc);
771 void linphone_core_set_use_rfc2833_for_dtmf(LinphoneCore *lc,bool_t use_rfc2833);
773 bool_t linphone_core_get_use_rfc2833_for_dtmf(LinphoneCore *lc);
775 int linphone_core_get_sip_port(LinphoneCore *lc);
777 void linphone_core_set_sip_port(LinphoneCore *lc,int port);
779 void linphone_core_set_inc_timeout(LinphoneCore *lc, int seconds);
781 int linphone_core_get_inc_timeout(LinphoneCore *lc);
783 void linphone_core_set_stun_server(LinphoneCore *lc, const char *server);
785 const char * linphone_core_get_stun_server(const LinphoneCore *lc);
787 void linphone_core_set_nat_address(LinphoneCore *lc, const char *addr);
789 const char *linphone_core_get_nat_address(const LinphoneCore *lc);
791 void linphone_core_set_firewall_policy(LinphoneCore *lc, LinphoneFirewallPolicy pol);
793 LinphoneFirewallPolicy linphone_core_get_firewall_policy(const LinphoneCore *lc);
795 const char * linphone_core_get_relay_addr(const LinphoneCore *lc);
797 int linphone_core_set_relay_addr(LinphoneCore *lc, const char *addr);
799 /* sound functions */
800 /* returns a null terminated static array of string describing the sound devices */
801 const char** linphone_core_get_sound_devices(LinphoneCore *lc);
802 bool_t linphone_core_sound_device_can_capture(LinphoneCore *lc, const char *device);
803 bool_t linphone_core_sound_device_can_playback(LinphoneCore *lc, const char *device);
804 int linphone_core_get_ring_level(LinphoneCore *lc);
805 int linphone_core_get_play_level(LinphoneCore *lc);
806 int linphone_core_get_rec_level(LinphoneCore *lc);
807 void linphone_core_set_ring_level(LinphoneCore *lc, int level);
808 void linphone_core_set_play_level(LinphoneCore *lc, int level);
809 void linphone_core_set_rec_level(LinphoneCore *lc, int level);
810 const char * linphone_core_get_ringer_device(LinphoneCore *lc);
811 const char * linphone_core_get_playback_device(LinphoneCore *lc);
812 const char * linphone_core_get_capture_device(LinphoneCore *lc);
813 int linphone_core_set_ringer_device(LinphoneCore *lc, const char * devid);
814 int linphone_core_set_playback_device(LinphoneCore *lc, const char * devid);
815 int linphone_core_set_capture_device(LinphoneCore *lc, const char * devid);
816 char linphone_core_get_sound_source(LinphoneCore *lc);
817 void linphone_core_set_sound_source(LinphoneCore *lc, char source);
818 void linphone_core_set_ring(LinphoneCore *lc, const char *path);
819 const char *linphone_core_get_ring(const LinphoneCore *lc);
820 void linphone_core_set_ringback(LinphoneCore *lc, const char *path);
821 const char * linphone_core_get_ringback(const LinphoneCore *lc);
822 int linphone_core_preview_ring(LinphoneCore *lc, const char *ring,LinphoneCoreCbFunc func,void * userdata);
823 void linphone_core_enable_echo_cancellation(LinphoneCore *lc, bool_t val);
824 bool_t linphone_core_echo_cancellation_enabled(LinphoneCore *lc);
826 void linphone_core_enable_echo_limiter(LinphoneCore *lc, bool_t val);
827 bool_t linphone_core_echo_limiter_enabled(const LinphoneCore *lc);
829 void linphone_core_enable_agc(LinphoneCore *lc, bool_t val);
830 bool_t linphone_core_agc_enabled(const LinphoneCore *lc);
832 void linphone_core_mute_mic(LinphoneCore *lc, bool_t muted);
834 void linphone_core_set_presence_info(LinphoneCore *lc,int minutes_away,const char *contact,LinphoneOnlineStatus os);
836 LinphoneOnlineStatus linphone_core_get_presence_info(const LinphoneCore *lc);
838 void linphone_core_interpret_friend_uri(LinphoneCore *lc, const char *uri, char **result);
839 void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *fr);
840 void linphone_core_remove_friend(LinphoneCore *lc, LinphoneFriend *fr);
841 void linphone_core_reject_subscriber(LinphoneCore *lc, LinphoneFriend *lf);
842 /* a list of LinphoneFriend */
843 const MSList * linphone_core_get_friend_list(const LinphoneCore *lc);
844 /* notify all friends that have subscribed */
845 void linphone_core_notify_all_friends(LinphoneCore *lc, LinphoneOnlineStatus os);
846 LinphoneFriend *linphone_core_get_friend_by_uri(const LinphoneCore *lc, const char *uri);
847 LinphoneFriend *linphone_core_get_friend_by_ref_key(const LinphoneCore *lc, const char *key);
849 /* returns a list of LinphoneCallLog */
850 const MSList * linphone_core_get_call_logs(LinphoneCore *lc);
851 void linphone_core_clear_call_logs(LinphoneCore *lc);
854 void linphone_core_enable_video(LinphoneCore *lc, bool_t vcap_enabled, bool_t display_enabled);
855 bool_t linphone_core_video_enabled(LinphoneCore *lc);
857 typedef struct MSVideoSizeDef{
861 /* returns a zero terminated table of MSVideoSizeDef*/
862 const MSVideoSizeDef *linphone_core_get_supported_video_sizes(LinphoneCore *lc);
863 void linphone_core_set_preferred_video_size(LinphoneCore *lc, MSVideoSize vsize);
864 MSVideoSize linphone_core_get_preferred_video_size(LinphoneCore *lc);
865 void linphone_core_set_preferred_video_size_by_name(LinphoneCore *lc, const char *name);
867 void linphone_core_enable_video_preview(LinphoneCore *lc, bool_t val);
868 bool_t linphone_core_video_preview_enabled(const LinphoneCore *lc);
870 void linphone_core_enable_self_view(LinphoneCore *lc, bool_t val);
871 bool_t linphone_core_self_view_enabled(const LinphoneCore *lc);
874 /* returns a null terminated static array of string describing the webcams */
875 const char** linphone_core_get_video_devices(const LinphoneCore *lc);
876 int linphone_core_set_video_device(LinphoneCore *lc, const char *id);
877 const char *linphone_core_get_video_device(const LinphoneCore *lc);
879 /*function to be used for eventually setting window decorations (icons, title...)*/
880 unsigned long linphone_core_get_native_video_window_id(const LinphoneCore *lc);
883 /*play/record support: use files instead of soundcard*/
884 void linphone_core_use_files(LinphoneCore *lc, bool_t yesno);
885 void linphone_core_set_play_file(LinphoneCore *lc, const char *file);
886 void linphone_core_set_record_file(LinphoneCore *lc, const char *file);
888 gstate_t linphone_core_get_state(const LinphoneCore *lc, gstate_group_t group);
889 int linphone_core_get_current_call_duration(const LinphoneCore *lc);
890 const LinphoneAddress *linphone_core_get_remote_uri(LinphoneCore *lc);
892 int linphone_core_get_mtu(const LinphoneCore *lc);
893 void linphone_core_set_mtu(LinphoneCore *lc, int mtu);
895 bool_t linphone_core_is_in_main_thread(LinphoneCore *lc);
897 void *linphone_core_get_user_data(LinphoneCore *lc);
899 /* returns LpConfig object to read/write to the config file: usefull if you wish to extend
900 the config file with your own sections */
901 struct _LpConfig *linphone_core_get_config(LinphoneCore *lc);
903 /* attempts to wake up another linphone engine already running.
904 The "show" callback is called for the other linphone, causing gui to show up.
905 call_addr is an optional sip-uri to call immediately after waking up.
906 The method returns 0 if an already running linphone was found*/
908 int linphone_core_wake_up_possible_already_running_instance(
909 const char * config_file, const char * call_addr);
911 /*set a callback for some blocking operations, it takes you informed of the progress of the operation*/
912 void linphone_core_set_waiting_callback(LinphoneCore *lc, LinphoneWaitingCallback cb, void *user_context);
914 /*returns the list of registered SipSetup (linphonecore plugins) */
915 const MSList * linphone_core_get_sip_setups(LinphoneCore *lc);
917 void linphone_core_destroy(LinphoneCore *lc);
919 /*for advanced users:*/
920 void linphone_core_set_audio_transports(LinphoneCore *lc, RtpTransport *rtp, RtpTransport *rtcp);
922 /* end of lecacy api */
924 /*internal use only */
925 #define linphone_core_lock(lc) ms_mutex_lock(&(lc)->lock)
926 #define linphone_core_unlock(lc) ms_mutex_unlock((&lc)->lock)
927 void linphone_core_start_media_streams(LinphoneCore *lc, struct _LinphoneCall *call);
928 void linphone_core_stop_media_streams(LinphoneCore *lc);
929 const char * linphone_core_get_identity(LinphoneCore *lc);
930 const char * linphone_core_get_route(LinphoneCore *lc);
931 bool_t linphone_core_interpret_url(LinphoneCore *lc, const char *url, LinphoneAddress **real_parsed_url, char **route);
932 void linphone_core_start_waiting(LinphoneCore *lc, const char *purpose);
933 void linphone_core_update_progress(LinphoneCore *lc, const char *purpose, float progresses);
934 void linphone_core_stop_waiting(LinphoneCore *lc);