linphonecore.h 172 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;
49
struct _LinphoneChatRoom;
50 51 52
struct _LinphoneAuthInfo;
struct _SipSetupContext;
struct _LinphoneInfoMessage;
53

jehan's avatar
jehan committed
54 55 56 57 58
/**
 * Linphone core main object created by function linphone_core_new() .
 * @ingroup initializing
 */
typedef struct _LinphoneCore LinphoneCore;
aymeric's avatar
aymeric committed
59

60

61 62 63 64 65 66 67 68 69 70 71 72 73
/**
 * 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
74 75 76 77 78
/**
 * Linphone core SIP transport ports.
 * Use with #linphone_core_set_sip_transports
 * @ingroup initializing
 */
jehan's avatar
jehan committed
79
typedef struct _LCSipTransports{
jehan's avatar
jehan committed
80 81 82
	/**
	 * udp port to listening on, negative value if not set
	 * */
83
	int udp_port;
jehan's avatar
jehan committed
84 85 86
	/**
	 * tcp port to listening on, negative value if not set
	 * */
87
	int tcp_port;
jehan's avatar
jehan committed
88 89 90
	/**
	 * dtls port to listening on, negative value if not set
	 * */
91
	int dtls_port;
jehan's avatar
jehan committed
92 93 94
	/**
	 * tls port to listening on, negative value if not set
	 * */
95
	int tls_port;
jehan's avatar
jehan committed
96 97
} LCSipTransports;

98

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

111 112 113 114
/**
 * Typedef for transport type enum.
 * @ingroup linphone_address
**/
115 116
typedef enum _LinphoneTransportType LinphoneTransportType;

117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
/**
 * Enum describing the stream types.
 * @ingroup initializing
**/
enum _LinphoneStreamType {
	LinphoneStreamTypeAudio,
	LinphoneStreamTypeVideo,
	LinphoneStreamTypeText,
	LinphoneStreamTypeUnknown /* WARNING: Make sure this value remains the last one in the list */
};

/**
 * Enum describing the stream types.
 * @ingroup initializing
**/
typedef enum _LinphoneStreamType LinphoneStreamType;

smorlat's avatar
smorlat committed
134 135 136 137 138 139 140 141 142 143
/**
 * 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.
144
 *
smorlat's avatar
smorlat committed
145 146
 * @ingroup linphone_address
 */
147
typedef struct SalAddress LinphoneAddress;
148

149 150
typedef struct belle_sip_dict LinphoneDictionary;

151 152 153 154 155 156 157 158 159 160 161
/**
 * 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;

162
/**
163 164 165
 * Enum describing various failure reasons or contextual information for some events.
 * @see linphone_call_get_reason()
 * @see linphone_proxy_config_get_error()
166
 * @see linphone_error_info_get_reason()
167 168 169 170 171
 * @ingroup misc
**/
enum _LinphoneReason{
	LinphoneReasonNone,
	LinphoneReasonNoResponse, /**<No response received from remote*/
172
	LinphoneReasonForbidden, /**<Authentication failed due to bad credentials or resource forbidden*/
173
	LinphoneReasonDeclined, /**<The call has been declined*/
174 175
	LinphoneReasonNotFound, /**<Destination of the call was not found.*/
	LinphoneReasonNotAnswered, /**<The call was not answered in time (request timeout)*/
176
	LinphoneReasonBusy, /**<Phone line was busy */
177
	LinphoneReasonUnsupportedContent, /**<Unsupported content */
jehan's avatar
jehan committed
178
	LinphoneReasonIOError, /**<Transport error: connection failures, disconnections etc...*/
jehan's avatar
jehan committed
179
	LinphoneReasonDoNotDisturb, /**<Do not disturb reason*/
180
	LinphoneReasonUnauthorized, /**<Operation is unauthorized because missing credential*/
181
	LinphoneReasonNotAcceptable, /**<Operation like call update rejected by peer*/
182 183
	LinphoneReasonNoMatch, /**<Operation could not be executed by server or remote client because it didn't have any context for it*/
	LinphoneReasonMovedPermanently, /**<Resource moved permanently*/
184
	LinphoneReasonGone, /**<Resource no longer exists*/
185 186 187 188
	LinphoneReasonTemporarilyUnavailable, /**<Temporarily unavailable*/
	LinphoneReasonAddressIncomplete, /**<Address incomplete*/
	LinphoneReasonNotImplemented, /**<Not implemented*/
	LinphoneReasonBadGateway, /**<Bad gateway*/
189 190
	LinphoneReasonServerTimeout, /**<Server timeout*/
	LinphoneReasonUnknown /**Unknown reason*/
191 192
};

