linphonecore.h 41.1 KB
Newer Older
aymeric's avatar
aymeric committed
1 2
/*
linphone
3
Copyright (C) 2000 - 2010 Simon MORLAT (simon.morlat@linphone.org)
aymeric's avatar
aymeric committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/
#ifndef LINPHONECORE_H
#define LINPHONECORE_H

#include "ortp/ortp.h"
#include "ortp/payloadtype.h"
#include "mediastreamer2/mscommon.h"
smorlat's avatar
smorlat committed
25
#include "mediastreamer2/msvideo.h"
26 27

#ifdef IN_LINPHONE
smorlat's avatar
smorlat committed
28
#include "sipsetup.h"
29 30 31
#else
#include "linphone/sipsetup.h"
#endif
aymeric's avatar
aymeric committed
32

smorlat's avatar
smorlat committed
33
#define LINPHONE_IPADDR_SIZE 64
smorlat's avatar
smorlat committed
34
#define LINPHONE_HOSTNAME_SIZE 128
smorlat's avatar
smorlat committed
35

aymeric's avatar
aymeric committed
36 37 38 39 40 41
#ifdef __cplusplus
extern "C" {
#endif

struct _MSSndCard;
struct _LinphoneCore;
42 43 44 45 46
/**
 * Linphone core main object created by function linphone_core_new() .
 * @ingroup initializing
 */
typedef struct _LinphoneCore LinphoneCore;
47
struct SalOp;
aymeric's avatar
aymeric committed
48 49 50

struct _LpConfig;

51

52 53 54 55 56 57 58 59 60
struct _LCSipTransports{
	int udp_port;
	int tcp_port;
	int dtls_port;
	int tls_port;
};

typedef struct _LCSipTransports LCSipTransports;

smorlat's avatar
smorlat committed
61 62 63 64 65 66 67 68 69 70 71 72 73 74
/**
 * Object that represents a SIP address.
 *
 * The LinphoneAddress is an opaque object to represents SIP addresses, ie
 * the content of SIP's 'from' and 'to' headers.
 * A SIP address is made of display name, username, domain name, port, and various
 * uri headers (such as tags). It looks like 'Alice <sip:alice@example.net>'.
 * The LinphoneAddress has methods to extract and manipulate all parts of the address.
 * When some part of the address (for example the username) is empty, the accessor methods
 * return NULL.
 * 
 * @ingroup linphone_address
 * @var LinphoneAddress
 */
75
typedef struct SalAddress LinphoneAddress;
76 77 78 79 80
#ifdef IN_LINPHONE
#include "linphonefriend.h"
#else
#include "linphone/linphonefriend.h"
#endif
81 82 83 84 85 86 87

LinphoneAddress * linphone_address_new(const char *uri);
LinphoneAddress * linphone_address_clone(const LinphoneAddress *uri);
const char *linphone_address_get_scheme(const LinphoneAddress *u);
const char *linphone_address_get_display_name(const LinphoneAddress* u);
const char *linphone_address_get_username(const LinphoneAddress *u);
const char *linphone_address_get_domain(const LinphoneAddress *u);
jehan's avatar
jehan committed
88 89 90 91 92 93 94 95 96
/**
 * Get port number as an integer value.
 *
 */
int linphone_address_get_port_int(const LinphoneAddress *u);
/**
 * Get port number, null if not present.
 */
const char* linphone_address_get_port(const LinphoneAddress *u);
97 98 99 100 101
void linphone_address_set_display_name(LinphoneAddress *u, const char *display_name);
void linphone_address_set_username(LinphoneAddress *uri, const char *username);
void linphone_address_set_domain(LinphoneAddress *uri, const char *host);
void linphone_address_set_port(LinphoneAddress *uri, const char *port);
void linphone_address_set_port_int(LinphoneAddress *uri, int port);
102
/*remove tags, params etc... so that it is displayable to the user*/
103 104 105
void linphone_address_clean(LinphoneAddress *uri);
char *linphone_address_as_string(const LinphoneAddress *u);
char *linphone_address_as_string_uri_only(const LinphoneAddress *u);
106
bool_t linphone_address_weak_equal(const LinphoneAddress *a1, const LinphoneAddress *a2);
107
void linphone_address_destroy(LinphoneAddress *u);
aymeric's avatar
aymeric committed
108

smorlat's avatar
smorlat committed
109
struct _SipSetupContext;
110

aymeric's avatar
aymeric committed
111

smorlat's avatar
smorlat committed
112 113 114 115 116 117 118 119
/**
 * Enum representing the direction of a call.
 * @ingroup call_logs
**/
enum _LinphoneCallDir {
	LinphoneCallOutgoing, /**< outgoing calls*/
	LinphoneCallIncoming  /**< incoming calls*/
};
aymeric's avatar
aymeric committed
120

smorlat's avatar
smorlat committed
121 122 123 124 125
/**
 * Typedef for enum
 * @ingroup call_logs
**/
typedef enum _LinphoneCallDir LinphoneCallDir;
aymeric's avatar
aymeric committed
126

smorlat's avatar
smorlat committed
127 128 129 130
/**
 * Enum representing the status of a call
 * @ingroup call_logs
**/
aymeric's avatar
aymeric committed
131
typedef enum _LinphoneCallStatus { 
smorlat's avatar
smorlat committed
132 133
	LinphoneCallSuccess, /**< The call was sucessful*/
	LinphoneCallAborted, /**< The call was aborted */
134 135
	LinphoneCallMissed, /**< The call was missed (unanswered)*/
	LinphoneCallDeclined /**< The call was declined, either locally or by remote end*/
aymeric's avatar
aymeric committed
136 137
} LinphoneCallStatus;

smorlat's avatar
smorlat committed
138 139 140 141 142 143
/**
 * Structure representing a call log.
 *
 * @ingroup call_logs
 * 
**/
aymeric's avatar
aymeric committed
144
typedef struct _LinphoneCallLog{
smorlat's avatar
smorlat committed
145 146 147 148 149 150
	LinphoneCallDir dir; /**< The direction of the call*/
	LinphoneCallStatus status; /**< The status of the call*/
	LinphoneAddress *from; /**<Originator of the call as a LinphoneAddress object*/
	LinphoneAddress *to; /**<Destination of the call as a LinphoneAddress object*/
	char start_date[128]; /**<Human readable string containg the start date*/
	int duration; /**<Duration of the call in seconds*/
151
	char *refkey;
152
	void *user_pointer;
153 154
	rtp_stats_t local_stats;
	rtp_stats_t remote_stats;
155
	float quality;
156
	struct _LinphoneCore *lc;
aymeric's avatar
aymeric committed
157 158
} LinphoneCallLog;

smorlat's avatar
smorlat committed
159

aymeric's avatar
aymeric committed
160 161

