linphonecore.h 165 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"
Sylvain Berfini's avatar
Sylvain Berfini committed
26
#include "mediastreamer2/mediastream.h"
27
#include "mediastreamer2/bitratecontrol.h"
28 29

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

Ghislain MARY's avatar
Ghislain MARY committed
35 36
#include "lpconfig.h"

smorlat's avatar
smorlat committed
37
#define LINPHONE_IPADDR_SIZE 64
smorlat's avatar
smorlat committed
38
#define LINPHONE_HOSTNAME_SIZE 128
smorlat's avatar
smorlat committed
39

jehan's avatar
jehan committed
40 41
#ifndef LINPHONE_PUBLIC
	#define LINPHONE_PUBLIC MS2_PUBLIC
Sylvain Berfini's avatar
Sylvain Berfini committed
42 43
#endif

aymeric's avatar
aymeric committed
44 45 46 47 48
#ifdef __cplusplus
extern "C" {
#endif

struct _LinphoneCore;
jehan's avatar
jehan committed
49 50 51 52 53
/**
 * Linphone core main object created by function linphone_core_new() .
 * @ingroup initializing
 */
typedef struct _LinphoneCore LinphoneCore;
aymeric's avatar
aymeric committed
54

55

56 57 58 59 60 61 62 63 64 65 66 67 68
/**
 * Disable a sip transport
 * Use with #LCSipTransports
 * @ingroup initializing
 */
#define LC_SIP_TRANSPORT_DISABLED 0
/**
 * Randomly chose a sip port for this transport
 * Use with #LCSipTransports
 * @ingroup initializing
 */
#define LC_SIP_TRANSPORT_RANDOM -1

jehan's avatar
jehan committed
69 70 71 72 73
/**
 * Linphone core SIP transport ports.
 * Use with #linphone_core_set_sip_transports
 * @ingroup initializing
 */
jehan's avatar
jehan committed
74
typedef struct _LCSipTransports{
jehan's avatar
jehan committed
75 76 77
	/**
	 * udp port to listening on, negative value if not set
	 * */
78
	int udp_port;
jehan's avatar
jehan committed
79 80 81
	/**
	 * tcp port to listening on, negative value if not set
	 * */
82
	int tcp_port;
jehan's avatar
jehan committed
83 84 85
	/**
	 * dtls port to listening on, negative value if not set
	 * */
86
	int dtls_port;
jehan's avatar
jehan committed
87 88 89
	/**
	 * tls port to listening on, negative value if not set
	 * */
90
	int tls_port;
jehan's avatar
jehan committed
91 92
} LCSipTransports;

93

94 95
/**
 * Enum describing transport type for LinphoneAddress.
96
 * @ingroup linphone_address
97 98 99 100 101 102 103 104 105
**/
enum _LinphoneTransportType{
	LinphoneTransportUdp,
	LinphoneTransportTcp,
	LinphoneTransportTls,
	LinphoneTransportDtls
};
/*this enum MUST be kept in sync with the SalTransport from sal.h*/

106 107 108 109
/**
 * Typedef for transport type enum.
 * @ingroup linphone_address
**/
110 111
typedef enum _LinphoneTransportType LinphoneTransportType;

smorlat's avatar
smorlat committed
112 113 114 115 116 117 118 119 120 121
/**
 * 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.
122
 *
smorlat's avatar
smorlat committed
123 124
 * @ingroup linphone_address
 */
125
typedef struct SalAddress LinphoneAddress;
126

127 128
typedef struct belle_sip_dict LinphoneDictionary;

129 130 131 132 133 134 135 136 137 138 139
/**
 * The LinphoneCall object represents a call issued or received by the LinphoneCore
 * @ingroup call_control
**/
struct _LinphoneCall;
/**
 * The LinphoneCall object represents a call issued or received by the LinphoneCore
 * @ingroup call_control
**/
typedef struct _LinphoneCall LinphoneCall;

140
/**
141 142 143
 * Enum describing various failure reasons or contextual information for some events.
 * @see linphone_call_get_reason()
 * @see linphone_proxy_config_get_error()
144
 * @see linphone_error_info_get_reason()
145 146 147 148 149
 * @ingroup misc
**/
enum _LinphoneReason{
	LinphoneReasonNone,
	LinphoneReasonNoResponse, /**<No response received from remote*/
150
	LinphoneReasonForbidden, /**<Authentication failed due to bad credentials or resource forbidden*/
151
	LinphoneReasonDeclined, /**<The call has been declined*/
152 153
	LinphoneReasonNotFound, /**<Destination of the call was not found.*/
	LinphoneReasonNotAnswered, /**<The call was not answered in time (request timeout)*/
154
	LinphoneReasonBusy, /**<Phone line was busy */
155
	LinphoneReasonUnsupportedContent, /**<Unsupported content */
jehan's avatar
jehan committed
156
	LinphoneReasonIOError, /**<Transport error: connection failures, disconnections etc...*/
jehan's avatar
jehan committed
157
	LinphoneReasonDoNotDisturb, /**<Do not disturb reason*/
158
	LinphoneReasonUnauthorized, /**<Operation is unauthorized because missing credential*/
159
	LinphoneReasonNotAcceptable, /**<Operation like call update rejected by peer*/
160 161
	LinphoneReasonNoMatch, /**<Operation could not be executed by server or remote client because it didn't have any context for it*/
	LinphoneReasonMovedPermanently, /**<Resource moved permanently*/
162
	LinphoneReasonGone, /**<Resource no longer exists*/
163 164 165 166
	LinphoneReasonTemporarilyUnavailable, /**<Temporarily unavailable*/
	LinphoneReasonAddressIncomplete, /**<Address incomplete*/
	LinphoneReasonNotImplemented, /**<Not implemented*/
	LinphoneReasonBadGateway, /**<Bad gateway*/
167 168
	LinphoneReasonServerTimeout, /**<Server timeout*/
	LinphoneReasonUnknown /**Unknown reason*/
169 170
};

171 172
#define LinphoneReasonBadCredentials LinphoneReasonForbidden

173 174 175
/*for compatibility*/
#define LinphoneReasonMedia LinphoneReasonUnsupportedContent

176 177 178 179 180 181 182 183 184 185
/**
 * Enum describing failure reasons.
 * @ingroup misc
**/
typedef enum _LinphoneReason LinphoneReason;

/**
 * Converts a LinphoneReason enum to a string.
 * @ingroup misc
**/
186
LINPHONE_PUBLIC const char *linphone_reason_to_string(LinphoneReason err);
187

188 189 190 191 192 193 194 195 196 197 198 199
/**
 * Object representing full details about a signaling error or status.
 * All LinphoneErrorInfo object returned by the liblinphone API are readonly and transcients. For safety they must be used immediately
 * after obtaining them. Any other function call to the liblinphone may change their content or invalidate the pointer.
 * @ingroup misc
**/
typedef struct _LinphoneErrorInfo LinphoneErrorInfo;

LINPHONE_PUBLIC LinphoneReason linphone_error_info_get_reason(const LinphoneErrorInfo *ei);
LINPHONE_PUBLIC const char *linphone_error_info_get_phrase(const LinphoneErrorInfo *ei);
LINPHONE_PUBLIC const char *linphone_error_info_get_details(const LinphoneErrorInfo *ei);
LINPHONE_PUBLIC int linphone_error_info_get_protocol_code(const LinphoneErrorInfo *ei);
200 201

/* linphone dictionary */
202
LINPHONE_PUBLIC	LinphoneDictionary* linphone_dictionary_new(void);
Ghislain MARY's avatar
Ghislain MARY committed
203 204 205
LINPHONE_PUBLIC LinphoneDictionary * linphone_dictionary_clone(const LinphoneDictionary* src);
LINPHONE_PUBLIC LinphoneDictionary * linphone_dictionary_ref(LinphoneDictionary* obj);
LINPHONE_PUBLIC void linphone_dictionary_unref(LinphoneDictionary* obj);
206 207 208 209 210 211 212 213
LINPHONE_PUBLIC void linphone_dictionary_set_int(LinphoneDictionary* obj, const char* key, int value);
LINPHONE_PUBLIC int linphone_dictionary_get_int(LinphoneDictionary* obj, const char* key, int default_value);
LINPHONE_PUBLIC void linphone_dictionary_set_string(LinphoneDictionary* obj, const char* key, const char*value);
LINPHONE_PUBLIC const char* linphone_dictionary_get_string(LinphoneDictionary* obj, const char* key, const char* default_value);
LINPHONE_PUBLIC void linphone_dictionary_set_int64(LinphoneDictionary* obj, const char* key, int64_t value);
LINPHONE_PUBLIC int64_t linphone_dictionary_get_int64(LinphoneDictionary* obj, const char* key, int64_t default_value);
LINPHONE_PUBLIC int linphone_dictionary_remove(LinphoneDictionary* obj, const char* key);
LINPHONE_PUBLIC void linphone_dictionary_clear(LinphoneDictionary* obj);
214
LINPHONE_PUBLIC int linphone_dictionary_haskey(const LinphoneDictionary* obj, const char* key);
215 216 217 218 219 220
LINPHONE_PUBLIC void linphone_dictionary_foreach( const LinphoneDictionary* obj, void (*apply_func)(const char*key, void* value, void* userdata), void* userdata);
/**
 * Converts a config section into a dictionary.
 * @return a #LinphoneDictionary with all the keys from a section, or NULL if the section doesn't exist
 * @ingroup misc
 */
Ghislain MARY's avatar
Ghislain MARY committed
221
LINPHONE_PUBLIC LinphoneDictionary* lp_config_section_to_dict( const LpConfig* lpconfig, const char* section );
222 223 224 225 226 227

/**
 * Loads a dictionary into a section of the lpconfig. If the section doesn't exist it is created.
 * Overwrites existing keys, creates non-existing keys.
 * @ingroup misc
 */
Ghislain MARY's avatar
Ghislain MARY committed
228
LINPHONE_PUBLIC void lp_config_load_dict_to_section( LpConfig* lpconfig, const char* section, const LinphoneDictionary* dict);
229 230


231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259
/**
 * @addtogroup media_parameters
 * @{
**/

/**
 * Object representing an RTP payload type.
 */
typedef PayloadType LinphonePayloadType;

/**
 * Get the type of payload.
 * @param[in] pt LinphonePayloadType object
 * @return The type of payload.
 */
LINPHONE_PUBLIC int linphone_payload_type_get_type(const LinphonePayloadType *pt);

/**
 * Get the normal bitrate in bits/s.
 * @param[in] pt LinphonePayloadType object
 * @return The normal bitrate in bits/s.
 */
LINPHONE_PUBLIC int linphone_payload_type_get_normal_bitrate(const LinphonePayloadType *pt);

/**
 * Get the mime type.
 * @param[in] pt LinphonePayloadType object
 * @return The mime type.
 */
260
LINPHONE_PUBLIC const char * linphone_payload_type_get_mime_type(const LinphonePayloadType *pt);
261 262 263 264 265 266 267 268

/**
 * Get the number of channels.
 * @param[in] pt LinphonePayloadType object
 * @return The number of channels.
 */
LINPHONE_PUBLIC int linphone_payload_type_get_channels(const LinphonePayloadType *pt);

269

270 271 272 273 274 275 276 277 278 279 280 281 282 283
/**
 * Enum describing RTP AVPF activation modes.
**/
enum _LinphoneAVPFMode{
	LinphoneAVPFDefault=-1, /**<Use default value defined at upper level*/
	LinphoneAVPFDisabled, /**<AVPF is disabled*/
	LinphoneAVPFEnabled /**<AVPF is enabled */
};

/**
 * Enum describing RTP AVPF activation modes.
**/
typedef enum _LinphoneAVPFMode  LinphoneAVPFMode;

284 285 286 287 288 289
/**
 * Enum describing type of media encryption types.
**/
enum _LinphoneMediaEncryption {
	LinphoneMediaEncryptionNone, /**< No media encryption is used */
	LinphoneMediaEncryptionSRTP, /**< Use SRTP media encryption */
johan's avatar
johan committed
290 291
	LinphoneMediaEncryptionZRTP, /**< Use ZRTP media encryption */
	LinphoneMediaEncryptionDTLS /**< Use DTLS media encryption */
292 293 294 295 296 297 298 299 300 301 302 303
};

/**
 * Enum describing type of media encryption types.
**/
typedef enum _LinphoneMediaEncryption LinphoneMediaEncryption;

/**
 * Convert enum member to string.
**/
LINPHONE_PUBLIC const char *linphone_media_encryption_to_string(LinphoneMediaEncryption menc);

304 305 306 307
/**
 * @}
**/

308

Simon Morlat's avatar
Simon Morlat committed
309 310 311
/*
 * Note for developers: this enum must be kept synchronized with the SalPrivacy enum declared in sal.h
 */
Simon Morlat's avatar
Simon Morlat committed
312
/**
jehan's avatar
jehan committed
313
 * @ingroup call_control
jehan's avatar
jehan committed
314
 * Defines privacy policy to apply as described by rfc3323
Simon Morlat's avatar
Simon Morlat committed
315
**/
jehan's avatar
jehan committed
316 317
typedef enum _LinphonePrivacy {
	/**
Simon Morlat's avatar
Simon Morlat committed
318
	 * Privacy services must not perform any privacy function
jehan's avatar
jehan committed
319
	 */
Simon Morlat's avatar
Simon Morlat committed
320
	LinphonePrivacyNone=0x0,
jehan's avatar
jehan committed
321
	/**
jehan's avatar
jehan committed
322
	 * Request that privacy services provide a user-level privacy
Simon Morlat's avatar
Simon Morlat committed
323 324
	 * function.
	 * With this mode, "from" header is hidden, usually replaced by  From: "Anonymous" <sip:anonymous@anonymous.invalid>
jehan's avatar
jehan committed
325
	 */
jehan's avatar
jehan committed
326
	LinphonePrivacyUser=0x1,
jehan's avatar
jehan committed
327
	/**
jehan's avatar
jehan committed
328
	 * Request that privacy services modify headers that cannot
Simon Morlat's avatar
Simon Morlat committed
329
	 * be set arbitrarily by the user (Contact/Via).
jehan's avatar
jehan committed
330
	 */
jehan's avatar
jehan committed
331
	LinphonePrivacyHeader=0x2,
Simon Morlat's avatar
Simon Morlat committed
332
	/**
jehan's avatar
jehan committed
333
	 *  Request that privacy services provide privacy for session
Simon Morlat's avatar
Simon Morlat committed
334 335
	 * media
	 */
jehan's avatar
jehan committed
336 337 338 339
	LinphonePrivacySession=0x4,
	/**
	 * rfc3325
	 * The presence of this privacy type in
Simon Morlat's avatar
Simon Morlat committed
340 341 342 343 344
	 * a Privacy header field indicates that the user would like the Network
	 * Asserted Identity to be kept private with respect to SIP entities
	 * outside the Trust Domain with which the user authenticated.  Note
	 * that a user requesting multiple types of privacy MUST include all of
	 * the requested privacy types in its Privacy header field value
jehan's avatar
jehan committed
345 346 347 348 349
	 *
	 */
	LinphonePrivacyId=0x8,
	/**
	 * Privacy service must perform the specified services or
Simon Morlat's avatar
Simon Morlat committed
350
	 * fail the request
jehan's avatar
jehan committed
351 352
	 *
	 **/
Simon Morlat's avatar
Simon Morlat committed
353
	LinphonePrivacyCritical=0x10,
Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
354

Simon Morlat's avatar
Simon Morlat committed
355
	/**
Simon Morlat's avatar
Simon Morlat committed
356
	 * Special keyword to use privacy as defined either globally or by proxy using linphone_proxy_config_set_privacy()
Simon Morlat's avatar
Simon Morlat committed
357 358
	 */
	LinphonePrivacyDefault=0x8000,
jehan's avatar
jehan committed
359
} LinphonePrivacy;
jehan's avatar
jehan committed
360 361 362 363 364
/*
 * a mask  of #LinphonePrivacy values
 * */
typedef unsigned int LinphonePrivacyMask;

Simon Morlat's avatar
Simon Morlat committed
365 366

LINPHONE_PUBLIC const char* linphone_privacy_to_string(LinphonePrivacy privacy);
Ghislain MARY's avatar
Ghislain MARY committed
367 368 369


#ifdef IN_LINPHONE
370
#include "buffer.h"
Ghislain MARY's avatar
Ghislain MARY committed
371 372
#include "call_log.h"
#include "call_params.h"
373 374 375
#include "content.h"
#include "event.h"
#include "linphonefriend.h"
376
#include "xmlrpc.h"
Ghislain MARY's avatar
Ghislain MARY committed
377
#else
378
#include "linphone/buffer.h"
Ghislain MARY's avatar
Ghislain MARY committed
379 380
#include "linphone/call_log.h"
#include "linphone/call_params.h"
381 382 383
#include "linphone/content.h"
#include "linphone/event.h"
#include "linphone/linphonefriend.h"
384
#include "linphone/xmlrpc.h"
Ghislain MARY's avatar
Ghislain MARY committed
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401
#endif

LINPHONE_PUBLIC	LinphoneAddress * linphone_address_new(const char *addr);
LINPHONE_PUBLIC LinphoneAddress * linphone_address_clone(const LinphoneAddress *addr);
LINPHONE_PUBLIC LinphoneAddress * linphone_address_ref(LinphoneAddress *addr);
LINPHONE_PUBLIC void linphone_address_unref(LinphoneAddress *addr);
LINPHONE_PUBLIC const char *linphone_address_get_scheme(const LinphoneAddress *u);
LINPHONE_PUBLIC	const char *linphone_address_get_display_name(const LinphoneAddress* u);
LINPHONE_PUBLIC	const char *linphone_address_get_username(const LinphoneAddress *u);
LINPHONE_PUBLIC	const char *linphone_address_get_domain(const LinphoneAddress *u);
LINPHONE_PUBLIC int linphone_address_get_port(const LinphoneAddress *u);
LINPHONE_PUBLIC	void linphone_address_set_display_name(LinphoneAddress *u, const char *display_name);
LINPHONE_PUBLIC	void linphone_address_set_username(LinphoneAddress *uri, const char *username);
LINPHONE_PUBLIC	void linphone_address_set_domain(LinphoneAddress *uri, const char *host);
LINPHONE_PUBLIC	void linphone_address_set_port(LinphoneAddress *uri, int port);
/*remove tags, params etc... so that it is displayable to the user*/
LINPHONE_PUBLIC	void linphone_address_clean(LinphoneAddress *uri);
402 403 404
LINPHONE_PUBLIC bool_t linphone_address_is_secure(const LinphoneAddress *addr);
LINPHONE_PUBLIC bool_t linphone_address_get_secure(const LinphoneAddress *addr);
LINPHONE_PUBLIC void linphone_address_set_secure(LinphoneAddress *addr, bool_t enabled);
405
LINPHONE_PUBLIC bool_t linphone_address_is_sip(const LinphoneAddress *uri);
Ghislain MARY's avatar
Ghislain MARY committed
406 407 408 409 410
LINPHONE_PUBLIC LinphoneTransportType linphone_address_get_transport(const LinphoneAddress *uri);
LINPHONE_PUBLIC void linphone_address_set_transport(LinphoneAddress *uri,LinphoneTransportType type);
LINPHONE_PUBLIC	char *linphone_address_as_string(const LinphoneAddress *u);
LINPHONE_PUBLIC	char *linphone_address_as_string_uri_only(const LinphoneAddress *u);
LINPHONE_PUBLIC	bool_t linphone_address_weak_equal(const LinphoneAddress *a1, const LinphoneAddress *a2);
411
LINPHONE_PUBLIC bool_t linphone_address_equal(const LinphoneAddress *a1, const LinphoneAddress *a2);
412 413 414
LINPHONE_PUBLIC void linphone_address_set_password(LinphoneAddress *addr, const char *passwd);
LINPHONE_PUBLIC const char *linphone_address_get_password(const LinphoneAddress *addr);
LINPHONE_PUBLIC void linphone_address_set_header(LinphoneAddress *addr, const char *header_name, const char *header_value);
Ghislain MARY's avatar
Ghislain MARY committed
415 416 417 418 419 420 421 422 423 424 425 426
LINPHONE_PUBLIC	void linphone_address_destroy(LinphoneAddress *u);

/**
 * Create a #LinphoneAddress object by parsing the user supplied address, given as a string.
 * @param[in] lc #LinphoneCore object
 * @param[in] address String containing the user supplied address
 * @return The create #LinphoneAddress object
 * @ingroup linphone_address
 */
LINPHONE_PUBLIC LinphoneAddress * linphone_core_create_address(LinphoneCore *lc, const char *address);

struct _SipSetupContext;
Simon Morlat's avatar
Simon Morlat committed
427 428 429 430 431 432 433 434


struct _LinphoneInfoMessage;
/**
 * The LinphoneInfoMessage is an object representing an informational message sent or received by the core.
**/
typedef struct _LinphoneInfoMessage LinphoneInfoMessage;

435 436
LINPHONE_PUBLIC LinphoneInfoMessage *linphone_core_create_info_message(LinphoneCore*lc);
LINPHONE_PUBLIC int linphone_call_send_info_message(struct _LinphoneCall *call, const LinphoneInfoMessage *info);
Simon Morlat's avatar
Simon Morlat committed
437
LINPHONE_PUBLIC void linphone_info_message_add_header(LinphoneInfoMessage *im, const char *name, const char *value);
Simon Morlat's avatar
Simon Morlat committed
438
LINPHONE_PUBLIC const char *linphone_info_message_get_header(const LinphoneInfoMessage *im, const char *name);
Simon Morlat's avatar
Simon Morlat committed
439
LINPHONE_PUBLIC void linphone_info_message_set_content(LinphoneInfoMessage *im,  const LinphoneContent *content);
Simon Morlat's avatar
Simon Morlat committed
440
LINPHONE_PUBLIC const LinphoneContent * linphone_info_message_get_content(const LinphoneInfoMessage *im);
Simon Morlat's avatar
Simon Morlat committed
441
LINPHONE_PUBLIC void linphone_info_message_destroy(LinphoneInfoMessage *im);
442
LINPHONE_PUBLIC LinphoneInfoMessage *linphone_info_message_copy(const LinphoneInfoMessage *orig);
Simon Morlat's avatar
Simon Morlat committed
443

Simon Morlat's avatar
Simon Morlat committed
444 445


446 447
/**
 * Structure describing policy regarding video streams establishments.
Simon Morlat's avatar
Simon Morlat committed
448
 * @ingroup media_parameters
449 450
**/
struct _LinphoneVideoPolicy{
Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
451
	bool_t automatically_initiate; /**<Whether video shall be automatically proposed for outgoing calls.*/
452 453 454 455
	bool_t automatically_accept; /**<Whether video shall be automatically accepted for incoming calls*/
	bool_t unused[2];
};

Simon Morlat's avatar
Simon Morlat committed
456 457 458 459
/**
 * Structure describing policy regarding video streams establishments.
 * @ingroup media_parameters
**/
460 461
typedef struct _LinphoneVideoPolicy LinphoneVideoPolicy;

462

Yann Diorcet's avatar
Yann Diorcet committed
463 464


Simon Morlat's avatar
Simon Morlat committed
465 466 467 468 469
/**
 * @addtogroup call_misc
 * @{
**/

Yann Diorcet's avatar
Yann Diorcet committed
470 471 472
#define LINPHONE_CALL_STATS_AUDIO 0
#define LINPHONE_CALL_STATS_VIDEO 1

473 474 475 476 477
/**
 * Enum describing ICE states.
 * @ingroup initializing
**/
enum _LinphoneIceState{
Simon Morlat's avatar
Simon Morlat committed
478
	LinphoneIceStateNotActivated, /**< ICE has not been activated for this call or stream*/
Ghislain MARY's avatar
Ghislain MARY committed
479
	LinphoneIceStateFailed, /**< ICE processing has failed */
480 481 482 483 484 485 486 487 488 489 490 491
	LinphoneIceStateInProgress, /**< ICE process is in progress */
	LinphoneIceStateHostConnection, /**< ICE has established a direct connection to the remote host */
	LinphoneIceStateReflexiveConnection, /**< ICE has established a connection to the remote host through one or several NATs */
	LinphoneIceStateRelayConnection /**< ICE has established a connection through a relay */
};

/**
 * Enum describing Ice states.
 * @ingroup initializing
**/
typedef enum _LinphoneIceState LinphoneIceState;

492 493
LINPHONE_PUBLIC const char *linphone_ice_state_to_string(LinphoneIceState state);

Yann Diorcet's avatar
Yann Diorcet committed
494 495 496 497 498 499 500 501 502 503 504 505
/**
 * Enum describing uPnP states.
 * @ingroup initializing
**/
enum _LinphoneUpnpState{
	LinphoneUpnpStateIdle, /**< uPnP is not activate */
	LinphoneUpnpStatePending, /**< uPnP process is in progress */
	LinphoneUpnpStateAdding,   /**< Internal use: Only used by port binding */
	LinphoneUpnpStateRemoving, /**< Internal use: Only used by port binding */
	LinphoneUpnpStateNotAvailable,  /**< uPnP is not available */
	LinphoneUpnpStateOk, /**< uPnP is enabled */
	LinphoneUpnpStateKo, /**< uPnP processing has failed */
Yann Diorcet's avatar
Yann Diorcet committed
506
	LinphoneUpnpStateBlacklisted, /**< IGD router is blacklisted */
Yann Diorcet's avatar
Yann Diorcet committed
507 508 509 510 511 512 513 514
};

/**
 * Enum describing uPnP states.
 * @ingroup initializing
**/
typedef enum _LinphoneUpnpState LinphoneUpnpState;

515

Ghislain MARY's avatar
Ghislain MARY committed
516 517
#define LINPHONE_CALL_STATS_RECEIVED_RTCP_UPDATE (1 << 0) /**< received_rtcp field of LinphoneCallStats object has been updated */
#define LINPHONE_CALL_STATS_SENT_RTCP_UPDATE (1 << 1) /**< sent_rtcp field of LinphoneCallStats object has been updated */
518
#define LINPHONE_CALL_STATS_PERIODICAL_UPDATE (1 << 2) /**< Every seconds LinphoneCallStats object has been updated */
519 520


Simon Morlat's avatar
Simon Morlat committed
521 522 523
/**
 * The LinphoneCallStats objects carries various statistic informations regarding quality of audio or video streams.
 *
524
 * To receive these informations periodically and as soon as they are computed, the application is invited to place a #LinphoneCoreCallStatsUpdatedCb callback in the LinphoneCoreVTable structure
Simon Morlat's avatar
Simon Morlat committed
525 526 527 528 529 530 531 532 533
 * it passes for instanciating the LinphoneCore object (see linphone_core_new() ).
 *
 * At any time, the application can access last computed statistics using linphone_call_get_audio_stats() or linphone_call_get_video_stats().
**/
typedef struct _LinphoneCallStats LinphoneCallStats;

/**
 * The LinphoneCallStats objects carries various statistic informations regarding quality of audio or video streams.
 *
534
 * To receive these informations periodically and as soon as they are computed, the application is invited to place a #LinphoneCoreCallStatsUpdatedCb callback in the LinphoneCoreVTable structure
535
 * it passes for instantiating the LinphoneCore object (see linphone_core_new() ).
Simon Morlat's avatar
Simon Morlat committed
536 537 538 539 540 541 542 543 544
 *
 * At any time, the application can access last computed statistics using linphone_call_get_audio_stats() or linphone_call_get_video_stats().
**/
struct _LinphoneCallStats {
	int		type; /**< Can be either LINPHONE_CALL_STATS_AUDIO or LINPHONE_CALL_STATS_VIDEO*/
	jitter_stats_t	jitter_stats; /**<jitter buffer statistics, see oRTP documentation for details */
	mblk_t*		received_rtcp; /**<Last RTCP packet received, as a mblk_t structure. See oRTP documentation for details how to extract information from it*/
	mblk_t*		sent_rtcp;/**<Last RTCP packet sent, as a mblk_t structure. See oRTP documentation for details how to extract information from it*/
	float		round_trip_delay; /**<Round trip propagation time in seconds if known, -1 if unknown.*/
545
	LinphoneIceState	ice_state; /**< State of ICE processing. */
Yann Diorcet's avatar
Yann Diorcet committed
546
	LinphoneUpnpState	upnp_state; /**< State of uPnP processing. */
547 548
	float download_bandwidth; /**<Download bandwidth measurement of received stream, expressed in kbit/s, including IP/UDP/RTP headers*/
	float upload_bandwidth; /**<Download bandwidth measurement of sent stream, expressed in kbit/s, including IP/UDP/RTP headers*/
549 550
	float local_late_rate; /**<percentage of packet received too late over last second*/
	float local_loss_rate; /**<percentage of lost packet over last second*/
Ghislain MARY's avatar
Ghislain MARY committed
551
	int updated; /**< Tell which RTCP packet has been updated (received_rtcp or sent_rtcp). Can be either LINPHONE_CALL_STATS_RECEIVED_RTCP_UPDATE or LINPHONE_CALL_STATS_SENT_RTCP_UPDATE */
552 553
	float rtcp_download_bandwidth; /**<RTCP download bandwidth measurement of received stream, expressed in kbit/s, including IP/UDP/RTP headers*/
	float rtcp_upload_bandwidth; /**<RTCP download bandwidth measurement of sent stream, expressed in kbit/s, including IP/UDP/RTP headers*/
554
	rtp_stats_t rtp_stats; /**< RTP stats */
Simon Morlat's avatar
Simon Morlat committed
555 556 557 558 559
};

/**
 * @}
**/
Yann Diorcet's avatar
Yann Diorcet committed
560

Sylvain Berfini's avatar
Sylvain Berfini committed
561 562
LINPHONE_PUBLIC const LinphoneCallStats *linphone_call_get_audio_stats(LinphoneCall *call);
LINPHONE_PUBLIC const LinphoneCallStats *linphone_call_get_video_stats(LinphoneCall *call);
563 564 565 566
LINPHONE_PUBLIC float linphone_call_stats_get_sender_loss_rate(const LinphoneCallStats *stats);
LINPHONE_PUBLIC float linphone_call_stats_get_receiver_loss_rate(const LinphoneCallStats *stats);
LINPHONE_PUBLIC float linphone_call_stats_get_sender_interarrival_jitter(const LinphoneCallStats *stats, LinphoneCall *call);
LINPHONE_PUBLIC float linphone_call_stats_get_receiver_interarrival_jitter(const LinphoneCallStats *stats, LinphoneCall *call);
567
LINPHONE_PUBLIC rtp_stats_t linphone_call_stats_get_rtp_stats(const LinphoneCallStats *statss);
568
LINPHONE_PUBLIC uint64_t linphone_call_stats_get_late_packets_cumulative_number(const LinphoneCallStats *stats, LinphoneCall *call);
569 570 571 572
LINPHONE_PUBLIC float linphone_call_stats_get_download_bandwidth(const LinphoneCallStats *stats);
LINPHONE_PUBLIC float linphone_call_stats_get_upload_bandwidth(const LinphoneCallStats *stats);
LINPHONE_PUBLIC LinphoneIceState linphone_call_stats_get_ice_state(const LinphoneCallStats *stats);
LINPHONE_PUBLIC LinphoneUpnpState linphone_call_stats_get_upnp_state(const LinphoneCallStats *stats);
Yann Diorcet's avatar
Yann Diorcet committed
573

574
/** Callback prototype */
575
typedef void (*LinphoneCallCbFunc)(LinphoneCall *call,void * user_data);
576

577 578 579 580 581 582 583 584 585 586 587 588 589 590
/**
 * Player interface.
 * @ingroup call_control
**/
typedef struct _LinphonePlayer LinphonePlayer;

/**
 * Callback for notifying end of play (file).
 * @param obj the LinphonePlayer
 * @param user_data the user_data provided when calling linphone_player_open().
 * @ingroup call_control
**/
typedef void (*LinphonePlayerEofCallback)(struct _LinphonePlayer *obj, void *user_data);

591 592 593 594 595 596 597 598 599
LINPHONE_PUBLIC int linphone_player_open(LinphonePlayer *obj, const char *filename, LinphonePlayerEofCallback, void *user_data);
LINPHONE_PUBLIC int linphone_player_start(LinphonePlayer *obj);
LINPHONE_PUBLIC int linphone_player_pause(LinphonePlayer *obj);
LINPHONE_PUBLIC int linphone_player_seek(LinphonePlayer *obj, int time_ms);
LINPHONE_PUBLIC MSPlayerState linphone_player_get_state(LinphonePlayer *obj);
LINPHONE_PUBLIC int linphone_player_get_duration(LinphonePlayer *obj);
LINPHONE_PUBLIC int linphone_player_get_current_position(LinphonePlayer *obj);
LINPHONE_PUBLIC void linphone_player_close(LinphonePlayer *obj);
LINPHONE_PUBLIC void linphone_player_destroy(LinphonePlayer *obj);
600

601
/**
602
 * Create an independent media file player.
603
 * This player support WAVE and MATROSKA formats.
604
 * @param lc A LinphoneCore object
605 606
 * @param snd_card Playback sound card. If NULL, the sound card set in LinphoneCore will be used
 * @param video_out Video display. If NULL, the video display set in LinphoneCore will be used
607
 * @param window_id Id of the drawing window. Depend of video out
608 609
 * @return A pointer on the new instance. NULL if faild.
 */
Ghislain MARY's avatar
Ghislain MARY committed
610
LINPHONE_PUBLIC LinphonePlayer *linphone_core_create_local_player(LinphoneCore *lc, MSSndCard *snd_card, const char *video_out, void *window_id);
611

612
/**
613
 * Check whether Matroksa format is supported by the player
614 615
 * @return TRUE if it is supported
 */
616
LINPHONE_PUBLIC bool_t linphone_local_player_matroska_supported(void);
617

Simon Morlat's avatar
Simon Morlat committed
618 619 620 621 622
/**
 * 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
**/
623
typedef enum _LinphoneCallState{
Simon Morlat's avatar
Simon Morlat committed
624
	LinphoneCallIdle,					/**<Initial call state */
625 626 627 628 629 630 631 632 633 634 635 636 637 638
	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*/
Simon Morlat's avatar
Simon Morlat committed
639
	LinphoneCallUpdatedByRemote, /**<The call's parameters change is requested by remote end, used for example when video is added by remote */
640
	LinphoneCallIncomingEarlyMedia, /**<We are proposing early media to an incoming call */
641
	LinphoneCallUpdating, /**<A call update has been initiated by us */
642 643 644
	LinphoneCallReleased, /**< The call object is no more retained by the core */
	LinphoneCallEarlyUpdatedByRemote, /*<The call is updated by remote while not yet answered (early dialog SIP UPDATE received).*/
	LinphoneCallEarlyUpdating /*<We are updating the call while not yet answered (early dialog SIP UPDATE sent)*/
645 646
} LinphoneCallState;

647
LINPHONE_PUBLIC	const char *linphone_call_state_to_string(LinphoneCallState cs);
648

649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683
/**
 * Acquire a reference to the call.
 * An application that wishes to retain a pointer to call object
 * must use this function to unsure the pointer remains
 * valid. Once the application no more needs this pointer,
 * it must call linphone_call_unref().
 * @param[in] call The call.
 * @return The same call.
 * @ingroup call_control
**/
LINPHONE_PUBLIC LinphoneCall *linphone_call_ref(LinphoneCall *call);

/**
 * Release reference to the call.
 * @param[in] call The call.
 * @ingroup call_control
**/
LINPHONE_PUBLIC void linphone_call_unref(LinphoneCall *call);

/**
 * Retrieve the user pointer associated with the call.
 * @param[in] call The call.
 * @return The user pointer associated with the call.
 * @ingroup call_control
**/
LINPHONE_PUBLIC void *linphone_call_get_user_data(const LinphoneCall *call);

/**
 * Assign a user pointer to the call.
 * @param[in] cfg The call.
 * @param[in] ud The user pointer to associate with the call.
 * @ingroup call_control
**/
LINPHONE_PUBLIC void linphone_call_set_user_data(LinphoneCall *call, void *ud);

684 685 686 687 688 689
/**
 * Get the core that has created the specified call.
 * @param[in] call LinphoneCall object
 * @return The LinphoneCore object that has created the specified call.
 * @ingroup call_control
 */
690
LINPHONE_PUBLIC LinphoneCore *linphone_call_get_core(const LinphoneCall *call);
691

692
LINPHONE_PUBLIC	LinphoneCallState linphone_call_get_state(const LinphoneCall *call);
Ghislain MARY's avatar
Ghislain MARY committed
693
LINPHONE_PUBLIC bool_t linphone_call_asked_to_autoanswer(LinphoneCall *call);
694 695 696 697 698 699 700

/**
 * Get the remote address of the current call.
 * @param[in] lc LinphoneCore object.
 * @return The remote address of the current call or NULL if there is no current call.
 * @ingroup call_control
 */
Simon Morlat's avatar
Simon Morlat committed
701
LINPHONE_PUBLIC	const LinphoneAddress * linphone_core_get_current_call_remote_address(LinphoneCore *lc);
702

Sylvain Berfini's avatar
Sylvain Berfini committed
703 704 705
LINPHONE_PUBLIC	const LinphoneAddress * linphone_call_get_remote_address(const LinphoneCall *call);
LINPHONE_PUBLIC	char *linphone_call_get_remote_address_as_string(const LinphoneCall *call);
LINPHONE_PUBLIC	LinphoneCallDir linphone_call_get_dir(const LinphoneCall *call);
706
LINPHONE_PUBLIC	LinphoneCallLog *linphone_call_get_call_log(const LinphoneCall *call);
707 708 709 710
LINPHONE_PUBLIC const char *linphone_call_get_refer_to(const LinphoneCall *call);
LINPHONE_PUBLIC bool_t linphone_call_has_transfer_pending(const LinphoneCall *call);
LINPHONE_PUBLIC LinphoneCall *linphone_call_get_transferer_call(const LinphoneCall *call);
LINPHONE_PUBLIC LinphoneCall *linphone_call_get_transfer_target_call(const LinphoneCall *call);
711
LINPHONE_PUBLIC	LinphoneCall *linphone_call_get_replaced_call(LinphoneCall *call);
Sylvain Berfini's avatar
Sylvain Berfini committed
712
LINPHONE_PUBLIC	int linphone_call_get_duration(const LinphoneCall *call);
713
LINPHONE_PUBLIC	const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call);
714
LINPHONE_PUBLIC	const LinphoneCallParams * linphone_call_get_remote_params(LinphoneCall *call);
Ghislain MARY's avatar
Ghislain MARY committed
715 716
LINPHONE_PUBLIC void linphone_call_enable_camera(LinphoneCall *lc, bool_t enabled);
LINPHONE_PUBLIC bool_t linphone_call_camera_enabled(const LinphoneCall *lc);
717
LINPHONE_PUBLIC int linphone_call_take_video_snapshot(LinphoneCall *call, const char *file);
718
LINPHONE_PUBLIC int linphone_call_take_preview_snapshot(LinphoneCall *call, const char *file);
719
LINPHONE_PUBLIC	LinphoneReason linphone_call_get_reason(const LinphoneCall *call);
720
LINPHONE_PUBLIC const LinphoneErrorInfo *linphone_call_get_error_info(const LinphoneCall *call);
721
LINPHONE_PUBLIC	const char *linphone_call_get_remote_user_agent(LinphoneCall *call);
Sylvain Berfini's avatar
Sylvain Berfini committed
722
LINPHONE_PUBLIC	const char *linphone_call_get_remote_contact(LinphoneCall *call);
723 724 725