193 194
#define LinphoneReasonBadCredentials LinphoneReasonForbidden

195 196 197
/*for compatibility*/
#define LinphoneReasonMedia LinphoneReasonUnsupportedContent

198 199 200 201 202 203 204 205 206 207
/**
 * Enum describing failure reasons.
 * @ingroup misc
**/
typedef enum _LinphoneReason LinphoneReason;

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

210 211 212 213 214 215 216 217 218 219 220 221
/**
 * 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);
222 223

/* linphone dictionary */
224
LINPHONE_PUBLIC	LinphoneDictionary* linphone_dictionary_new(void);
Ghislain MARY's avatar
Ghislain MARY committed
225 226 227
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);
228 229 230 231 232 233 234 235
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);
236
LINPHONE_PUBLIC int linphone_dictionary_haskey(const LinphoneDictionary* obj, const char* key);
237 238 239 240 241 242
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
243
LINPHONE_PUBLIC LinphoneDictionary* lp_config_section_to_dict( const LpConfig* lpconfig, const char* section );
244 245 246 247 248 249

/**
 * 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
250
LINPHONE_PUBLIC void lp_config_load_dict_to_section( LpConfig* lpconfig, const char* section, const LinphoneDictionary* dict);
251 252


253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281
/**
 * @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.
 */
282
LINPHONE_PUBLIC const char * linphone_payload_type_get_mime_type(const LinphonePayloadType *pt);
283 284 285 286 287 288 289 290

/**
 * 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);

291

292 293 294 295 296 297 298 299 300 301 302 303 304 305
/**
 * 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;

306 307 308 309 310 311
/**
 * 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
312 313
	LinphoneMediaEncryptionZRTP, /**< Use ZRTP media encryption */
	LinphoneMediaEncryptionDTLS /**< Use DTLS media encryption */
314 315 316 317 318 319 320 321 322 323 324 325
};

/**
 * 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);

326 327 328 329
/**
 * @}
**/

330

Simon Morlat's avatar
Simon Morlat committed
331 332 333
/*
 * Note for developers: this enum must be kept synchronized with the SalPrivacy enum declared in sal.h
 */
Simon Morlat's avatar
Simon Morlat committed
334
/**
jehan's avatar
jehan committed
335
 * @ingroup call_control
jehan's avatar
jehan committed
336
 * Defines privacy policy to apply as described by rfc3323
Simon Morlat's avatar
Simon Morlat committed
337
**/
jehan's avatar
jehan committed
338 339
typedef enum _LinphonePrivacy {
	/**
Simon Morlat's avatar
Simon Morlat committed
340
	 * Privacy services must not perform any privacy function
jehan's avatar
jehan committed
341
	 */
Simon Morlat's avatar
Simon Morlat committed
342
	LinphonePrivacyNone=0x0,
jehan's avatar
jehan committed
343
	/**
jehan's avatar
jehan committed
344
	 * Request that privacy services provide a user-level privacy
Simon Morlat's avatar
Simon Morlat committed
345 346
	 * function.
	 * With this mode, "from" header is hidden, usually replaced by  From: "Anonymous" <sip:anonymous@anonymous.invalid>
jehan's avatar
jehan committed
347
	 */
jehan's avatar
jehan committed
348
	LinphonePrivacyUser=0x1,
jehan's avatar
jehan committed
349
	/**
jehan's avatar
jehan committed
350
	 * Request that privacy services modify headers that cannot
Simon Morlat's avatar
Simon Morlat committed
351
	 * be set arbitrarily by the user (Contact/Via).
jehan's avatar
jehan committed
352
	 */
jehan's avatar
jehan committed
353
	LinphonePrivacyHeader=0x2,
Simon Morlat's avatar
Simon Morlat committed
354
	/**
jehan's avatar
jehan committed
355
	 *  Request that privacy services provide privacy for session
Simon Morlat's avatar
Simon Morlat committed
356 357
	 * media
	 */
jehan's avatar
jehan committed
358 359 360 361
	LinphonePrivacySession=0x4,
	/**
	 * rfc3325
	 * The presence of this privacy type in
Simon Morlat's avatar
Simon Morlat committed
362 363 364 365 366
	 * 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
367 368 369 370 371
	 *
	 */
	LinphonePrivacyId=0x8,
	/**
	 * Privacy service must perform the specified services or
Simon Morlat's avatar
Simon Morlat committed
372
	 * fail the request
jehan's avatar
jehan committed
373 374
	 *
	 **/
Simon Morlat's avatar
Simon Morlat committed
375
	LinphonePrivacyCritical=0x10,
Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
376

Simon Morlat's avatar
Simon Morlat committed
377
	/**
Simon Morlat's avatar
Simon Morlat committed
378
	 * 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
379 380
	 */
	LinphonePrivacyDefault=0x8000,
jehan's avatar
jehan committed
381
} LinphonePrivacy;
jehan's avatar
jehan committed
382 383 384 385 386
/*
 * a mask  of #LinphonePrivacy values
 * */