/*public: */
162 163
void linphone_call_log_set_user_pointer(LinphoneCallLog *cl, void *up);
void *linphone_call_log_get_user_pointer(const LinphoneCallLog *cl);
164 165
void linphone_call_log_set_ref_key(LinphoneCallLog *cl, const char *refkey);
const char *linphone_call_log_get_ref_key(const LinphoneCallLog *cl);
166 167
const rtp_stats_t *linphone_call_log_get_local_stats(const LinphoneCallLog *cl);
const rtp_stats_t *linphone_call_log_get_remote_stats(const LinphoneCallLog *cl);
aymeric's avatar
aymeric committed
168 169
char * linphone_call_log_to_str(LinphoneCallLog *cl);

170

171
/**
Guillaume Beraudo's avatar
Guillaume Beraudo committed
172 173
 * The LinphoneCallParams is an object containing various call related parameters.
 * It can be used to retrieve parameters from a currently running call or modify the call's characteristics 
174 175 176 177 178
 * dynamically.
**/
struct _LinphoneCallParams;
typedef struct _LinphoneCallParams LinphoneCallParams;

179
LinphoneCallParams * linphone_call_params_copy(const LinphoneCallParams *cp);
180
void linphone_call_params_enable_video(LinphoneCallParams *cp, bool_t enabled);
181
bool_t linphone_call_params_video_enabled(const LinphoneCallParams *cp);
182 183
void linphone_call_params_enable_early_media_sending(LinphoneCallParams *cp, bool_t enabled);
bool_t linphone_call_params_early_media_sending_enabled(const LinphoneCallParams *cp);
184
void linphone_call_params_set_audio_bandwidth_limit(LinphoneCallParams *cp, int bw);
185 186
void linphone_call_params_destroy(LinphoneCallParams *cp);

187 188
/**
 * Enum describing failure reasons.
Simon Morlat's avatar
Simon Morlat committed
189
 * @ingroup initializing
190
**/
191 192 193 194 195
enum _LinphoneReason{
	LinphoneReasonNone,
	LinphoneReasonNoResponse, /**<No response received from remote*/
	LinphoneReasonBadCredentials, /**<Authentication failed due to bad or missing credentials*/
	LinphoneReasonDeclined, /**<The call has been declined*/
196 197
};

198
typedef enum _LinphoneReason LinphoneReason;
199

200
const char *linphone_reason_to_string(LinphoneReason err);
201

202 203 204 205 206 207
/**
 * The LinphoneCall object represents a call issued or received by the LinphoneCore
**/
struct _LinphoneCall;
typedef struct _LinphoneCall LinphoneCall;

Simon Morlat's avatar
Simon Morlat committed
208 209 210 211 212
/**
 * LinphoneCallState enum represents the different state a call can reach into.
 * The application is notified of state changes through the LinphoneCoreVTable::call_state_changed callback.
 * @ingroup call_control
**/
213
typedef enum _LinphoneCallState{
Simon Morlat's avatar
Simon Morlat committed
214
	LinphoneCallIdle,					/**<Initial call state */
215 216 217 218 219 220 221 222 223 224 225 226 227 228
	LinphoneCallIncomingReceived, /**<This is a new incoming call */
	LinphoneCallOutgoingInit, /**<An outgoing call is started */
	LinphoneCallOutgoingProgress, /**<An outgoing call is in progress */
	LinphoneCallOutgoingRinging, /**<An outgoing call is ringing at remote end */
	LinphoneCallOutgoingEarlyMedia, /**<An outgoing call is proposed early media */
	LinphoneCallConnected, /**<Connected, the call is answered */
	LinphoneCallStreamsRunning, /**<The media streams are established and running*/
	LinphoneCallPausing, /**<The call is pausing at the initiative of local end */
	LinphoneCallPaused, /**< The call is paused, remote end has accepted the pause */
	LinphoneCallResuming, /**<The call is being resumed by local end*/
	LinphoneCallRefered, /**<The call is being transfered to another party, resulting in a new outgoing call to follow immediately*/
	LinphoneCallError, /**<The call encountered an error*/
	LinphoneCallEnd, /**<The call ended normally*/
	LinphoneCallPausedByRemote, /**<The call is paused by remote end*/
229
	LinphoneCallUpdatedByRemote, /**<The call's parameters are updated, used for example when video is asked by remote */
230
	LinphoneCallIncomingEarlyMedia, /**<We are proposing early media to an incoming call */
231 232
	LinphoneCallUpdated, /**<The remote accepted the call update initiated by us */
	LinphoneCallReleased /**< The call object is no more retained by the core */
233 234
} LinphoneCallState;

235
const char *linphone_call_state_to_string(LinphoneCallState cs);
236

237 238

LinphoneCallState linphone_call_get_state(const LinphoneCall *call);
239 240 241 242
bool_t linphone_call_asked_to_autoanswer(LinphoneCall *call);
const LinphoneAddress * linphone_core_get_current_call_remote_address(struct _LinphoneCore *lc);
const LinphoneAddress * linphone_call_get_remote_address(const LinphoneCall *call);
char *linphone_call_get_remote_address_as_string(const LinphoneCall *call);
Simon Morlat's avatar
Simon Morlat committed
243
LinphoneCallDir linphone_call_get_dir(const LinphoneCall *call);
244 245 246
void linphone_call_ref(LinphoneCall *call);
void linphone_call_unref(LinphoneCall *call);
LinphoneCallLog *linphone_call_get_call_log(const LinphoneCall *call);
Simon Morlat's avatar
Simon Morlat committed
247
const char *linphone_call_get_refer_to(const LinphoneCall *call);
248
bool_t linphone_call_has_transfer_pending(const LinphoneCall *call);
249
LinphoneCall *linphone_call_get_replaced_call(LinphoneCall *call);
250
int linphone_call_get_duration(const LinphoneCall *call);
251
const LinphoneCallParams * linphone_call_get_current_params(const LinphoneCall *call);
252 253
void linphone_call_enable_camera(LinphoneCall *lc, bool_t enabled);
bool_t linphone_call_camera_enabled(const LinphoneCall *lc);
254
int linphone_call_take_video_snapshot(LinphoneCall *call, const char *file);
255
LinphoneReason linphone_call_get_reason(const LinphoneCall *call);
256
const char *linphone_call_get_remote_user_agent(LinphoneCall *call);
Simon Morlat's avatar
Simon Morlat committed
257 258
float linphone_call_get_play_volume(LinphoneCall *call);
float linphone_call_get_record_volume(LinphoneCall *call);
259 260
float linphone_call_get_current_quality(LinphoneCall *call);
float linphone_call_get_average_quality(LinphoneCall *call);
Simon Morlat's avatar
Simon Morlat committed
261 262
void *linphone_call_get_user_pointer(LinphoneCall *call);
void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer);
jehan's avatar
jehan committed
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
/**
 * Enables or disable echo cancellation for this call
 * @param call
 * @param val
 *
 * @ingroup media_parameters
**/
void linphone_call_enable_echo_cancellation(LinphoneCall *call, bool_t val) ;
/**
 * Returns TRUE if echo cancellation is enabled.
 *
 * @ingroup media_parameters
**/
bool_t linphone_call_echo_cancellation_enabled(LinphoneCall *lc);
/**
 * Enables or disable echo limiter for this call
 * @param call
 * @param val
 *
 * @ingroup media_parameters
**/
void linphone_call_enable_echo_limiter(LinphoneCall *call, bool_t val);
/**
 * Returns TRUE if echo limiter is enabled.
 *
 * @ingroup media_parameters
**/
bool_t linphone_call_echo_limiter_enabled(const LinphoneCall *call);
Simon Morlat's avatar
Simon Morlat committed
291 292 293 294