/**
 * Get the mesured playback volume level.
726
 *
727 728 729
 * @param call The call.
 * @return float Volume level in percentage.
 */
730
LINPHONE_PUBLIC	float linphone_call_get_play_volume(LinphoneCall *call);
731 732 733

/**
 * Get the mesured record volume level
734
 *
735 736 737
 * @param call The call.
 * @return float Volume level in percentage.
 */
738
LINPHONE_PUBLIC	float linphone_call_get_record_volume(LinphoneCall *call);
739 740

/**
741
 * Get speaker volume gain.
742 743
 * If the sound backend supports it, the returned gain is equal to the gain set
 * with the system mixer.
744
 *
745
 * @param call The call.
746
 * @return Percenatge of the max supported volume gain. Valid values are in [ 0.0 : 1.0 ].
747 748
 * In case of failure, a negative value is returned
 */
749
LINPHONE_PUBLIC float linphone_call_get_speaker_volume_gain(const LinphoneCall *call);
750 751

/**
752
 * Set speaker volume gain.
753
 * If the sound backend supports it, the new gain will synchronized with the system mixer.
754
 *
755
 * @param call The call.
756
 * @param volume Percentage of the max supported gain. Valid values are in [ 0.0 : 1.0 ].
757
 */
758
LINPHONE_PUBLIC void linphone_call_set_speaker_volume_gain(LinphoneCall *call, float volume);
759 760

