linphonecore.h 124 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
/**
 * The LinphoneContent struct holds data that can be embedded in a signaling message.
 * @ingroup misc
**/
struct _LinphoneContent{
	char *type; /**<mime type for the data, for example "application"*/
	char *subtype; /**<mime subtype for the data, for example "html"*/
136
	void *data; /**<the actual data buffer, usually a string. Null when provided by callbacks #LinphoneCoreFileTransferSendCb or #LinphoneCoreFileTransferRecvCb*/
jehan's avatar
jehan committed
137
	size_t size; /**<the size of the data buffer, excluding null character despite null character is always set for convenience.
138
				When provided by callback #LinphoneCoreFileTransferSendCb or #LinphoneCoreFileTransferRecvCb, it states the total number of bytes of the transfered file*/
139
	char *encoding; /**<The encoding of the data buffer, for example "gzip"*/
140
	char *name; /**< used by RCS File transfer messages to store the original filename of the file to be downloaded from server */
141 142 143 144 145 146 147 148
};

/**
 * Alias to the LinphoneContent struct.
 * @ingroup misc
**/
typedef struct _LinphoneContent LinphoneContent;

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

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

191 192
#define LinphoneReasonBadCredentials LinphoneReasonForbidden

193 194 195
/*for compatibility*/
#define LinphoneReasonMedia LinphoneReasonUnsupportedContent

196 197 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
**/
const char *linphone_reason_to_string(LinphoneReason err);

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

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

/**
 * 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
 */
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 282 283 284 285 286 287 288
/**
 * @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.
 */
LINPHONE_PUBLIC char * linphone_payload_type_get_mime_type(const LinphonePayloadType *pt);

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

289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308

/**
 * Enum describing type of media encryption types.
**/
enum _LinphoneMediaEncryption {
	LinphoneMediaEncryptionNone, /**< No media encryption is used */
	LinphoneMediaEncryptionSRTP, /**< Use SRTP media encryption */
	LinphoneMediaEncryptionZRTP /**< Use ZRTP media encryption */
};

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

309 310 311 312
/**
 * @}
**/

313

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

Simon Morlat's avatar
Simon Morlat committed
360
	/**
Simon Morlat's avatar
Simon Morlat committed
361
	 * 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
362 363
	 */
	LinphonePrivacyDefault=0x8000,
jehan's avatar
jehan committed
364
} LinphonePrivacy;
jehan's avatar
jehan committed
365 366 367 368 369
/*
 * a mask  of #LinphonePrivacy values
 * */
typedef unsigned int LinphonePrivacyMask;

Simon Morlat's avatar
Simon Morlat committed
370 371

LINPHONE_PUBLIC const char* linphone_privacy_to_string(LinphonePrivacy privacy);
Ghislain MARY's avatar
Ghislain MARY committed
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418


#ifdef IN_LINPHONE
#include "linphonefriend.h"
#include "event.h"
#include "call_log.h"
#include "call_params.h"
#else
#include "linphone/linphonefriend.h"
#include "linphone/event.h"
#include "linphone/call_log.h"
#include "linphone/call_params.h"
#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);
LINPHONE_PUBLIC bool_t linphone_address_is_secure(const LinphoneAddress *uri);
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);
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
419 420 421 422 423 424 425 426


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

427 428
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
429
LINPHONE_PUBLIC void linphone_info_message_add_header(LinphoneInfoMessage *im, const char *name, const char *value);
Simon Morlat's avatar
Simon Morlat committed
430
LINPHONE_PUBLIC const char *linphone_info_message_get_header(const LinphoneInfoMessage *im, const char *name);
Simon Morlat's avatar
Simon Morlat committed
431
LINPHONE_PUBLIC void linphone_info_message_set_content(LinphoneInfoMessage *im,  const LinphoneContent *content);
Simon Morlat's avatar
Simon Morlat committed
432
LINPHONE_PUBLIC const LinphoneContent * linphone_info_message_get_content(const LinphoneInfoMessage *im);
Simon Morlat's avatar
Simon Morlat committed
433
LINPHONE_PUBLIC void linphone_info_message_destroy(LinphoneInfoMessage *im);
434
LINPHONE_PUBLIC LinphoneInfoMessage *linphone_info_message_copy(const LinphoneInfoMessage *orig);
Simon Morlat's avatar
Simon Morlat committed
435

Simon Morlat's avatar
Simon Morlat committed
436 437


438 439
/**
 * Structure describing policy regarding video streams establishments.
Simon Morlat's avatar
Simon Morlat committed
440
 * @ingroup media_parameters
441 442
**/
struct _LinphoneVideoPolicy{
Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
443
	bool_t automatically_initiate; /**<Whether video shall be automatically proposed for outgoing calls.*/
444 445 446 447
	bool_t automatically_accept; /**<Whether video shall be automatically accepted for incoming calls*/
	bool_t unused[2];
};