/*keep this in sync with mediastreamer2/msvolume.h*/
#define LINPHONE_VOLUME_DB_LOWEST (-120) /**< Lowest measured that can be returned.*/

smorlat's avatar
smorlat committed
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314
/**
 * @addtogroup proxies
 * @{
**/
/**
 * The LinphoneProxyConfig object represents a proxy configuration to be used
 * by the LinphoneCore object.
 * Its fields must not be used directly in favour of the accessors methods.
 * Once created and filled properly the LinphoneProxyConfig can be given to
 * LinphoneCore with linphone_core_add_proxy_config().
 * This will automatically triggers the registration, if enabled.
 *
 * The proxy configuration are persistent to restarts because they are saved
 * in the configuration file. As a consequence, after linphone_core_new() there
 * might already be a list of configured proxy that can be examined with
 * linphone_core_get_proxy_config_list().
 *
 * The default proxy (see linphone_core_set_default_proxy() ) is the one of the list
 * that is used by default for calls.
**/
315
typedef struct _LinphoneProxyConfig LinphoneProxyConfig;
aymeric's avatar
aymeric committed
316

317 318 319 320
/**
 * LinphoneRegistrationState describes proxy registration states.
**/
typedef enum _LinphoneRegistrationState{
Simon Morlat's avatar
Simon Morlat committed
321 322 323 324 325
	LinphoneRegistrationNone, /**<Initial state for registrations */
	LinphoneRegistrationProgress, /**<Registration is in progress */
	LinphoneRegistrationOk,	/**< Registration is successful */
	LinphoneRegistrationCleared, /**< Unregistration succeeded */
	LinphoneRegistrationFailed	/**<Registration failed */
326 327
}LinphoneRegistrationState;

328 329 330 331
/**
 * Human readable version of the #LinphoneRegistrationState
 * @param cs sate
 */
332 333
const char *linphone_registration_state_to_string(LinphoneRegistrationState cs);

aymeric's avatar
aymeric committed
334 335
LinphoneProxyConfig *linphone_proxy_config_new(void);
int linphone_proxy_config_set_server_addr(LinphoneProxyConfig *obj, const char *server_addr);
336 337
int linphone_proxy_config_set_identity(LinphoneProxyConfig *obj, const char *identity);
int linphone_proxy_config_set_route(LinphoneProxyConfig *obj, const char *route);
Simon Morlat's avatar
Simon Morlat committed
338
void linphone_proxy_config_expires(LinphoneProxyConfig *obj, int expires);
339 340 341 342 343 344
/**
 * Indicates  either or not, REGISTRATION must be issued for this #LinphoneProxyConfig .
 * <br> In case this #LinphoneProxyConfig has been added to #LinphoneCore, follows the linphone_proxy_config_edit() rule.
 * @param obj object pointer
 * @param val if true, registration will be engaged
 */
aymeric's avatar
aymeric committed
345 346 347 348
void linphone_proxy_config_enable_register(LinphoneProxyConfig *obj, bool_t val);
#define linphone_proxy_config_enableregister linphone_proxy_config_enable_register
void linphone_proxy_config_edit(LinphoneProxyConfig *obj);
int linphone_proxy_config_done(LinphoneProxyConfig *obj);
jehan's avatar
jehan committed
349 350 351 352 353 354 355
/**
 * Indicates  either or not, PUBLISH must be issued for this #LinphoneProxyConfig .
 * <br> In case this #LinphoneProxyConfig has been added to #LinphoneCore, follows the linphone_proxy_config_edit() rule.
 * @param obj object pointer
 * @param val if true, publish will be engaged
 *
 */
aymeric's avatar
aymeric committed
356
void linphone_proxy_config_enable_publish(LinphoneProxyConfig *obj, bool_t val);
357 358 359
void linphone_proxy_config_set_dial_escape_plus(LinphoneProxyConfig *cfg, bool_t val);
void linphone_proxy_config_set_dial_prefix(LinphoneProxyConfig *cfg, const char *prefix);

360
LinphoneRegistrationState linphone_proxy_config_get_state(const LinphoneProxyConfig *obj);
smorlat's avatar
smorlat committed
361
bool_t linphone_proxy_config_is_registered(const LinphoneProxyConfig *obj);
smorlat's avatar
smorlat committed
362
const char *linphone_proxy_config_get_domain(const LinphoneProxyConfig *cfg);
363 364 365 366 367 368 369

const char *linphone_proxy_config_get_route(const LinphoneProxyConfig *obj);
const char *linphone_proxy_config_get_identity(const LinphoneProxyConfig *obj);
bool_t linphone_proxy_config_publish_enabled(const LinphoneProxyConfig *obj);
const char *linphone_proxy_config_get_addr(const LinphoneProxyConfig *obj);
int linphone_proxy_config_get_expires(const LinphoneProxyConfig *obj);
bool_t linphone_proxy_config_register_enabled(const LinphoneProxyConfig *obj);
370
void linphone_proxy_config_refresh_register(LinphoneProxyConfig *obj);
371 372
struct _LinphoneCore * linphone_proxy_config_get_core(const LinphoneProxyConfig *obj);

373 374 375
bool_t linphone_proxy_config_get_dial_escape_plus(const LinphoneProxyConfig *cfg);
const char * linphone_proxy_config_get_dial_prefix(const LinphoneProxyConfig *cfg);

376
LinphoneReason linphone_proxy_config_get_error(const LinphoneProxyConfig *cfg);
377

aymeric's avatar
aymeric committed
378 379
/* destruction is called automatically when removing the proxy config */
void linphone_proxy_config_destroy(LinphoneProxyConfig *cfg);
smorlat's avatar
smorlat committed
380 381
void linphone_proxy_config_set_sip_setup(LinphoneProxyConfig *cfg, const char *type);
SipSetupContext *linphone_proxy_config_get_sip_setup_context(LinphoneProxyConfig *cfg);
382
SipSetup *linphone_proxy_config_get_sip_setup(LinphoneProxyConfig *cfg);
383 384 385 386
/**
 * normalize a human readable phone number into a basic string. 888-444-222 becomes 888444222
 */
int linphone_proxy_config_normalize_number(LinphoneProxyConfig *proxy, const char *username, char *result, size_t result_len);
jehan's avatar
jehan committed
387 388 389 390 391 392 393 394
/*
 *  attached a user data to a proxy config
 */