/**
761
 * Get microphone volume gain.
762 763
 * If the sound backend supports it, the returned gain is equal to the gain set
 * with the system mixer.
764
 *
765
 * @param call The call.
766
 * @return double Percenatge of the max supported volume gain. Valid values are in [ 0.0 : 1.0 ].
767 768
 * In case of failure, a negative value is returned
 */
769
LINPHONE_PUBLIC float linphone_call_get_microphone_volume_gain(const LinphoneCall *call);
770 771

/**
772
 * Set microphone volume gain.
773
 * If the sound backend supports it, the new gain will synchronized with the system mixer.
774
 *
775
 * @param call The call.
776
 * @param volume Percentage of the max supported gain. Valid values are in [ 0.0 : 1.0 ].
777
 */
778
LINPHONE_PUBLIC void linphone_call_set_microphone_volume_gain(LinphoneCall *call, float volume);
779

780 781 782 783 784
LINPHONE_PUBLIC	float linphone_call_get_current_quality(LinphoneCall *call);
LINPHONE_PUBLIC	float linphone_call_get_average_quality(LinphoneCall *call);
LINPHONE_PUBLIC	const char* linphone_call_get_authentication_token(LinphoneCall *call);
LINPHONE_PUBLIC	bool_t linphone_call_get_authentication_token_verified(LinphoneCall *call);
LINPHONE_PUBLIC	void linphone_call_set_authentication_token_verified(LinphoneCall *call, bool_t verified);
785
LINPHONE_PUBLIC void linphone_call_send_vfu_request(LinphoneCall *call);
786 787 788 789
/** @deprecated Use linphone_call_get_user_data() instead. */
#define linphone_call_get_user_pointer(call) linphone_call_get_user_data(call)
/** @deprecated Use linphone_call_set_user_data() instead. */
#define linphone_call_set_user_pointer(call, ud) linphone_call_set_user_data(call, ud)
790
LINPHONE_PUBLIC	void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, LinphoneCallCbFunc cb, void* user_data);
791 792
LINPHONE_PUBLIC LinphoneCallState linphone_call_get_transfer_state(LinphoneCall *call);
LINPHONE_PUBLIC void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float* cx, float* cy);
793 794
LINPHONE_PUBLIC	void linphone_call_start_recording(LinphoneCall *call);
LINPHONE_PUBLIC	void linphone_call_stop_recording(LinphoneCall *call);
795
LINPHONE_PUBLIC LinphonePlayer * linphone_call_get_player(LinphoneCall *call);
Simon Morlat's avatar
Simon Morlat committed
796
LINPHONE_PUBLIC bool_t linphone_call_media_in_progress(LinphoneCall *call);
797 798 799 800 801 802
/**
 * Send the specified dtmf.
 *
 * The dtmf is automatically played to the user.
 * @param call The LinphoneCall object
 * @param dtmf The dtmf name specified as a char, such as '0', '#' etc...
803
 * @return 0 if successful, -1 on error.
804 805 806 807 808 809 810 811 812 813
**/
LINPHONE_PUBLIC	int linphone_call_send_dtmf(LinphoneCall *lc,char dtmf);