Simon Morlat's avatar
Simon Morlat committed
448 449 450 451
/**
 * Structure describing policy regarding video streams establishments.
 * @ingroup media_parameters
**/
452 453
typedef struct _LinphoneVideoPolicy LinphoneVideoPolicy;

454

Yann Diorcet's avatar
Yann Diorcet committed
455 456


Simon Morlat's avatar
Simon Morlat committed
457 458 459 460 461
/**
 * @addtogroup call_misc
 * @{
**/

Yann Diorcet's avatar
Yann Diorcet committed
462 463 464
#define LINPHONE_CALL_STATS_AUDIO 0
#define LINPHONE_CALL_STATS_VIDEO 1

465 466 467 468 469 470
/**
 * Enum describing ICE states.
 * @ingroup initializing
**/
enum _LinphoneIceState{
	LinphoneIceStateNotActivated, /**< ICE has not been activated for this call */
Ghislain MARY's avatar
Ghislain MARY committed
471
	LinphoneIceStateFailed, /**< ICE processing has failed */
472 473 474 475 476 477 478 479 480 481 482 483
	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;

Yann Diorcet's avatar
Yann Diorcet committed
484 485 486 487 488 489 490 491 492 493 494 495
/**
 * 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
496
	LinphoneUpnpStateBlacklisted, /**< IGD router is blacklisted */
Yann Diorcet's avatar
Yann Diorcet committed
497 498 499 500 501 502 503 504
};

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

505

Ghislain MARY's avatar
Ghislain MARY committed
506 507
#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 */
508 509


Simon Morlat's avatar
Simon Morlat committed
510 511 512
/**
 * The LinphoneCallStats objects carries various statistic informations regarding quality of audio or video streams.
 *
513
 * 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
514 515 516 517 518 519 520 521 522
 * 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.
 *
523
 * 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
524 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().
**/
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.*/
534
	LinphoneIceState	ice_state; /**< State of ICE processing. */
Yann Diorcet's avatar
Yann Diorcet committed
535
	LinphoneUpnpState	upnp_state; /**< State of uPnP processing. */
536 537
	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*/
538 539
	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
540
	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 */
Simon Morlat's avatar
Simon Morlat committed
541 542 543 544 545
};

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

Sylvain Berfini's avatar
Sylvain Berfini committed
547 548
LINPHONE_PUBLIC const LinphoneCallStats *linphone_call_get_audio_stats(LinphoneCall *call);
LINPHONE_PUBLIC const LinphoneCallStats *linphone_call_get_video_stats(LinphoneCall *call);
549 550 551 552 553
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);
LINPHONE_PUBLIC uint64_t linphone_call_stats_get_late_packets_cumulative_number(const LinphoneCallStats *stats, LinphoneCall *call);
554 555 556 557
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
558

559
/** Callback prototype */
560
typedef void (*LinphoneCallCbFunc)(LinphoneCall *call,void * user_data);
561

562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582
/**
 * 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);

int linphone_player_open(LinphonePlayer *obj, const char *filename, LinphonePlayerEofCallback, void *user_data);
int linphone_player_start(LinphonePlayer *obj);
int linphone_player_pause(LinphonePlayer *obj);
int linphone_player_seek(LinphonePlayer *obj, int time_ms);
MSPlayerState linphone_player_get_state(LinphonePlayer *obj);
void linphone_player_close(LinphonePlayer *obj);

Simon Morlat's avatar
Simon Morlat committed
583 584 585 586 587
/**
 * 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
**/
588
typedef enum _LinphoneCallState{
Simon Morlat's avatar
Simon Morlat committed
589
	LinphoneCallIdle,					/**<Initial call state */
590 591 592 593 594 595 596 597 598 599 600 601 602 603
	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
604
	LinphoneCallUpdatedByRemote, /**<The call's parameters change is requested by remote end, used for example when video is added by remote */
605
	LinphoneCallIncomingEarlyMedia, /**<We are proposing early media to an incoming call */
606
	LinphoneCallUpdating, /**<A call update has been initiated by us */
607
	LinphoneCallReleased /**< The call object is no more retained by the core */
608 609
} LinphoneCallState;

610
LINPHONE_PUBLIC	const char *linphone_call_state_to_string(LinphoneCallState cs);
611