void linphone_proxy_config_set_user_data(LinphoneProxyConfig *cr, void * ud);
/*
 *  get user data to a proxy config. return null if any
 */
void * linphone_proxy_config_get_user_data(LinphoneProxyConfig *cr);
smorlat's avatar
smorlat committed
395

smorlat's avatar
smorlat committed
396 397 398 399
/**
 * @}
**/

400 401 402 403 404 405 406 407 408
typedef struct _LinphoneAccountCreator{
	struct _LinphoneCore *lc;
	struct _SipSetupContext *ssctx;
	char *username;
	char *password;
	char *domain;
	bool_t succeeded;
}LinphoneAccountCreator;

409
LinphoneAccountCreator *linphone_account_creator_new(struct _LinphoneCore *core, const char *type);
410 411 412
void linphone_account_creator_set_username(LinphoneAccountCreator *obj, const char *username);
void linphone_account_creator_set_password(LinphoneAccountCreator *obj, const char *password);
void linphone_account_creator_set_domain(LinphoneAccountCreator *obj, const char *domain);
smorlat's avatar
smorlat committed
413 414
const char * linphone_account_creator_get_username(LinphoneAccountCreator *obj);
const char * linphone_account_creator_get_domain(LinphoneAccountCreator *obj);
415
int linphone_account_creator_test_existence(LinphoneAccountCreator *obj);
416 417 418
LinphoneProxyConfig * linphone_account_creator_validate(LinphoneAccountCreator *obj);
void linphone_account_creator_destroy(LinphoneAccountCreator *obj);

419 420
struct _LinphoneAuthInfo;

smorlat's avatar
smorlat committed
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444
/**
 * @ingroup authentication
 * Object holding authentication information.
 *
 * @note The object's fields should not be accessed directly. Prefer using
 * the accessor methods.
 *
 * In most case, authentication information consists of a username and password.
 * Sometimes, a userid is required by proxy, and realm can be useful to discriminate
 * different SIP domains.
 *
 * Once created and filled, a LinphoneAuthInfo must be added to the LinphoneCore in
 * order to become known and used automatically when needed. 
 * Use linphone_core_add_auth_info() for that purpose.
 *
 * The LinphoneCore object can take the initiative to request authentication information
 * when needed to the application through the auth_info_requested callback of the
 * LinphoneCoreVTable structure.
 *
 * The application can respond to this information request later using 
 * linphone_core_add_auth_info(). This will unblock all pending authentication 
 * transactions and retry them with authentication headers.
 *
**/
445
typedef struct _LinphoneAuthInfo LinphoneAuthInfo;
aymeric's avatar
aymeric committed
446 447 448 449

LinphoneAuthInfo *linphone_auth_info_new(const char *username, const char *userid,
		const char *passwd, const char *ha1,const char *realm);
void linphone_auth_info_set_passwd(LinphoneAuthInfo *info, const char *passwd);
450
void linphone_auth_info_set_username(LinphoneAuthInfo *info, const char *username);
451
void linphone_auth_info_set_userid(LinphoneAuthInfo *info, const char *userid);
452 453 454 455 456

const char *linphone_auth_info_get_username(const LinphoneAuthInfo *i);
const char *linphone_auth_info_get_passwd(const LinphoneAuthInfo *i);
const char *linphone_auth_info_get_userid(const LinphoneAuthInfo *i);

aymeric's avatar
aymeric committed
457 458 459 460
/* you don't need those function*/
void linphone_auth_info_destroy(LinphoneAuthInfo *info);
LinphoneAuthInfo * linphone_auth_info_new_from_config_file(struct _LpConfig *config, int pos);

jehan's avatar
jehan committed
461

462
struct _LinphoneChatRoom;
jehan's avatar
jehan committed
463 464 465 466 467 468 469 470
/**
 * @addtogroup chatroom
 * @{
 */
/**
 * A chat room is the place where text messages are exchanged.
 * <br> Can be created by linphone_core_create_chat_room().
 */
aymeric's avatar
aymeric committed
471
typedef struct _LinphoneChatRoom LinphoneChatRoom;
jehan's avatar
jehan committed
472 473 474 475 476 477 478 479 480 481 482 483 484
/**
 * Create a new chat room for messaging from a sip uri like sip:joe@sip.linphone.org
 * @param lc #LinphoneCore object
 * @param to destination address for messages
 * @return #LinphoneChatRoom where messaging can take place.
 */
LinphoneChatRoom * linphone_core_create_chat_room(LinphoneCore *lc, const char *to);
/**
 * Destructor
 * @param cr #LinphoneChatRoom object
 */
void linphone_chat_room_destroy(LinphoneChatRoom *cr);

aymeric's avatar
aymeric committed
485

jehan's avatar
jehan committed
486 487 488 489 490 491 492 493 494 495 496
/**
 * get peer address \link linphone_core_create_chat_room() associated to \endlink this #LinphoneChatRoom
 * @param cr #LinphoneChatRoom object
 * @return #LinphoneAddress peer address
 */
const LinphoneAddress* linphone_chat_room_get_peer_address(LinphoneChatRoom *cr);
/**
 * send a message to peer member of this chat room.
 * @param cr #LinphoneChatRoom object
 * @param msg message to be sent
 */
aymeric's avatar
aymeric committed
497
void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg);
jehan's avatar
jehan committed
498

aymeric's avatar
aymeric committed
499 500 501
void linphone_chat_room_set_user_data(LinphoneChatRoom *cr, void * ud);
void * linphone_chat_room_get_user_data(LinphoneChatRoom *cr);

jehan's avatar
jehan committed
502 503 504
/**
 * @}
 */
Simon Morlat's avatar
Simon Morlat committed
505 506 507 508 509 510 511 512 513 514 515


/**
 * @addtogroup initializing
 * @{
**/

/**
 * LinphoneGlobalState describes the global state of the LinphoneCore object.
 * It is notified via the LinphoneCoreVTable::global_state_changed
**/
516 517 518 519 520 521 522
typedef enum _LinphoneGlobalState{
	LinphoneGlobalOff,
	LinphoneGlobalStartup,
	LinphoneGlobalOn,
	LinphoneGlobalShutdown
}LinphoneGlobalState;

523
const char *linphone_global_state_to_string(LinphoneGlobalState gs);
aymeric's avatar
aymeric committed
524

525 526 527 528 529

/**Call state notification callback prototype*/
typedef void (*LinphoneGlobalStateCb)(struct _LinphoneCore *lc, LinphoneGlobalState gstate, const char *message);
/**Call state notification callback prototype*/
typedef void (*LinphoneCallStateCb)(struct _LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *message);
530 531 532
/** @ingroup Proxies
 * Registration state notification callback prototype
 * */