typedef unsigned int LinphonePrivacyMask;

Simon Morlat's avatar
Simon Morlat committed
387 388

LINPHONE_PUBLIC const char* linphone_privacy_to_string(LinphonePrivacy privacy);
Ghislain MARY's avatar
Ghislain MARY committed
389 390 391


#ifdef IN_LINPHONE
392
#include "buffer.h"
Ghislain MARY's avatar
Ghislain MARY committed
393 394
#include "call_log.h"
#include "call_params.h"
395 396 397
#include "content.h"
#include "event.h"
#include "linphonefriend.h"
398
#include "xmlrpc.h"
Ghislain MARY's avatar
Ghislain MARY committed
399
#else
400
#include "linphone/buffer.h"
Ghislain MARY's avatar
Ghislain MARY committed
401 402
#include "linphone/call_log.h"
#include "linphone/call_params.h"
403 404 405
#include "linphone/content.h"
#include "linphone/event.h"
#include "linphone/linphonefriend.h"
406
#include "linphone/xmlrpc.h"
Ghislain MARY's avatar
Ghislain MARY committed
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423
#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);
424 425 426
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);
427
LINPHONE_PUBLIC bool_t linphone_address_is_sip(const LinphoneAddress *uri);
Ghislain MARY's avatar
Ghislain MARY committed
428 429 430 431 432
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);
433
LINPHONE_PUBLIC bool_t linphone_address_equal(const LinphoneAddress *a1, const LinphoneAddress *a2);
434 435 436
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
437 438 439 440 441 442 443 444 445 446 447
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);

Simon Morlat's avatar
Simon Morlat committed
448 449 450 451 452
/**
 * The LinphoneInfoMessage is an object representing an informational message sent or received by the core.
**/
typedef struct _LinphoneInfoMessage LinphoneInfoMessage;

453 454
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
455
LINPHONE_PUBLIC void linphone_info_message_add_header(LinphoneInfoMessage *im, const char *name, const char *value);
Simon Morlat's avatar
Simon Morlat committed
456
LINPHONE_PUBLIC const char *linphone_info_message_get_header(const LinphoneInfoMessage *im, const char *name);
Simon Morlat's avatar
Simon Morlat committed
457
LINPHONE_PUBLIC void linphone_info_message_set_content(LinphoneInfoMessage *im,  const LinphoneContent *content);
Simon Morlat's avatar
Simon Morlat committed
458
LINPHONE_PUBLIC const LinphoneContent * linphone_info_message_get_content(const LinphoneInfoMessage *im);
Simon Morlat's avatar
Simon Morlat committed
459
LINPHONE_PUBLIC void linphone_info_message_destroy(LinphoneInfoMessage *im);
460
LINPHONE_PUBLIC LinphoneInfoMessage *linphone_info_message_copy(const LinphoneInfoMessage *orig);
Simon Morlat's avatar
Simon Morlat committed
461