612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646
/**
 * 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);

647
LINPHONE_PUBLIC LinphoneCore *linphone_call_get_core(const LinphoneCall *call);
648
LINPHONE_PUBLIC	LinphoneCallState linphone_call_get_state(const LinphoneCall *call);
Ghislain MARY's avatar
Ghislain MARY committed
649
LINPHONE_PUBLIC bool_t linphone_call_asked_to_autoanswer(LinphoneCall *call);
650 651 652 653 654 655 656

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

Sylvain Berfini's avatar
Sylvain Berfini committed
659 660 661
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);
662
LINPHONE_PUBLIC	LinphoneCallLog *linphone_call_get_call_log(const LinphoneCall *call);
663 664 665 666
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);
667
LINPHONE_PUBLIC	LinphoneCall *linphone_call_get_replaced_call(LinphoneCall *call);
Sylvain Berfini's avatar
Sylvain Berfini committed
668
LINPHONE_PUBLIC	int linphone_call_get_duration(const LinphoneCall *call);
669
LINPHONE_PUBLIC	const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call);
670
LINPHONE_PUBLIC	const LinphoneCallParams * linphone_call_get_remote_params(LinphoneCall *call);
Ghislain MARY's avatar
Ghislain MARY committed
671 672
LINPHONE_PUBLIC void linphone_call_enable_camera(LinphoneCall *lc, bool_t enabled);
LINPHONE_PUBLIC bool_t linphone_call_camera_enabled(const LinphoneCall *lc);
673
LINPHONE_PUBLIC int linphone_call_take_video_snapshot(LinphoneCall *call, const char *file);
674
LINPHONE_PUBLIC int linphone_call_take_preview_snapshot(LinphoneCall *call, const char *file);
675
LINPHONE_PUBLIC	LinphoneReason linphone_call_get_reason(const LinphoneCall *call);
676
LINPHONE_PUBLIC const LinphoneErrorInfo *linphone_call_get_error_info(const LinphoneCall *call);
677
LINPHONE_PUBLIC	const char *linphone_call_get_remote_user_agent(LinphoneCall *call);
Sylvain Berfini's avatar
Sylvain Berfini committed
678
LINPHONE_PUBLIC	const char *linphone_call_get_remote_contact(LinphoneCall *call);
679 680 681 682 683 684 685
LINPHONE_PUBLIC	float linphone_call_get_play_volume(LinphoneCall *call);
LINPHONE_PUBLIC	float linphone_call_get_record_volume(LinphoneCall *call);
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);
686
LINPHONE_PUBLIC void linphone_call_send_vfu_request(LinphoneCall *call);
687 688 689 690
/** @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)
691
LINPHONE_PUBLIC	void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, LinphoneCallCbFunc cb, void* user_data);
692 693
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);
694 695
LINPHONE_PUBLIC	void linphone_call_start_recording(LinphoneCall *call);
LINPHONE_PUBLIC	void linphone_call_stop_recording(LinphoneCall *call);
696
LINPHONE_PUBLIC LinphonePlayer * linphone_call_get_player(LinphoneCall *call);
Sylvain Berfini's avatar
Sylvain Berfini committed
697

jehan's avatar
jehan committed
698 699
/**
 * Return TRUE if this call is currently part of a conference
700 701
 * @param call #LinphoneCall
 * @return TRUE if part of a conference.
jehan's avatar
jehan committed
702
 *
703 704
 * @deprecated
 * @ingroup call_control
jehan's avatar
jehan committed
705
 */
706
LINPHONE_PUBLIC	bool_t linphone_call_is_in_conference(const LinphoneCall *call);
jehan's avatar
jehan committed
707 708 709 710 711 712 713
/**
 * Enables or disable echo cancellation for this call
 * @param call
 * @param val
 *
 * @ingroup media_parameters
**/
714
LINPHONE_PUBLIC	void linphone_call_enable_echo_cancellation(LinphoneCall *call, bool_t val) ;
jehan's avatar
jehan committed
715 716 717 718 719
/**
 * Returns TRUE if echo cancellation is enabled.
 *
 * @ingroup media_parameters
**/
720
LINPHONE_PUBLIC	bool_t linphone_call_echo_cancellation_enabled(LinphoneCall *lc);
jehan's avatar
jehan committed
721 722 723 724 725 726 727
/**
 * Enables or disable echo limiter for this call
 * @param call
 * @param val
 *
 * @ingroup media_parameters
**/
728
LINPHONE_PUBLIC	void linphone_call_enable_echo_limiter(LinphoneCall *call, bool_t val);
jehan's avatar
jehan committed
729 730 731 732 733
/**
 * Returns TRUE if echo limiter is enabled.
 *
 * @ingroup media_parameters
**/
734
LINPHONE_PUBLIC	bool_t linphone_call_echo_limiter_enabled(const LinphoneCall *call);
Simon Morlat's avatar
Simon Morlat committed
735 736

/*keep this in sync with mediastreamer2/msvolume.h*/
Simon Morlat's avatar
Simon Morlat committed
737 738 739 740 741 742

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