533
typedef void (*LinphoneRegistrationStateCb)(struct _LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const char *message);
smorlat's avatar
smorlat committed
534
/** Callback prototype */
aymeric's avatar
aymeric committed
535
typedef void (*ShowInterfaceCb)(struct _LinphoneCore *lc);
smorlat's avatar
smorlat committed
536
/** Callback prototype */
aymeric's avatar
aymeric committed
537
typedef void (*DisplayStatusCb)(struct _LinphoneCore *lc, const char *message);
smorlat's avatar
smorlat committed
538
/** Callback prototype */
aymeric's avatar
aymeric committed
539
typedef void (*DisplayMessageCb)(struct _LinphoneCore *lc, const char *message);
smorlat's avatar
smorlat committed
540
/** Callback prototype */
aymeric's avatar
aymeric committed
541
typedef void (*DisplayUrlCb)(struct _LinphoneCore *lc, const char *message, const char *url);
smorlat's avatar
smorlat committed
542
/** Callback prototype */
aymeric's avatar
aymeric committed
543
typedef void (*LinphoneCoreCbFunc)(struct _LinphoneCore *lc,void * user_data);
smorlat's avatar
smorlat committed
544
/** Callback prototype */
545
typedef void (*NotifyReceivedCb)(struct _LinphoneCore *lc, LinphoneCall *call, const char *from, const char *event);
jehan's avatar
jehan committed
546 547 548
/**
 * Report status change for a friend previously \link linphone_core_add_friend() added \endlink to #LinphoneCore.
 * @param lc #LinphoneCore object .
549 550 551 552 553 554 555 556 557 558 559 560
 * @param lf Updated #LinphoneFriend .
 */
typedef void (*NotifyPresenceReceivedCb)(struct _LinphoneCore *lc, LinphoneFriend * lf);
/**
 *  Reports that a new subscription request has been received and wait for a decision.
 *  <br> Status on this subscription request is notified by \link linphone_friend_set_inc_subscribe_policy() changing policy \endlink for this friend
 *	@param lc #LinphoneCore object
 *	@param lf #LinphoneFriend corresponding to the subscriber
 *	@param url of the subscriber
 *  Callback prototype
 *  */
typedef void (*NewSubscribtionRequestCb)(struct _LinphoneCore *lc, LinphoneFriend *lf, const char *url);
smorlat's avatar
smorlat committed
561
/** Callback prototype */
aymeric's avatar
aymeric committed
562
typedef void (*AuthInfoRequested)(struct _LinphoneCore *lc, const char *realm, const char *username);
smorlat's avatar
smorlat committed
563
/** Callback prototype */
aymeric's avatar
aymeric committed
564
typedef void (*CallLogUpdated)(struct _LinphoneCore *lc, struct _LinphoneCallLog *newcl);
jehan's avatar
jehan committed
565 566 567 568 569 570 571 572 573
/**
 * Callback prototype
 *
 * @param lc #LinphoneCore object
 * @param room #LinphoneChatRoom involved in this conversation. Can be be created by the framework in case \link #LinphoneAddress the from \endlink is not present in any chat room.
 * @param from #LinphoneAddress from
 * @param message incoming message
 *  */
typedef void (*TextMessageReceived)(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message);
smorlat's avatar
smorlat committed
574
/** Callback prototype */
575
typedef void (*DtmfReceived)(struct _LinphoneCore* lc, LinphoneCall *call, int dtmf);
smorlat's avatar
smorlat committed
576
/** Callback prototype */
577
typedef void (*ReferReceived)(struct _LinphoneCore *lc, const char *refer_to);
smorlat's avatar
smorlat committed
578
/** Callback prototype */
579
typedef void (*BuddyInfoUpdated)(struct _LinphoneCore *lc, LinphoneFriend *lf);
aymeric's avatar
aymeric committed
580

smorlat's avatar
smorlat committed
581 582
/**
 * This structure holds all callbacks that the application should implement.
583
 *  None is mandatory.
smorlat's avatar
smorlat committed
584
**/
585 586 587 588
typedef struct _LinphoneVTable{
	LinphoneGlobalStateCb global_state_changed; /**<Notifies globlal state changes*/
	LinphoneRegistrationStateCb registration_state_changed;/**<Notifies registration state changes*/
	LinphoneCallStateCb call_state_changed;/**<Notifies call state changes*/
589
	NotifyPresenceReceivedCb notify_presence_recv; /**< Notify received presence events*/
590
	NewSubscribtionRequestCb new_subscription_request; /**< Notify about pending subscription request */
smorlat's avatar
smorlat committed
591 592 593 594
	AuthInfoRequested auth_info_requested; /**< Ask the application some authentication information */
	CallLogUpdated call_log_updated; /**< Notifies that call log list has been updated */
	TextMessageReceived text_received; /**< A text message has been received */
	DtmfReceived dtmf_received; /**< A dtmf has been received received */
Simon Morlat's avatar
Simon Morlat committed
595
	ReferReceived refer_received; /**< An out of call refer was received */
smorlat's avatar
smorlat committed
596
	BuddyInfoUpdated buddy_info_updated; /**< a LinphoneFriend's BuddyInfo has changed*/
597
	NotifyReceivedCb notify_recv; /**< Other notifications*/
Simon Morlat's avatar
Simon Morlat committed
598 599 600 601 602
	DisplayStatusCb display_status; /**< Callback that notifies various events with human readable text.*/
	DisplayMessageCb display_message;/**< Callback to display a message to the user */
	DisplayMessageCb display_warning;/** Callback to display a warning to the user */
	DisplayUrlCb display_url;
	ShowInterfaceCb show; /**< Notifies the application that it should show up*/
aymeric's avatar
aymeric committed
603 604
} LinphoneCoreVTable;

smorlat's avatar
smorlat committed
605 606 607 608
/**
 * @}
**/

aymeric's avatar
aymeric committed
609 610 611 612 613 614 615 616 617
typedef struct _LCCallbackObj
{
  LinphoneCoreCbFunc _func;
  void * _user_data;
}LCCallbackObj;



typedef enum _LinphoneFirewallPolicy{
618 619 620
	LinphonePolicyNoFirewall,
	LinphonePolicyUseNatAddress,
	LinphonePolicyUseStun
aymeric's avatar
aymeric committed
621 622
} LinphoneFirewallPolicy;

623 624 625 626 627 628
typedef enum _LinphoneWaitingState{
	LinphoneWaitingStart,
	LinphoneWaitingProgress,
	LinphoneWaitingFinished
} LinphoneWaitingState;
typedef void * (*LinphoneWaitingCallback)(struct _LinphoneCore *lc, void *context, LinphoneWaitingState ws, const char *purpose, float progress);
629

aymeric's avatar
aymeric committed
630 631 632 633 634 635

/* THE main API */

void linphone_core_enable_logs(FILE *file);
void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc);
void linphone_core_disable_logs(void);
smorlat's avatar
smorlat committed
636 637
/*sets the user-agent string in sip messages, must be set before linphone_core_new() or linphone_core_init() */
void linphone_core_set_user_agent(const char *ua_name, const char *version);
aymeric's avatar
aymeric committed
638 639 640
const char *linphone_core_get_version(void);

LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable,
641
						const char *config_path, const char *factory_config, void* userdata);
aymeric's avatar
aymeric committed
642 643 644 645