/**
 * Send a list of dtmf.
 *
 * The dtmfs are automatically sent to remote, separated by some needed customizable delay.
 * Sending is canceled if the call state changes to something not LinphoneCallStreamsRunning.
 * @param call The LinphoneCall object
 * @param dtmfs A dtmf sequence such as '123#123123'
814
 * @return -2 if there is already a DTMF sequence, -1 if call is not ready, 0 otherwise.
815 816 817 818 819 820 821 822 823 824 825 826 827
**/
LINPHONE_PUBLIC	int linphone_call_send_dtmfs(LinphoneCall *call,char *dtmfs);

/**
 * Stop current DTMF sequence sending.
 *
 * Please note that some DTMF could be already sent,
 * depending on when this function call is delayed from #linphone_call_send_dtmfs. This
 * function will be automatically called if call state change to anything but LinphoneCallStreamsRunning.
 *
 * @param call The LinphoneCall object
**/
LINPHONE_PUBLIC	void linphone_call_cancel_dtmfs(LinphoneCall *call);
Sylvain Berfini's avatar
Sylvain Berfini committed
828

829 830 831 832
/**
 * Get the native window handle of the video window, casted as an unsigned long.
 * @ingroup media_parameters
**/
Ghislain MARY's avatar
Ghislain MARY committed
833
LINPHONE_PUBLIC void * linphone_call_get_native_video_window_id(const LinphoneCall *call);
834 835 836 837 838 839