smorlat's avatar
smorlat committed
744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763
/**
 * @addtogroup proxies
 * @{
**/
/**
 * The LinphoneProxyConfig object represents a proxy configuration to be used
 * by the LinphoneCore object.
 * Its fields must not be used directly in favour of the accessors methods.
 * Once created and filled properly the LinphoneProxyConfig can be given to
 * LinphoneCore with linphone_core_add_proxy_config().
 * This will automatically triggers the registration, if enabled.
 *
 * The proxy configuration are persistent to restarts because they are saved
 * in the configuration file. As a consequence, after linphone_core_new() there
 * might already be a list of configured proxy that can be examined with
 * linphone_core_get_proxy_config_list().
 *
 * The default proxy (see linphone_core_set_default_proxy() ) is the one of the list
 * that is used by default for calls.
**/
764
typedef struct _LinphoneProxyConfig LinphoneProxyConfig;
aymeric's avatar
aymeric committed
765

766 767 768 769
/**
 * LinphoneRegistrationState describes proxy registration states.
**/
typedef enum _LinphoneRegistrationState{
Simon Morlat's avatar
Simon Morlat committed
770 771 772 773 774
	LinphoneRegistrationNone, /**<Initial state for registrations */
	LinphoneRegistrationProgress, /**<Registration is in progress */
	LinphoneRegistrationOk,	/**< Registration is successful */
	LinphoneRegistrationCleared, /**< Unregistration succeeded */
	LinphoneRegistrationFailed	/**<Registration failed */
775 776
}LinphoneRegistrationState;

jehan's avatar
jehan committed
777 778 779 780
/**
 * Human readable version of the #LinphoneRegistrationState
 * @param cs sate
 */
781 782
LINPHONE_PUBLIC	const char *linphone_registration_state_to_string(LinphoneRegistrationState cs);
LINPHONE_PUBLIC	LinphoneProxyConfig *linphone_proxy_config_new(void);
783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810

/**
 * Acquire a reference to the proxy config.
 * @param[in] cfg The proxy config.
 * @return The same proxy config.
**/
LINPHONE_PUBLIC LinphoneProxyConfig *linphone_proxy_config_ref(LinphoneProxyConfig *cfg);

/**
 * Release reference to the proxy config.
 * @param[in] cfg The proxy config.
**/
LINPHONE_PUBLIC void linphone_proxy_config_unref(LinphoneProxyConfig *cfg);

/**
 * Retrieve the user pointer associated with the proxy config.
 * @param[in] cfg The proxy config.
 * @return The user pointer associated with the proxy config.
**/
LINPHONE_PUBLIC void *linphone_proxy_config_get_user_data(const LinphoneProxyConfig *cfg);

/**
 * Assign a user pointer to the proxy config.
 * @param[in] cfg The proxy config.
 * @param[in] ud The user pointer to associate with the proxy config.
**/
LINPHONE_PUBLIC void linphone_proxy_config_set_user_data(LinphoneProxyConfig *cfg, void *ud);

811 812 813
LINPHONE_PUBLIC	int linphone_proxy_config_set_server_addr(LinphoneProxyConfig *obj, const char *server_addr);
LINPHONE_PUBLIC	int linphone_proxy_config_set_identity(LinphoneProxyConfig *obj, const char *identity);
LINPHONE_PUBLIC	int linphone_proxy_config_set_route(LinphoneProxyConfig *obj, const char *route);
814
LINPHONE_PUBLIC	void linphone_proxy_config_set_expires(LinphoneProxyConfig *obj, int expires);
815

816
#define linphone_proxy_config_expires linphone_proxy_config_set_expires
jehan's avatar
jehan committed
817 818 819 820 821 822
/**
 * Indicates  either or not, REGISTRATION must be issued for this #LinphoneProxyConfig .
 * <br> In case this #LinphoneProxyConfig has been added to #LinphoneCore, follows the linphone_proxy_config_edit() rule.
 * @param obj object pointer
 * @param val if true, registration will be engaged
 */
823
LINPHONE_PUBLIC	void linphone_proxy_config_enable_register(LinphoneProxyConfig *obj, bool_t val);
aymeric's avatar
aymeric committed
824
#define linphone_proxy_config_enableregister linphone_proxy_config_enable_register
825 826
LINPHONE_PUBLIC	void linphone_proxy_config_edit(LinphoneProxyConfig *obj);
LINPHONE_PUBLIC	int linphone_proxy_config_done(LinphoneProxyConfig *obj);
jehan's avatar
jehan committed
827 828 829 830 831 832 833
/**
 * Indicates  either or not, PUBLISH must be issued for this #LinphoneProxyConfig .
 * <br> In case this #LinphoneProxyConfig has been added to #LinphoneCore, follows the linphone_proxy_config_edit() rule.
 * @param obj object pointer
 * @param val if true, publish will be engaged
 *
 */