/* function to be periodically called in a main loop */
void linphone_core_iterate(LinphoneCore *lc);

646 647
LinphoneAddress * linphone_core_interpret_url(LinphoneCore *lc, const char *url);

648
LinphoneCall * linphone_core_invite(LinphoneCore *lc, const char *url);
aymeric's avatar
aymeric committed
649

650
LinphoneCall * linphone_core_invite_address(LinphoneCore *lc, const LinphoneAddress *addr);
651

652 653 654 655
LinphoneCall * linphone_core_invite_with_params(LinphoneCore *lc, const char *url, const LinphoneCallParams *params);

LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const LinphoneAddress *addr, const LinphoneCallParams *params);

656
int linphone_core_transfer_call(LinphoneCore *lc, LinphoneCall *call, const char *refer_to);
aymeric's avatar
aymeric committed
657

658 659
int linphone_core_transfer_call_to_another(LinphoneCore *lc, LinphoneCall *call, LinphoneCall *dest);

aymeric's avatar
aymeric committed
660 661 662 663
bool_t linphone_core_inc_invite_pending(LinphoneCore*lc);

bool_t linphone_core_in_call(const LinphoneCore *lc);

664
LinphoneCall *linphone_core_get_current_call(const LinphoneCore *lc);
665

666 667 668
int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call);

int linphone_core_terminate_call(LinphoneCore *lc, LinphoneCall *call);
669

670 671
int linphone_core_redirect_call(LinphoneCore *lc, LinphoneCall *call, const char *redirect_uri);

672
int linphone_core_terminate_all_calls(LinphoneCore *lc);
aymeric's avatar
aymeric committed
673

674 675
int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call);

676 677
int linphone_core_pause_all_calls(LinphoneCore *lc);

678
int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *call);
aymeric's avatar
aymeric committed
679

680
int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params);
681 682 683

LinphoneCallParams *linphone_core_create_default_call_parameters(LinphoneCore *lc);

684
LinphoneCall *linphone_core_get_call_by_remote_address(LinphoneCore *lc, const char *remote_address);
aymeric's avatar
aymeric committed
685 686 687 688 689 690 691

void linphone_core_send_dtmf(LinphoneCore *lc,char dtmf);

int linphone_core_set_primary_contact(LinphoneCore *lc, const char *contact);

const char *linphone_core_get_primary_contact(LinphoneCore *lc);

692 693
const char * linphone_core_get_identity(LinphoneCore *lc);

aymeric's avatar
aymeric committed
694 695 696 697 698 699
void linphone_core_set_guess_hostname(LinphoneCore *lc, bool_t val);
bool_t linphone_core_get_guess_hostname(LinphoneCore *lc);

bool_t linphone_core_ipv6_enabled(LinphoneCore *lc);
void linphone_core_enable_ipv6(LinphoneCore *lc, bool_t val);

700
LinphoneAddress *linphone_core_get_primary_contact_parsed(LinphoneCore *lc);
jehan's avatar
jehan committed
701
const char * linphone_core_get_identity(LinphoneCore *lc);
aymeric's avatar
aymeric committed
702 703 704 705 706 707
/*0= no bandwidth limit*/
void linphone_core_set_download_bandwidth(LinphoneCore *lc, int bw);
void linphone_core_set_upload_bandwidth(LinphoneCore *lc, int bw);

int linphone_core_get_download_bandwidth(const LinphoneCore *lc);
int linphone_core_get_upload_bandwidth(const LinphoneCore *lc);
708 709 710

void linphone_core_enable_adaptive_rate_control(LinphoneCore *lc, bool_t enabled);
bool_t linphone_core_adaptive_rate_control_enabled(const LinphoneCore *lc);
jehan's avatar
jehan committed
711
/**
712
 * set audio packetization time linphone expect to receive from peer
jehan's avatar
jehan committed
713 714 715 716 717
 * @ingroup media_parameters
 *
 */
void linphone_core_set_download_ptime(LinphoneCore *lc, int ptime);
/**
718
 * get audio packetization time linphone expect to receive from peer, 0 means unspecified
jehan's avatar
jehan committed
719 720 721
 * @ingroup media_parameters
 */
int  linphone_core_get_download_ptime(LinphoneCore *lc);
aymeric's avatar
aymeric committed
722

Simon Morlat's avatar
Simon Morlat committed
723 724 725 726
void linphone_core_set_upload_ptime(LinphoneCore *lc, int ptime);

int linphone_core_get_upload_ptime(LinphoneCore *lc);

aymeric's avatar
aymeric committed
727 728 729 730 731 732 733 734 735
/* returns a MSList of PayloadType */
const MSList *linphone_core_get_audio_codecs(const LinphoneCore *lc);

int linphone_core_set_audio_codecs(LinphoneCore *lc, MSList *codecs);
/* returns a MSList of PayloadType */
const MSList *linphone_core_get_video_codecs(const LinphoneCore *lc);

int linphone_core_set_video_codecs(LinphoneCore *lc, MSList *codecs);

736 737 738 739
bool_t linphone_core_payload_type_enabled(LinphoneCore *lc, PayloadType *pt);

int linphone_core_enable_payload_type(LinphoneCore *lc, PayloadType *pt, bool_t enable);

jehan's avatar
jehan committed
740 741
PayloadType* linphone_core_find_payload_type(LinphoneCore* lc, const char* type, int rate) ;

742 743
const char *linphone_core_get_payload_type_description(LinphoneCore *lc, PayloadType *pt);

aymeric's avatar
aymeric committed
744 745 746 747
bool_t linphone_core_check_payload_type_usability(LinphoneCore *lc, PayloadType *pt);

int linphone_core_add_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *config);

748 749
void linphone_core_clear_proxy_config(LinphoneCore *lc);

aymeric's avatar
aymeric committed
750 751 752 753 754 755 756 757 758 759
void linphone_core_remove_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *config);

const MSList *linphone_core_get_proxy_config_list(const LinphoneCore *lc);

void linphone_core_set_default_proxy(LinphoneCore *lc, LinphoneProxyConfig *config);

void linphone_core_set_default_proxy_index(LinphoneCore *lc, int index);

int linphone_core_get_default_proxy(LinphoneCore *lc, LinphoneProxyConfig **config);

760
void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info);
aymeric's avatar
aymeric committed
761

762
void linphone_core_remove_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info);
aymeric's avatar
aymeric committed
763

smorlat's avatar
smorlat committed
764 765
const MSList *linphone_core_get_auth_info_list(const LinphoneCore *lc);

766
const LinphoneAuthInfo *linphone_core_find_auth_info(LinphoneCore *lc, const char *realm, const char *username);
smorlat's avatar
smorlat committed
767

aymeric's avatar
aymeric committed
768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791
void linphone_core_abort_authentication(LinphoneCore *lc,  LinphoneAuthInfo *info);

void linphone_core_clear_all_auth_info(LinphoneCore *lc);

int linphone_core_get_audio_jittcomp(LinphoneCore *lc);