/**
 * Set the native video window id where the video is to be displayed.
 * For MacOS, Linux, Windows: if not set or 0 a window will be automatically created, unless the special id -1 is given.
 * @ingroup media_parameters
**/
Ghislain MARY's avatar
Ghislain MARY committed
840
LINPHONE_PUBLIC void linphone_call_set_native_video_window_id(LinphoneCall *call, void * id);
841

jehan's avatar
jehan committed
842 843
/**
 * Return TRUE if this call is currently part of a conference
844 845
 * @param call #LinphoneCall
 * @return TRUE if part of a conference.
jehan's avatar
jehan committed
846
 *
847 848
 * @deprecated
 * @ingroup call_control
jehan's avatar
jehan committed
849
 */
850
LINPHONE_PUBLIC	bool_t linphone_call_is_in_conference(const LinphoneCall *call);
jehan's avatar
jehan committed
851 852 853 854 855 856 857
/**
 * Enables or disable echo cancellation for this call
 * @param call
 * @param val
 *
 * @ingroup media_parameters
**/
858
LINPHONE_PUBLIC	void linphone_call_enable_echo_cancellation(LinphoneCall *call, bool_t val) ;
jehan's avatar
jehan committed
859 860 861 862 863
/**
 * Returns TRUE if echo cancellation is enabled.
 *
 * @ingroup media_parameters
**/
864
LINPHONE_PUBLIC	bool_t linphone_call_echo_cancellation_enabled(LinphoneCall *lc);
jehan's avatar
jehan committed
865 866 867 868 869 870 871
/**
 * Enables or disable echo limiter for this call
 * @param call
 * @param val
 *
 * @ingroup media_parameters
**/
872
LINPHONE_PUBLIC	void linphone_call_enable_echo_limiter(LinphoneCall *call, bool_t val);
jehan's avatar
jehan committed
873 874 875 876 877
/**
 * Returns TRUE if echo limiter is enabled.
 *
 * @ingroup media_parameters
**/
878
LINPHONE_PUBLIC	bool_t linphone_call_echo_limiter_enabled(const LinphoneCall *call);
Simon Morlat's avatar
Simon Morlat committed
879