Simon Morlat's avatar
Simon Morlat committed
462 463


464 465
/**
 * Structure describing policy regarding video streams establishments.
Simon Morlat's avatar
Simon Morlat committed
466
 * @ingroup media_parameters
467 468
**/
struct _LinphoneVideoPolicy{
Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
469
	bool_t automatically_initiate; /**<Whether video shall be automatically proposed for outgoing calls.*/
470 471 472 473
	bool_t automatically_accept; /**<Whether video shall be automatically accepted for incoming calls*/
	bool_t unused[2];
};

Simon Morlat's avatar
Simon Morlat committed
474 475 476 477
/**
 * Structure describing policy regarding video streams establishments.
 * @ingroup media_parameters
**/
478 479
typedef struct _LinphoneVideoPolicy LinphoneVideoPolicy;

480

Yann Diorcet's avatar
Yann Diorcet committed
481 482


Simon Morlat's avatar
Simon Morlat committed
483 484 485 486 487
/**
 * @addtogroup call_misc
 * @{
**/

488 489 490
#define LINPHONE_CALL_STATS_AUDIO ((int)LinphoneStreamTypeAudio)
#define LINPHONE_CALL_STATS_VIDEO ((int)LinphoneStreamTypeVideo)
#define LINPHONE_CALL_STATS_TEXT  ((int)LinphoneStreamTypeText)
Yann Diorcet's avatar
Yann Diorcet committed
491

492 493 494 495 496
/**
 * Enum describing ICE states.
 * @ingroup initializing
**/
enum _LinphoneIceState{
Simon Morlat's avatar
Simon Morlat committed
497
	LinphoneIceStateNotActivated, /**< ICE has not been activated for this call or stream*/
Ghislain MARY's avatar
Ghislain MARY committed
498
	LinphoneIceStateFailed, /**< ICE processing has failed */
499 500 501 502 503 504 505 506 507 508 509 510
	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;

511 512
LINPHONE_PUBLIC const char *linphone_ice_state_to_string(LinphoneIceState state);

Yann Diorcet's avatar
Yann Diorcet committed
513 514 515 516 517 518 519 520 521 522 523 524
/**
 * 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
525
	LinphoneUpnpStateBlacklisted, /**< IGD router is blacklisted */
Yann Diorcet's avatar
Yann Diorcet committed
526 527 528 529 530 531 532 533
};

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

534

Ghislain MARY's avatar
Ghislain MARY committed
535 536
#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 */
537
#define LINPHONE_CALL_STATS_PERIODICAL_UPDATE (1 << 2) /**< Every seconds LinphoneCallStats object has been updated */
538 539


Simon Morlat's avatar
Simon Morlat committed
540 541 542
/**
 * The LinphoneCallStats objects carries various statistic informations regarding quality of audio or video streams.
 *
543
 * 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
544 545 546 547 548 549 550 551 552
 * 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.
 *
553
 * 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
554
 * it passes for instantiating the LinphoneCore object (see linphone_core_new() ).
Simon Morlat's avatar
Simon Morlat committed
555 556 557 558 559 560 561 562 563
 *
 * 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.*/
564
	LinphoneIceState	ice_state; /**< State of ICE processing. */
Yann Diorcet's avatar
Yann Diorcet committed
565
	LinphoneUpnpState	upnp_state; /**< State of uPnP processing. */
566 567
	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*/
568 569
	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
570
	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 */
571 572
	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*/
573
	rtp_stats_t rtp_stats; /**< RTP stats */
Simon Morlat's avatar
Simon Morlat committed
574 575 576 577 578
};

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

Sylvain Berfini's avatar
Sylvain Berfini committed
580 581
LINPHONE_PUBLIC const LinphoneCallStats *linphone_call_get_audio_stats(LinphoneCall *call);
LINPHONE_PUBLIC const LinphoneCallStats *linphone_call_get_video_stats(LinphoneCall *call);
582
LINPHONE_PUBLIC const LinphoneCallStats *linphone_call_get_text_stats(LinphoneCall *call);
583 584 585 586
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);
587
LINPHONE_PUBLIC rtp_stats_t linphone_call_stats_get_rtp_stats(const LinphoneCallStats *statss);
588
LINPHONE_PUBLIC uint64_t linphone_call_stats_get_late_packets_cumulative_number(const LinphoneCallStats *stats, LinphoneCall *call);
589 590 591 592
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
593