void linphone_core_set_audio_jittcomp(LinphoneCore *lc, int value);

int linphone_core_get_audio_port(const LinphoneCore *lc);

int linphone_core_get_video_port(const LinphoneCore *lc);

int linphone_core_get_nortp_timeout(const LinphoneCore *lc);

void linphone_core_set_audio_port(LinphoneCore *lc, int port);

void linphone_core_set_video_port(LinphoneCore *lc, int port);

void linphone_core_set_nortp_timeout(LinphoneCore *lc, int port);

void linphone_core_set_use_info_for_dtmf(LinphoneCore *lc, bool_t use_info);

bool_t linphone_core_get_use_info_for_dtmf(LinphoneCore *lc);

792 793 794 795
void linphone_core_set_use_rfc2833_for_dtmf(LinphoneCore *lc,bool_t use_rfc2833);

bool_t linphone_core_get_use_rfc2833_for_dtmf(LinphoneCore *lc);

796 797
void linphone_core_set_sip_port(LinphoneCore *lc, int port);

aymeric's avatar
aymeric committed
798 799
int linphone_core_get_sip_port(LinphoneCore *lc);

800 801 802
int linphone_core_set_sip_transports(LinphoneCore *lc, const LCSipTransports *transports);

int linphone_core_get_sip_transports(LinphoneCore *lc, LCSipTransports *transports);
jehan's avatar
jehan committed
803 804 805 806 807 808
/**
 * @ingroup IOS
 * Give access to the UDP sip socket. Can be useful to configure this socket as persistent I.E kCFStreamNetworkServiceType set to kCFStreamNetworkServiceTypeVoIP)
 * @param lc #LinphoneCore
 * @return socket file descriptor
 */
809 810
ortp_socket_t linphone_core_get_sip_socket(LinphoneCore *lc);

aymeric's avatar
aymeric committed
811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833
void linphone_core_set_inc_timeout(LinphoneCore *lc, int seconds);

int linphone_core_get_inc_timeout(LinphoneCore *lc);

void linphone_core_set_stun_server(LinphoneCore *lc, const char *server);

const char * linphone_core_get_stun_server(const LinphoneCore *lc);

void linphone_core_set_nat_address(LinphoneCore *lc, const char *addr);

const char *linphone_core_get_nat_address(const LinphoneCore *lc);

void linphone_core_set_firewall_policy(LinphoneCore *lc, LinphoneFirewallPolicy pol);

LinphoneFirewallPolicy linphone_core_get_firewall_policy(const LinphoneCore *lc);

const char * linphone_core_get_relay_addr(const LinphoneCore *lc);

int linphone_core_set_relay_addr(LinphoneCore *lc, const char *addr);

/* sound functions */
/* returns a null terminated static array of string describing the sound devices */ 
const char**  linphone_core_get_sound_devices(LinphoneCore *lc);
smorlat's avatar
smorlat committed
834 835
bool_t linphone_core_sound_device_can_capture(LinphoneCore *lc, const char *device);
bool_t linphone_core_sound_device_can_playback(LinphoneCore *lc, const char *device);
aymeric's avatar
aymeric committed
836 837 838 839 840
int linphone_core_get_ring_level(LinphoneCore *lc);
int linphone_core_get_play_level(LinphoneCore *lc);
int linphone_core_get_rec_level(LinphoneCore *lc);
void linphone_core_set_ring_level(LinphoneCore *lc, int level);
void linphone_core_set_play_level(LinphoneCore *lc, int level);
841 842 843 844

void linphone_core_set_playback_gain_db(LinphoneCore *lc, float level);

float linphone_core_get_playback_gain_db(LinphoneCore *lc);
aymeric's avatar
aymeric committed
845 846 847 848 849 850 851 852 853 854
void linphone_core_set_rec_level(LinphoneCore *lc, int level);
const char * linphone_core_get_ringer_device(LinphoneCore *lc);
const char * linphone_core_get_playback_device(LinphoneCore *lc);
const char * linphone_core_get_capture_device(LinphoneCore *lc);
int linphone_core_set_ringer_device(LinphoneCore *lc, const char * devid);
int linphone_core_set_playback_device(LinphoneCore *lc, const char * devid);
int linphone_core_set_capture_device(LinphoneCore *lc, const char * devid);
char linphone_core_get_sound_source(LinphoneCore *lc);
void linphone_core_set_sound_source(LinphoneCore *lc, char source);
void linphone_core_set_ring(LinphoneCore *lc, const char *path);
855 856 857
const char *linphone_core_get_ring(const LinphoneCore *lc);
void linphone_core_set_ringback(LinphoneCore *lc, const char *path);
const char * linphone_core_get_ringback(const LinphoneCore *lc);
858

859 860
void linphone_core_set_remote_ringback_tone(LinphoneCore *lc,const char *);
const char *linphone_core_get_remote_ringback_tone(const LinphoneCore *lc);
861

aymeric's avatar
aymeric committed
862
int linphone_core_preview_ring(LinphoneCore *lc, const char *ring,LinphoneCoreCbFunc func,void * userdata);
863 864
void linphone_core_enable_echo_cancellation(LinphoneCore *lc, bool_t val);
bool_t linphone_core_echo_cancellation_enabled(LinphoneCore *lc);
aymeric's avatar
aymeric committed
865

smorlat's avatar
smorlat committed
866 867 868
void linphone_core_enable_echo_limiter(LinphoneCore *lc, bool_t val);
bool_t linphone_core_echo_limiter_enabled(const LinphoneCore *lc);

869 870 871
void linphone_core_enable_agc(LinphoneCore *lc, bool_t val);
bool_t linphone_core_agc_enabled(const LinphoneCore *lc);

smorlat's avatar
smorlat committed
872
void linphone_core_mute_mic(LinphoneCore *lc, bool_t muted);
873 874 875 876 877 878
/**
 * return mic state.
 *
 * @ingroup media_parameters
**/
bool_t linphone_core_is_mic_muted(LinphoneCore *lc);
smorlat's avatar
smorlat committed
879

Simon Morlat's avatar
Simon Morlat committed
880 881 882 883 884 885
bool_t linphone_core_is_audio_muted(LinphoneCore *lc);
bool_t linphone_core_is_rtp_muted(LinphoneCore *lc);

bool_t linphone_core_get_rtp_no_xmit_on_audio_mute(const LinphoneCore *lc);
void linphone_core_set_rtp_no_xmit_on_audio_mute(LinphoneCore *lc, bool_t val);

aymeric's avatar
aymeric committed
886 887

/* returns a list of LinphoneCallLog */
888
const MSList * linphone_core_get_call_logs(LinphoneCore *lc);
889
void linphone_core_clear_call_logs(LinphoneCore *lc);
aymeric's avatar
aymeric committed
890 891 892 893 894

/* video support */
void linphone_core_enable_video(LinphoneCore *lc, bool_t vcap_enabled, bool_t display_enabled);
bool_t linphone_core_video_enabled(LinphoneCore *lc);