880 881
/**
 * Enum describing type of audio route.
882
 * @ingroup call_control
883 884 885 886 887 888 889 890
**/
enum _LinphoneAudioRoute {
	LinphoneAudioRouteEarpiece = MSAudioRouteEarpiece,
	LinphoneAudioRouteSpeaker = MSAudioRouteSpeaker
};

/**
 * Enum describing type of audio route.
891
 * @ingroup call_control
892 893 894
**/
typedef enum _LinphoneAudioRoute LinphoneAudioRoute;

895 896 897 898
/**
 * Change the playback output device (currently only used for blackberry)
 * @param call
 * @param route the wanted audio route (earpiece, speaker, ...)
899
 *
900 901
 * @ingroup call_control
**/
902 903 904 905 906 907
LINPHONE_PUBLIC void linphone_call_set_audio_route(LinphoneCall *call, LinphoneAudioRoute route);

/**
 * Returns the number of stream for the given call.
 * Currently there is only two (Audio, Video), but later there will be more.
 * @param call
908
 *
909 910 911 912 913 914 915 916
 * @return 2
**/
LINPHONE_PUBLIC int linphone_call_get_stream_count(LinphoneCall *call);

/**
 * Returns the type of stream for the given stream index.
 * @param call
 * @param stream_index
917
 *
918 919 920 921 922 923 924 925
 * @return MsAudio if stream_index = 0, MsVideo otherwise
**/
LINPHONE_PUBLIC MSFormatType linphone_call_get_stream_type(LinphoneCall *call, int stream_index);