594
/** Callback prototype */
595
typedef void (*LinphoneCallCbFunc)(LinphoneCall *call,void * user_data);
596

597 598 599 600 601 602 603 604 605 606 607 608 609 610
/**
 * 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);

611 612 613 614 615 616 617 618 619
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);
620

621
/**
622
 * Create an independent media file player.
623
 * This player support WAVE and MATROSKA formats.
624
 * @param lc A LinphoneCore object
625 626
 * @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
627
 * @param window_id Id of the drawing window. Depend of video out
628 629
 * @return A pointer on the new instance. NULL if faild.
 */
Ghislain MARY's avatar
Ghislain MARY committed
630
LINPHONE_PUBLIC LinphonePlayer *linphone_core_create_local_player(LinphoneCore *lc, MSSndCard *snd_card, const char *video_out, void *window_id);
631

632
/**
633
 * Check whether Matroksa format is supported by the player
634 635
 * @return TRUE if it is supported
 */
636
LINPHONE_PUBLIC bool_t linphone_local_player_matroska_supported(void);
637

Simon Morlat's avatar
Simon Morlat committed
638 639 640 641 642
/**
 * 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
**/
643
typedef enum _LinphoneCallState{
Simon Morlat's avatar
Simon Morlat committed
644
	LinphoneCallIdle,					/**<Initial call state */
645 646 647 648 649 650 651 652 653 654 655 656 657 658
	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
659
	LinphoneCallUpdatedByRemote, /**<The call's parameters change is requested by remote end, used for example when video is added by remote */
660
	LinphoneCallIncomingEarlyMedia, /**<We are proposing early media to an incoming call */
661
	LinphoneCallUpdating, /**<A call update has been initiated by us */
662 663 664
	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)*/
665 666
} LinphoneCallState;

667
LINPHONE_PUBLIC	const char *linphone_call_state_to_string(LinphoneCallState cs);
668

669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703
/**
 * 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);

704 705 706 707 708 709
/**
 * 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
 */
710
LINPHONE_PUBLIC LinphoneCore *linphone_call_get_core(const LinphoneCall *call);
711

712
LINPHONE_PUBLIC	LinphoneCallState linphone_call_get_state(const LinphoneCall *call);
Ghislain MARY's avatar
Ghislain MARY committed
713
LINPHONE_PUBLIC bool_t linphone_call_asked_to_autoanswer(LinphoneCall *call);
714 715 716 717 718 719 720

/**
 * 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
721
LINPHONE_PUBLIC	const LinphoneAddress * linphone_core_get_current_call_remote_address(LinphoneCore *lc);
722

Sylvain Berfini's avatar
Sylvain Berfini committed
723 724 725
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);
726
LINPHONE_PUBLIC	LinphoneCallLog *linphone_call_get_call_log(const LinphoneCall *call);
727 728 729 730
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);
731
LINPHONE_PUBLIC	LinphoneCall *linphone_call_get_replaced_call(LinphoneCall *call);
Sylvain Berfini's avatar
Sylvain Berfini committed
732
LINPHONE_PUBLIC	int linphone_call_get_duration(const LinphoneCall *call);
733
LINPHONE_PUBLIC	const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call);
734
LINPHONE_PUBLIC	const LinphoneCallParams * linphone_call_get_remote_params(LinphoneCall *call);
Ghislain MARY's avatar
Ghislain MARY committed
735 736
LINPHONE_PUBLIC void linphone_call_enable_camera(LinphoneCall *lc, bool_t enabled);
LINPHONE_PUBLIC bool_t linphone_call_camera_enabled(const LinphoneCall *lc);
737
LINPHONE_PUBLIC int linphone_call_take_video_snapshot(LinphoneCall *call, const char *file);
738
LINPHONE_PUBLIC int linphone_call_take_preview_snapshot(LinphoneCall *call, const char *file);
739
LINPHONE_PUBLIC	LinphoneReason linphone_call_get_reason(const LinphoneCall *call);
740
LINPHONE_PUBLIC const LinphoneErrorInfo *linphone_call_get_error_info(const LinphoneCall *call);
741
LINPHONE_PUBLIC	const char *linphone_call_get_remote_user_agent(LinphoneCall *call);
Sylvain Berfini's avatar
Sylvain Berfini committed
742
LINPHONE_PUBLIC	const char *linphone_call_get_remote_contact(LinphoneCall *call);
743 744 745

/**
 * Get the mesured playback volume level.
746
 *
747 748 749
 * @param call The call.
 * @return float Volume level in percentage.
 */