834
LINPHONE_PUBLIC	void linphone_proxy_config_enable_publish(LinphoneProxyConfig *obj, bool_t val);
835 836 837
/**
 * Set the publish expiration time in second.
 * @param obj proxy config
838
 * @param expires in second
839 840 841 842 843 844 845 846 847 848 849
 * */

LINPHONE_PUBLIC	void linphone_proxy_config_set_publish_expires(LinphoneProxyConfig *obj, int expires);
/**
 * get the publish expiration time in second. Default value is the registration expiration value.
 * @param obj proxy config
 * @return expires in second
 * */

LINPHONE_PUBLIC	int linphone_proxy_config_get_publish_expires(const LinphoneProxyConfig *obj);

Sylvain Berfini's avatar
Sylvain Berfini committed
850 851
LINPHONE_PUBLIC	void linphone_proxy_config_set_dial_escape_plus(LinphoneProxyConfig *cfg, bool_t val);
LINPHONE_PUBLIC	void linphone_proxy_config_set_dial_prefix(LinphoneProxyConfig *cfg, const char *prefix);
852

853 854 855 856 857 858 859
 /**
 * Indicates whether quality statistics during call should be stored and sent to a collector according to RFC 6035.
 * @param[in] cfg #LinphoneProxyConfig object
 * @param[in] enable True to sotre quality statistics and sent them to the collector, false to disable it.
 */
LINPHONE_PUBLIC	void linphone_proxy_config_enable_quality_reporting(LinphoneProxyConfig *cfg, bool_t enable);

860
/**
861 862 863
 * Indicates whether quality statistics during call should be stored and sent to a collector according to RFC 6035.
 * @param[in] cfg #LinphoneProxyConfig object
 * @return True if quality repotring is enabled, false otherwise.
864
 */
865
LINPHONE_PUBLIC	bool_t linphone_proxy_config_quality_reporting_enabled(LinphoneProxyConfig *cfg);
866 867 868 869 870 871 872

 /**
 * Set the SIP address of the collector end-point when using quality reporting. This SIP address
 * should be used on server-side to process packets directly then discard packets. Collector address
 * should be a non existing account and should not received any packets.
 * @param[in] cfg #LinphoneProxyConfig object
 * @param[in] collector SIP address of the collector end-point.
873
 */
874
LINPHONE_PUBLIC	void linphone_proxy_config_set_quality_reporting_collector(LinphoneProxyConfig *cfg, const char *collector);
875 876 877 878 879 880 881 882 883 884 885 886 887

 /**
 * Get the SIP address of the collector end-point when using quality reporting. This SIP address
 * should be used on server-side to process packets directly then discard packets. Collector address
 * should be a non existing account and should not received any packets.
 * @param[in] cfg #LinphoneProxyConfig object
 * @return The SIP address of the collector end-point.
 */
LINPHONE_PUBLIC	const char *linphone_proxy_config_get_quality_reporting_collector(const LinphoneProxyConfig *cfg);

/**
 * Set the interval between 2 interval reports sending when using quality reporting. If call exceed interval size, an
 * interval report will be sent to the collector. On call termination, a session report will be sent
888
 * for the remaining period. Value must be 0 (disabled) or positive.
889
 * @param[in] cfg #LinphoneProxyConfig object
890
 * @param[in] interval The interval in seconds, 0 means interval reports are disabled.
891
 */
892
LINPHONE_PUBLIC void linphone_proxy_config_set_quality_reporting_interval(LinphoneProxyConfig *cfg, uint8_t interval);
893 894 895 896

/**
 * Get the interval between interval reports when using quality reporting.
 * @param[in] cfg #LinphoneProxyConfig object
897
 * @return The interval in seconds, 0 means interval reports are disabled.
898 899
 */

900
LINPHONE_PUBLIC int linphone_proxy_config_get_quality_reporting_interval(LinphoneProxyConfig *cfg);
901

Ghislain MARY's avatar
Ghislain MARY committed
902 903 904 905 906
/**
 * Get the registration state of the given proxy config.
 * @param[in] obj #LinphoneProxyConfig object.
 * @returns The registration state of the proxy config.
**/
Sylvain Berfini's avatar
Sylvain Berfini committed
907
LINPHONE_PUBLIC	LinphoneRegistrationState linphone_proxy_config_get_state(const LinphoneProxyConfig *obj);
Ghislain MARY's avatar
Ghislain MARY committed
908

909
LINPHONE_PUBLIC	bool_t linphone_proxy_config_is_registered(const LinphoneProxyConfig *obj);
Ghislain MARY's avatar
Ghislain MARY committed
910 911 912 913 914 915

/**
 * Get the domain name of the given proxy config.
 * @param[in] cfg #LinphoneProxyConfig object.
 * @returns The domain name of the proxy config.
**/
Sylvain Berfini's avatar
Sylvain Berfini committed
916
LINPHONE_PUBLIC	const char *linphone_proxy_config_get_domain(const LinphoneProxyConfig *cfg);
917