/**
 * Returns the meta rtp transport for the given stream index.
 * @param call
 * @param stream_index
926
 *
927 928 929 930 931 932 933 934
 * @return a pointer to the meta rtp transport if it exists, NULL otherwise
**/
LINPHONE_PUBLIC RtpTransport* linphone_call_get_meta_rtp_transport(LinphoneCall *call, int stream_index);

/**
 * Returns the meta rtcp transport for the given stream index.
 * @param call
 * @param stream_index
935
 *
936 937 938
 * @return a pointer to the meta rtcp transport if it exists, NULL otherwise
**/
LINPHONE_PUBLIC RtpTransport* linphone_call_get_meta_rtcp_transport(LinphoneCall *call, int stream_index);
939

Simon Morlat's avatar
Simon Morlat committed
940
/*keep this in sync with mediastreamer2/msvolume.h*/
Simon Morlat's avatar
Simon Morlat committed
941 942 943 944 945 946

/**
 * Lowest volume measurement that can be returned by linphone_call_get_play_volume() or linphone_call_get_record_volume(), corresponding to pure silence.
 * @ingroup call_misc
**/
#define LINPHONE_VOLUME_DB_LOWEST (-120)
Simon Morlat's avatar
Simon Morlat committed
947

smorlat's avatar
smorlat committed
948 949 950 951
/**
 * @addtogroup proxies
 * @{
**/
952

smorlat's avatar
smorlat committed
953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968
/**
 * 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.
**/
969
typedef struct _LinphoneProxyConfig LinphoneProxyConfig;
aymeric's avatar
aymeric committed
970

971 972 973 974
/**
 * LinphoneRegistrationState describes proxy registration states.
**/
typedef enum _LinphoneRegistrationState{
Simon Morlat's avatar
Simon Morlat committed
975 976 977 978 979
	LinphoneRegistrationNone, /**<Initial state for registrations */
	LinphoneRegistrationProgress, /**<Registration is in progress */
	LinphoneRegistrationOk,	/**< Registration is successful */
	LinphoneRegistrationCleared, /**< Unregistration succeeded */
	LinphoneRegistrationFailed	/**<Registration failed */
980 981
}LinphoneRegistrationState;

jehan's avatar
jehan committed
982 983 984 985
/**
 * Human readable version of the #LinphoneRegistrationState
 * @param cs sate
 */
Sylvain Berfini's avatar