750
LINPHONE_PUBLIC	float linphone_call_get_play_volume(LinphoneCall *call);
751 752 753

/**
 * Get the mesured record volume level
754
 *
755 756 757
 * @param call The call.
 * @return float Volume level in percentage.
 */
758
LINPHONE_PUBLIC	float linphone_call_get_record_volume(LinphoneCall *call);
759

760
/**
761 762
 * Create a new chat room for messaging from a call if not already existing, else return existing one.
 * No reference is given to the caller: the chat room will be deleted when the call is ended.
763 764 765 766 767 768
 * @param call #LinphoneCall object
 * @return #LinphoneChatRoom where messaging can take place.
 */
LINPHONE_PUBLIC	struct _LinphoneChatRoom * linphone_call_get_chat_room(LinphoneCall *call);


769

770
/**
771
 * Get speaker volume gain.
772 773
 * If the sound backend supports it, the returned gain is equal to the gain set
 * with the system mixer.
774
 *
775
 * @param call The call.
776
 * @return Percenatge of the max supported volume gain. Valid values are in [ 0.0 : 1.0 ].
777 778
 * In case of failure, a negative value is returned
 */
779
LINPHONE_PUBLIC float linphone_call_get_speaker_volume_gain(const LinphoneCall *call);
780 781

/**
782
 * Set speaker volume gain.
783
 * If the sound backend supports it, the new gain will synchronized with the system mixer.
784
 *
785
 * @param call The call.
786
 * @param volume Percentage of the max supported gain. Valid values are in [ 0.0 : 1.0 ].
787
 */
788
LINPHONE_PUBLIC void linphone_call_set_speaker_volume_gain(LinphoneCall *call, float volume);
789 790

/**
791
 * Get microphone volume gain.
792 793
 * If the sound backend supports it, the returned gain is equal to the gain set
 * with the system mixer.
794
 *
795
 * @param call The call.
796
 * @return double Percenatge of the max supported volume gain. Valid values are in [ 0.0 : 1.0 ].
797 798
 * In case of failure, a negative value is returned
 */
799
LINPHONE_PUBLIC float linphone_call_get_microphone_volume_gain(const LinphoneCall *call);
800 801

/**
802
 * Set microphone volume gain.
803
 * If the sound backend supports it, the new gain will synchronized with the system mixer.
804
 *
805
 * @param call The call.
806
 * @param volume Percentage of the max supported gain. Valid values are in [ 0.0 : 1.0 ].
807
 */
808
LINPHONE_PUBLIC void linphone_call_set_microphone_volume_gain(LinphoneCall *call, float volume);
809

810 811 812 813 814
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);
815
LINPHONE_PUBLIC void linphone_call_send_vfu_request(LinphoneCall *call);
816 817 818 819
/** @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)
820
LINPHONE_PUBLIC	void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, LinphoneCallCbFunc cb, void* user_data);
821 822
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);
823 824
LINPHONE_PUBLIC	void linphone_call_start_recording(LinphoneCall *call);
LINPHONE_PUBLIC	void linphone_call_stop_recording(LinphoneCall *call);
825
LINPHONE_PUBLIC LinphonePlayer * linphone_call_get_player(LinphoneCall *call);
Simon Morlat's avatar
Simon Morlat committed
826
LINPHONE_PUBLIC bool_t linphone_call_media_in_progress(LinphoneCall *call);
827 828 829 830 831 832
/**
 * 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...
833
 * @return 0 if successful, -1 on error.
834 835 836 837 838 839 840 841 842 843
**/
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'
844
 * @return -2 if there is already a DTMF sequence, -1 if call is not ready, 0 otherwise.