918 919 920 921 922 923 924 925 926 927 928 929 930 931
/**
 * Get the realm of the given proxy config.
 * @param[in] cfg #LinphoneProxyConfig object.
 * @returns The realm of the proxy config.
**/
LINPHONE_PUBLIC	const char *linphone_proxy_config_get_realm(const LinphoneProxyConfig *cfg);
/**
 * Set the realm of the given proxy config.
 * @param[in] cfg #LinphoneProxyConfig object.
 * @param[in] realm New realm value.
 * @returns The realm of the proxy config.
**/
LINPHONE_PUBLIC	void linphone_proxy_config_set_realm(LinphoneProxyConfig *cfg, const char * realm);

Sylvain Berfini's avatar
Sylvain Berfini committed
932
LINPHONE_PUBLIC	const char *linphone_proxy_config_get_route(const LinphoneProxyConfig *obj);
933
LINPHONE_PUBLIC	const char *linphone_proxy_config_get_identity(const LinphoneProxyConfig *obj);
934
LINPHONE_PUBLIC	bool_t linphone_proxy_config_publish_enabled(const LinphoneProxyConfig *obj);
935 936
LINPHONE_PUBLIC	const char *linphone_proxy_config_get_server_addr(const LinphoneProxyConfig *obj);
#define linphone_proxy_config_get_addr linphone_proxy_config_get_server_addr
937
LINPHONE_PUBLIC	int linphone_proxy_config_get_expires(const LinphoneProxyConfig *obj);
Sylvain Berfini's avatar
Sylvain Berfini committed
938
LINPHONE_PUBLIC	bool_t linphone_proxy_config_register_enabled(const LinphoneProxyConfig *obj);
939
LINPHONE_PUBLIC	void linphone_proxy_config_refresh_register(LinphoneProxyConfig *obj);
940
LINPHONE_PUBLIC void linphone_proxy_config_pause_register(LinphoneProxyConfig *obj);
941
LINPHONE_PUBLIC	const char *linphone_proxy_config_get_contact_parameters(const LinphoneProxyConfig *obj);
Sylvain Berfini's avatar
Sylvain Berfini committed
942
LINPHONE_PUBLIC	void linphone_proxy_config_set_contact_parameters(LinphoneProxyConfig *obj, const char *contact_params);
943 944
LINPHONE_PUBLIC void linphone_proxy_config_set_contact_uri_parameters(LinphoneProxyConfig *obj, const char *contact_uri_params);
LINPHONE_PUBLIC const char* linphone_proxy_config_get_contact_uri_parameters(const LinphoneProxyConfig *obj);
Ghislain MARY's avatar
Ghislain MARY committed
945 946 947 948 949 950

/**
 * Get the #LinphoneCore object to which is associated the #LinphoneProxyConfig.
 * @param[in] obj #LinphoneProxyConfig object.
 * @returns The #LinphoneCore object to which is associated the #LinphoneProxyConfig.
**/
Ghislain MARY's avatar
Ghislain MARY committed
951
LINPHONE_PUBLIC LinphoneCore * linphone_proxy_config_get_core(const LinphoneProxyConfig *obj);
952

953 954
LINPHONE_PUBLIC	bool_t linphone_proxy_config_get_dial_escape_plus(const LinphoneProxyConfig *cfg);
LINPHONE_PUBLIC	const char * linphone_proxy_config_get_dial_prefix(const LinphoneProxyConfig *cfg);
955

Ghislain MARY's avatar
Ghislain MARY committed
956 957 958 959 960
/**
 * Get the reason why registration failed when the proxy config state is LinphoneRegistrationFailed.
 * @param[in] cfg #LinphoneProxyConfig object.
 * @returns The reason why registration failed for this proxy config.
**/
Ghislain MARY's avatar
Ghislain MARY committed
961
LINPHONE_PUBLIC LinphoneReason linphone_proxy_config_get_error(const LinphoneProxyConfig *cfg);
Ghislain MARY's avatar
Ghislain MARY committed
962

963 964 965 966 967 968 969
/**
 * Get detailed information why registration failed when the proxy config state is LinphoneRegistrationFailed.
 * @param[in] cfg #LinphoneProxyConfig object.
 * @returns The details why registration failed for this proxy config.
**/
LINPHONE_PUBLIC const LinphoneErrorInfo *linphone_proxy_config_get_error_info(const LinphoneProxyConfig *cfg);

jehan's avatar
jehan committed
970 971 972 973 974 975 976
/*
 * return the transport from either : service route, route, or addr
 * @returns cfg object
 * @return transport as string (I.E udp, tcp, tls, dtls)*/

LINPHONE_PUBLIC const char* linphone_proxy_config_get_transport(const LinphoneProxyConfig *cfg);