smorlat's avatar
smorlat committed
895 896 897 898 899 900 901 902 903
typedef struct MSVideoSizeDef{
	MSVideoSize vsize;
	const char *name;
}MSVideoSizeDef;
/* returns a zero terminated table of MSVideoSizeDef*/
const MSVideoSizeDef *linphone_core_get_supported_video_sizes(LinphoneCore *lc);
void linphone_core_set_preferred_video_size(LinphoneCore *lc, MSVideoSize vsize);
MSVideoSize linphone_core_get_preferred_video_size(LinphoneCore *lc);
void linphone_core_set_preferred_video_size_by_name(LinphoneCore *lc, const char *name);
aymeric's avatar
aymeric committed
904 905 906 907

void linphone_core_enable_video_preview(LinphoneCore *lc, bool_t val);
bool_t linphone_core_video_preview_enabled(const LinphoneCore *lc);

smorlat's avatar
smorlat committed
908 909
void linphone_core_enable_self_view(LinphoneCore *lc, bool_t val);
bool_t linphone_core_self_view_enabled(const LinphoneCore *lc);
aymeric's avatar
aymeric committed
910 911 912 913 914 915 916


/* returns a null terminated static array of string describing the webcams */ 
const char**  linphone_core_get_video_devices(const LinphoneCore *lc);
int linphone_core_set_video_device(LinphoneCore *lc, const char *id);
const char *linphone_core_get_video_device(const LinphoneCore *lc);

917 918 919
/* Set static picture to be used when "Static picture" is the video device */
int linphone_core_set_static_picture(LinphoneCore *lc, const char *path);

920 921 922 923
/* Set and get frame rate for static picture */
int linphone_core_set_static_picture_fps(LinphoneCore *lc, float fps);
float linphone_core_get_static_picture_fps(LinphoneCore *lc);

924 925
/*function to be used for eventually setting window decorations (icons, title...)*/
unsigned long linphone_core_get_native_video_window_id(const LinphoneCore *lc);
926
void linphone_core_set_native_video_window_id(LinphoneCore *lc, unsigned long id);
smorlat's avatar
smorlat committed
927

928 929 930 931
unsigned long linphone_core_get_native_preview_window_id(const LinphoneCore *lc);
void linphone_core_set_native_preview_window_id(LinphoneCore *lc, unsigned long id);

void linphone_core_use_preview_window(LinphoneCore *lc, bool_t yesno);
smorlat's avatar
smorlat committed
932 933 934 935 936 937

/*play/record support: use files instead of soundcard*/
void linphone_core_use_files(LinphoneCore *lc, bool_t yesno);
void linphone_core_set_play_file(LinphoneCore *lc, const char *file);
void linphone_core_set_record_file(LinphoneCore *lc, const char *file);

938
void linphone_core_play_dtmf(LinphoneCore *lc, char dtmf, int duration_ms);
939 940
void linphone_core_stop_dtmf(LinphoneCore *lc);

smorlat's avatar
smorlat committed
941
int linphone_core_get_current_call_duration(const LinphoneCore *lc);
jehan's avatar
jehan committed
942

smorlat's avatar
smorlat committed
943

aymeric's avatar
aymeric committed
944 945
int linphone_core_get_mtu(const LinphoneCore *lc);
void linphone_core_set_mtu(LinphoneCore *lc, int mtu);
946

947
/**
jehan's avatar
jehan committed
948
 * @ingroup network_parameters
949 950
 * This method is called by the application to notify the linphone core library when network is reachable.
 * Calling this method with true trigger linphone to initiate a registration process for all proxy
951 952
 * configuration with parameter register set to enable.
 * This method disable the automatic registration mode. It means you must call this method after each network state changes
953 954 955
 *
 */
void linphone_core_set_network_reachable(LinphoneCore* lc,bool_t value);
956
/**
jehan's avatar
jehan committed
957
 * @ingroup network_parameters
958 959 960
 * return network state either as positioned by the application or by linphone
 */
bool_t linphone_core_is_network_reachabled(LinphoneCore* lc);
961

962
/**
jehan's avatar
jehan committed
963
 *  @ingroup network_parameters
964 965 966 967
 *  enable signaling keep alive. small udp packet sent periodically to keep udp NAT association
 */
void linphone_core_enable_keep_alive(LinphoneCore* lc,bool_t enable);
/**
jehan's avatar
jehan committed
968
 *  @ingroup network_parameters
969 970 971
 * Is signaling keep alive
 */
bool_t linphone_core_keep_alive_enabled(LinphoneCore* lc);
aymeric's avatar
aymeric committed
972 973 974 975 976 977 978

void *linphone_core_get_user_data(LinphoneCore *lc);

/* returns LpConfig object to read/write to the config file: usefull if you wish to extend
the config file with your own sections */
struct _LpConfig *linphone_core_get_config(LinphoneCore *lc);

smorlat's avatar
smorlat committed
979 980
/* attempts to wake up another linphone engine already running.
The "show" callback is called for the other linphone, causing gui to show up.
981
call_addr is an optional sip-uri to call immediately after waking up.
smorlat's avatar
smorlat committed
982
The method returns 0 if an already running linphone was found*/
983

984 985
int linphone_core_wake_up_possible_already_running_instance(
    const char * config_file, const char * call_addr);
smorlat's avatar
smorlat committed
986

987
/*set a callback for some blocking operations, it takes you informed of the progress of the operation*/
988
void linphone_core_set_waiting_callback(LinphoneCore *lc, LinphoneWaitingCallback cb, void *user_context);
989

smorlat's avatar
smorlat committed
990 991 992
/*returns the list of registered SipSetup (linphonecore plugins) */
const MSList * linphone_core_get_sip_setups(LinphoneCore *lc);

aymeric's avatar
aymeric committed
993 994
void linphone_core_destroy(LinphoneCore *lc);

995 996
/*for advanced users:*/
void linphone_core_set_audio_transports(LinphoneCore *lc, RtpTransport *rtp, RtpTransport *rtcp);
997 998
void linphone_core_set_video_transports(LinphoneCore *lc, RtpTransport *rtp, RtpTransport *rtcp);

999

1000 1001
int linphone_core_get_current_call_stats(LinphoneCore *lc, rtp_stats_t *local, rtp_stats_t *remote);

Simon Morlat's avatar
Simon Morlat committed
1002 1003
const MSList *linphone_core_get_calls(LinphoneCore *lc);

1004
LinphoneGlobalState linphone_core_get_global_state(const LinphoneCore *lc);
1005 1006 1007 1008 1009
/**
 * force registration refresh to be initiated upon next iterate
 * @ingroup proxies
 */
void linphone_core_refresh_registers(LinphoneCore* lc);	
1010

aymeric's avatar
aymeric committed
1011 1012 1013 1014
#ifdef __cplusplus
}
#endif

1015
void linphone_call_send_vfu_request(LinphoneCall *call);
1016

aymeric's avatar
aymeric committed
1017
#endif