845 846 847 848 849 850 851 852 853 854 855 856 857
**/
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
858

859 860 861 862
/**
 * Get the native window handle of the video window, casted as an unsigned long.
 * @ingroup media_parameters
**/
Ghislain MARY's avatar
Ghislain MARY committed
863
LINPHONE_PUBLIC void * linphone_call_get_native_video_window_id(const LinphoneCall *call);
864 865 866 867 868 869

/**
 * 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
870
LINPHONE_PUBLIC void linphone_call_set_native_video_window_id(LinphoneCall *call, void * id);
871

jehan's avatar
jehan committed
872 873
/**
 * Return TRUE if this call is currently part of a conference
874 875
 * @param call #LinphoneCall
 * @return TRUE if part of a conference.
jehan's avatar
jehan committed
876
 *
877 878
 * @deprecated
 * @ingroup call_control
jehan's avatar
jehan committed
879
 */
880
LINPHONE_PUBLIC	bool_t linphone_call_is_in_conference(const LinphoneCall *call);
jehan's avatar
jehan committed
881 882 883 884 885 886 887
/**
 * Enables or disable echo cancellation for this call
 * @param call
 * @param val
 *
 * @ingroup media_parameters
**/
888
LINPHONE_PUBLIC	void linphone_call_enable_echo_cancellation(LinphoneCall *call, bool_t val) ;
jehan's avatar
jehan committed
889 890 891 892 893
/**
 * Returns TRUE if echo cancellation is enabled.
 *
 * @ingroup media_parameters
**/
894
LINPHONE_PUBLIC	bool_t linphone_call_echo_cancellation_enabled(LinphoneCall *lc);
jehan's avatar
jehan committed
895 896 897 898 899 900 901
/**
 * Enables or disable echo limiter for this call
 * @param call
 * @param val
 *
 * @ingroup media_parameters
**/
902
LINPHONE_PUBLIC	void linphone_call_enable_echo_limiter(LinphoneCall *call, bool_t val);
jehan's avatar
jehan committed
903 904 905 906 907
/**
 * Returns TRUE if echo limiter is enabled.
 *
 * @ingroup media_parameters
**/
908
LINPHONE_PUBLIC	bool_t linphone_call_echo_limiter_enabled(const LinphoneCall *call);
Simon Morlat's avatar
Simon Morlat committed
909

910 911
/**
 * Enum describing type of audio route.
912
 * @ingroup call_control
913 914 915 916 917 918 919 920
**/
enum _LinphoneAudioRoute {
	LinphoneAudioRouteEarpiece = MSAudioRouteEarpiece,
	LinphoneAudioRouteSpeaker = MSAudioRouteSpeaker
};

/**
 * Enum describing type of audio route.
921
 * @ingroup call_control
922 923 924
**/
typedef enum _LinphoneAudioRoute LinphoneAudioRoute;

925 926 927 928
/**
 * Change the playback output device (currently only used for blackberry)
 * @param call
 * @param route the wanted audio route (earpiece, speaker, ...)
929
 *
930 931
 * @ingroup call_control
**/
932 933 934 935 936 937
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
938
 *
939 940 941 942 943 944 945 946
 * @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
947
 *
948
 * @return the type (MSAudio, MSVideo, MSText) of the stream of given index.
949 950 951 952 953 954 955
**/
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
956
 *
957 958 959 960 961 962 963 964
 * @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
965
 *
966 967 968
 * @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);
969

Simon Morlat's avatar
Simon Morlat committed
970
/*keep this in sync with mediastreamer2/msvolume.h*/
Simon Morlat's avatar
Simon Morlat committed
971 972 973 974 975 976

/**
 * 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
977

smorlat's avatar
smorlat committed
978 979 980 981
/**
 * @addtogroup proxies
 * @{
**/
982

smorlat's avatar
smorlat committed
983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998
/**
 * 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
 * i