Simon Morlat's avatar
Simon Morlat committed
977

aymeric's avatar
aymeric committed
978
/* destruction is called automatically when removing the proxy config */
Ghislain MARY's avatar
Ghislain MARY committed
979 980
LINPHONE_PUBLIC void linphone_proxy_config_destroy(LinphoneProxyConfig *cfg);
LINPHONE_PUBLIC void linphone_proxy_config_set_sip_setup(LinphoneProxyConfig *cfg, const char *type);
smorlat's avatar
smorlat committed
981
SipSetupContext *linphone_proxy_config_get_sip_setup_context(LinphoneProxyConfig *cfg);
Ghislain MARY's avatar
Ghislain MARY committed
982
LINPHONE_PUBLIC SipSetup *linphone_proxy_config_get_sip_setup(LinphoneProxyConfig *cfg);
983 984 985
/**
 * normalize a human readable phone number into a basic string. 888-444-222 becomes 888444222
 */
Sylvain Berfini's avatar
Sylvain Berfini committed
986
LINPHONE_PUBLIC	int linphone_proxy_config_normalize_number(LinphoneProxyConfig *proxy, const char *username, char *result, size_t result_len);
smorlat's avatar
smorlat committed
987

jehan's avatar
jehan committed
988
/**
Simon Morlat's avatar
Simon Morlat committed
989
 * Set default privacy policy for all calls routed through this proxy.
990
 * @param cfg #LinphoneProxyConfig object to be modified
991
 * @param privacy LinphonePrivacy to configure privacy
jehan's avatar
jehan committed
992
 * */
993
LINPHONE_PUBLIC void linphone_proxy_config_set_privacy(LinphoneProxyConfig *cfg, LinphonePrivacyMask privacy);
jehan's avatar
jehan committed
994
/**
Simon Morlat's avatar
Simon Morlat committed
995
 * Get default privacy policy for all calls routed through this proxy.
996
 * @param cfg #LinphoneProxyConfig object
jehan's avatar
jehan committed
997 998
 * @return Privacy mode
 * */
999
LINPHONE_PUBLIC LinphonePrivacyMask linphone_proxy_config_get_privacy(const LinphoneProxyConfig *cfg);
jehan's avatar
jehan committed
1000 1001
/**
 * Set the http file transfer server to be used for content type application/vnd.gsma.rcs-ft-http+xml
1002 1003
 * @param cfg #LinphoneProxyConfig object to be modified
 * @param server_url URL of the file server like https://file.linphone.org/upload.php
jehan's avatar
jehan committed
1004
 * */
1005
LINPHONE_PUBLIC void linphone_proxy_config_set_file_transfer_server(LinphoneProxyConfig *cfg, const char * server_url);
jehan's avatar
jehan committed
1006 1007
/**
 * Get the http file transfer server to be used for content type application/vnd.gsma.rcs-ft-http+xml
1008 1009
 * @param cfg #LinphoneProxyConfig object
 * @return URL of the file server like https://file.linphone.org/upload.php
jehan's avatar
jehan committed
1010
 * */
1011
LINPHONE_PUBLIC const char* linphone_proxy_config_get_file_transfer_server(const LinphoneProxyConfig *cfg);
jehan's avatar
jehan committed
1012

1013 1014 1015 1016 1017 1018 1019
/**
 * Indicates whether AVPF/SAVPF must be used for calls using this proxy config.
 * @param[in] cfg #LinphoneProxyConfig object
 * @param[in] enable True to enable AVPF/SAVF, false to disable it.
 */
LINPHONE_PUBLIC void linphone_proxy_config_enable_avpf(LinphoneProxyConfig *cfg, bool_t enable);

1020 1021 1022 1023 1024
/**
 * Indicates whether AVPF/SAVPF is being used for calls using this proxy config.
 * @param[in] cfg #LinphoneProxyConfig object
 * @return True if AVPF/SAVPF is enabled, false otherwise.
 */
Simon Morlat's avatar
Simon Morlat committed
1025
LINPHONE_PUBLIC bool_t linphone_proxy_config_avpf_enabled(LinphoneProxyConfig *cfg);
1026

1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040
/**
 * Set the interval between regular RTCP reports when using AVPF/SAVPF.
 * @param[in] cfg #LinphoneProxyConfig object
 * @param[in] interval The interval in seconds (between 0 and 5 seconds).
 */
LINPHONE_PUBLIC void linphone_proxy_config_set_avpf_rr_interval(LinphoneProxyConfig *cfg, uint8_t interval);

/**
 * Get the interval between regular RTCP reports when using AVPF/SAVPF.
 * @param[in] cfg #LinphoneProxyConfig object
 * @return The interval in seconds.
 */
LINPHONE_PUBLIC uint8_t linphone_proxy_config_get_avpf_rr_interval(const LinphoneProxyConfig *cfg);

smorlat's avatar
smorlat committed
1041 1042 1043 1044
/**
 * @}
**/

smorlat's avatar
smorlat committed
1045
typedef struct _LinphoneAccountCreator{
Simon Morlat's avatar
Simon Morlat committed
1046
	LinphoneCore *lc;
smorlat's avatar
smorlat committed
1047 1048 1049 1050
	struct _SipSetupContext *ssctx;
	char *username;
	char *password;
	char *domain;
Sylvain Berfini's avatar
Wizard  
Sylvain Berfini committed
1051 1052 1053
	char *route;
	char *email;
	int suscribe;
smorlat's avatar
smorlat committed
1054 1055 1056
	bool_t succeeded;
}LinphoneAccountCreator;

Simon Morlat's avatar
Simon Morlat committed
1057
LinphoneAccountCreator *linphone_account_creator_new(LinphoneCore *core, const char *type);
smorlat's avatar
smorlat committed
1058 1059 1060
void linphone_account_creator_set_username(LinphoneAccountCreator *obj, const char *username);
void linphone_account_creator_set_password(LinphoneAccountCreator *obj, const char *password);
void linphone_account_creator_set_domain(LinphoneAccountCreator *obj, const char *domain);
Sylvain Berfini's avatar
Wizard  
Sylvain Berfini committed
1061 1062 1063
void linphone_account_creator_set_route(LinphoneAccountCreator *obj, const char *route);
void linphone_account_creator_set_email(LinphoneAccountCreator *obj, const char *email);
void linphone_account_creator_set_suscribe(LinphoneAccountCreator *obj, int suscribre);
smorlat's avatar
smorlat committed
1064 1065
const char * linphone_account_creator_get_username(LinphoneAccountCreator *obj);
const char * linphone_account_creator_get_domain(LinphoneAccountCreator *obj);
1066
int linphone_account_creator_test_existence(LinphoneAccountCreator *obj);
Sylvain Berfini's avatar
Wizard  
Sylvain Berfini committed
1067
int linphone_account_creator_test_validation(LinphoneAccountCreator *obj);
smorlat's avatar
smorlat committed
1068 1069 1070
LinphoneProxyConfig * linphone_account_creator_validate(LinphoneAccountCreator *obj);
void linphone_account_creator_destroy(LinphoneAccountCreator *obj);

1071 1072
struct _LinphoneAuthInfo;

smorlat's avatar
smorlat committed
1073
/**
1074 1075
 * @addtogroup authentication
 * @{
smorlat's avatar
smorlat committed
1076 1077 1078 1079 1080 1081 1082 1083 1084 1085
 * Object holding authentication information.
 *
 * @note The object's fields should not be accessed directly. Prefer using
 * the accessor methods.
 *
 * In most case, authentication information consists of a username and password.
 * Sometimes, a userid is required by proxy, and realm can be useful to discriminate
 * different SIP domains.
 *
 * Once created and filled, a LinphoneAuthInfo must be added to the LinphoneCore in
1086
 * order to become known and used automatically when needed.
smorlat's avatar
smorlat committed
1087 1088 1089 1090 1091 1092
 * Use linphone_core_add_auth_info() for that purpose.
 *
 * The LinphoneCore object can take the initiative to request authentication information
 * when needed to the application through the auth_info_requested callback of the
 * LinphoneCoreVTable structure.
 *
1093 1094
 * The application can respond to this information request later using
 * linphone_core_add_auth_info(). This will unblock all pending authentication
smorlat's avatar
smorlat committed
1095 1096 1097
 * transactions and retry them with authentication headers.
 *
**/
1098
typedef struct _LinphoneAuthInfo LinphoneAuthInfo;
aymeric's avatar
aymeric committed
1099

1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113
/**
 * Creates a #LinphoneAuthInfo object with supplied information.
 * The object can be created empty, that is with all arguments set to NULL.
 * Username, userid, password, realm and domain can be set later using specific methods.
 * At the end, username and passwd (or ha1) are required.
 * @param username The username that needs to be authenticated
 * @param userid The userid used for authenticating (use NULL if you don't know what it is)
 * @param passwd The password in clear text
 * @param ha1 The ha1-encrypted password if password is not given in clear text.
 * @param realm The authentication domain (which can be larger than the sip domain. Unfortunately many SIP servers don't use this parameter.
 * @param domain The SIP domain for which this authentication information is valid, if it has to be restricted for a single SIP domain.
 * @return A #LinphoneAuthInfo object. linphone_auth_info_destroy() must be used to destroy it when no longer needed. The LinphoneCore makes a copy of LinphoneAuthInfo
 * passed through linphone_core_add_auth_info().
**/
Sylvain Berfini's avatar