linphonecore.h 99.4 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 28

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

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

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

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

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

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

54

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

92

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

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

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

127 128
typedef struct belle_sip_dict LinphoneDictionary;

129 130 131 132 133 134 135 136 137
/**
 * 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"*/
	void *data; /**<the actual data buffer, usually a string */
	size_t size; /**<the size of the data buffer, excluding null character despite null character is always set for convenience.*/
138
	char *encoding; /**<The encoding of the data buffer, for example "gzip"*/
139 140 141 142 143 144 145 146
};

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

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

158
/**
159 160 161
 * Enum describing various failure reasons or contextual information for some events.
 * @see linphone_call_get_reason()
 * @see linphone_proxy_config_get_error()
162 163 164 165 166
 * @ingroup misc
**/
enum _LinphoneReason{
	LinphoneReasonNone,
	LinphoneReasonNoResponse, /**<No response received from remote*/
jehan's avatar
jehan committed
167
	LinphoneReasonBadCredentials, /**<Authentication failed due to bad*/
168 169 170 171
	LinphoneReasonDeclined, /**<The call has been declined*/
	LinphoneReasonNotFound, /**<Destination of the calls was not found.*/
	LinphoneReasonNotAnswered, /**<The call was not answered in time*/
	LinphoneReasonBusy, /**<Phone line was busy */
172
	LinphoneReasonUnsupportedContent, /**<Unsupported content */
jehan's avatar
jehan committed
173
	LinphoneReasonIOError, /**<Transport error: connection failures, disconnections etc...*/
jehan's avatar
jehan committed
174
	LinphoneReasonDoNotDisturb, /**<Do not disturb reason*/
175
	LinphoneReasonUnauthorized, /**<Operation is unauthorized because missing credential*/
176 177
	LinphoneReasonNotAcceptable, /**<Operation like call update rejected by peer*/
	LinphoneReasonNoMatch /**<Operation could not be executed by server or remote client because it didn't have any context for it*/
178 179
};

180 181 182
/*for compatibility*/
#define LinphoneReasonMedia LinphoneReasonUnsupportedContent

183 184 185 186 187 188 189 190 191 192 193 194
/**
 * 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);

195 196 197 198 199 200 201 202 203 204 205 206 207 208

/* linphone dictionary */
LINPHONE_PUBLIC	LinphoneDictionary* linphone_dictionary_new();
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);
209
LINPHONE_PUBLIC int linphone_dictionary_haskey(const LinphoneDictionary* obj, const char* key);
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225
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);


jehan's avatar
jehan committed
226 227
#ifdef IN_LINPHONE
#include "linphonefriend.h"
228
#include "event.h"
jehan's avatar
jehan committed
229 230
#else
#include "linphone/linphonefriend.h"
231
#include "linphone/event.h"
jehan's avatar
jehan committed
232
#endif
233

234
LINPHONE_PUBLIC	LinphoneAddress * linphone_address_new(const char *addr);
Ghislain MARY's avatar
Ghislain MARY committed
235 236 237 238
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);
239 240 241
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);
242
LINPHONE_PUBLIC int linphone_address_get_port(const LinphoneAddress *u);
243 244 245
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);
246
LINPHONE_PUBLIC	void linphone_address_set_port(LinphoneAddress *uri, int port);
247
/*remove tags, params etc... so that it is displayable to the user*/
248
LINPHONE_PUBLIC	void linphone_address_clean(LinphoneAddress *uri);
249 250 251
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);
252
LINPHONE_PUBLIC	char *linphone_address_as_string(const LinphoneAddress *u);
Sylvain Berfini's avatar
Sylvain Berfini committed
253
LINPHONE_PUBLIC	char *linphone_address_as_string_uri_only(const LinphoneAddress *u);
254 255
LINPHONE_PUBLIC	bool_t linphone_address_weak_equal(const LinphoneAddress *a1, const LinphoneAddress *a2);
LINPHONE_PUBLIC	void linphone_address_destroy(LinphoneAddress *u);
aymeric's avatar
aymeric committed
256

257 258 259 260 261 262 263 264 265
/**
 * 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);

smorlat's avatar
smorlat committed
266
struct _SipSetupContext;
267

aymeric's avatar
aymeric committed
268

smorlat's avatar
smorlat committed
269 270 271 272 273 274 275 276
/**
 * Enum representing the direction of a call.
 * @ingroup call_logs
**/
enum _LinphoneCallDir {
	LinphoneCallOutgoing, /**< outgoing calls*/
	LinphoneCallIncoming  /**< incoming calls*/
};
aymeric's avatar
aymeric committed
277

smorlat's avatar
smorlat committed
278 279 280 281 282
/**
 * Typedef for enum
 * @ingroup call_logs
**/
typedef enum _LinphoneCallDir LinphoneCallDir;
aymeric's avatar
aymeric committed
283

smorlat's avatar
smorlat committed
284 285 286 287
/**
 * Enum representing the status of a call
 * @ingroup call_logs
**/
288
typedef enum _LinphoneCallStatus {
smorlat's avatar
smorlat committed
289 290
	LinphoneCallSuccess, /**< The call was sucessful*/
	LinphoneCallAborted, /**< The call was aborted */
291 292
	LinphoneCallMissed, /**< The call was missed (unanswered)*/
	LinphoneCallDeclined /**< The call was declined, either locally or by remote end*/
aymeric's avatar
aymeric committed
293 294
} LinphoneCallStatus;

smorlat's avatar
smorlat committed
295 296 297 298
/**
 * Structure representing a call log.
 *
 * @ingroup call_logs
299
 *
smorlat's avatar
smorlat committed
300
**/
301
typedef struct _LinphoneCallLog LinphoneCallLog;
Simon Morlat's avatar
Simon Morlat committed
302 303 304

/**
 * Enum describing type of media encryption types.
305
 * @ingroup media_parameters
Simon Morlat's avatar
Simon Morlat committed
306
**/
307 308 309 310
enum _LinphoneMediaEncryption {
	LinphoneMediaEncryptionNone, /**< No media encryption is used */
	LinphoneMediaEncryptionSRTP, /**< Use SRTP media encryption */
	LinphoneMediaEncryptionZRTP /**< Use ZRTP media encryption */
311
};
smorlat's avatar
smorlat committed
312

Simon Morlat's avatar
Simon Morlat committed
313 314
/**
 * Enum describing type of media encryption types.
315
 * @ingroup media_parameters
Simon Morlat's avatar
Simon Morlat committed
316
**/
317
typedef enum _LinphoneMediaEncryption LinphoneMediaEncryption;
aymeric's avatar
aymeric committed
318

Simon Morlat's avatar
Simon Morlat committed
319 320 321 322 323 324
/**
 * Convert enum member to string.
 * @ingroup media_parameters
**/
LINPHONE_PUBLIC const char *linphone_media_encryption_to_string(LinphoneMediaEncryption menc);

aymeric's avatar
aymeric committed
325
/*public: */
Sylvain Berfini's avatar
Sylvain Berfini committed
326 327 328 329 330
LINPHONE_PUBLIC	LinphoneAddress *linphone_call_log_get_from(LinphoneCallLog *cl);
LINPHONE_PUBLIC	LinphoneAddress *linphone_call_log_get_to(LinphoneCallLog *cl);
LINPHONE_PUBLIC	LinphoneAddress *linphone_call_log_get_remote_address(LinphoneCallLog *cl);
LINPHONE_PUBLIC	LinphoneCallDir linphone_call_log_get_dir(LinphoneCallLog *cl);
LINPHONE_PUBLIC	LinphoneCallStatus linphone_call_log_get_status(LinphoneCallLog *cl);
331
LINPHONE_PUBLIC	bool_t linphone_call_log_video_enabled(LinphoneCallLog *cl);
Sylvain Berfini's avatar
Sylvain Berfini committed
332 333 334 335 336
LINPHONE_PUBLIC	time_t linphone_call_log_get_start_date(LinphoneCallLog *cl);
LINPHONE_PUBLIC	int linphone_call_log_get_duration(LinphoneCallLog *cl);
LINPHONE_PUBLIC	float linphone_call_log_get_quality(LinphoneCallLog *cl);
LINPHONE_PUBLIC	void linphone_call_log_set_user_pointer(LinphoneCallLog *cl, void *up);
LINPHONE_PUBLIC	void *linphone_call_log_get_user_pointer(const LinphoneCallLog *cl);
337 338
void linphone_call_log_set_ref_key(LinphoneCallLog *cl, const char *refkey);
const char *linphone_call_log_get_ref_key(const LinphoneCallLog *cl);
339 340
LINPHONE_PUBLIC	const rtp_stats_t *linphone_call_log_get_local_stats(const LinphoneCallLog *cl);
LINPHONE_PUBLIC	const rtp_stats_t *linphone_call_log_get_remote_stats(const LinphoneCallLog *cl);
Sylvain Berfini's avatar
Sylvain Berfini committed
341 342
LINPHONE_PUBLIC	const char *linphone_call_log_get_call_id(const LinphoneCallLog *cl);
LINPHONE_PUBLIC	char * linphone_call_log_to_str(LinphoneCallLog *cl);
aymeric's avatar
aymeric committed
343

344 345 346 347
/**
 * Private structure definition for LinphoneCallParams.
 * @ingroup call_control
**/
Simon Morlat's avatar
Simon Morlat committed
348
struct _LinphoneCallParams;
349

350
/**
Guillaume Beraudo's avatar
Typo  
Guillaume Beraudo committed
351
 * The LinphoneCallParams is an object containing various call related parameters.
352
 * It can be used to retrieve parameters from a currently running call or modify the call's characteristics
353
 * dynamically.
354
 * @ingroup call_control
355 356 357
**/
typedef struct _LinphoneCallParams LinphoneCallParams;

358 359
LINPHONE_PUBLIC	const PayloadType* linphone_call_params_get_used_audio_codec(const LinphoneCallParams *cp);
LINPHONE_PUBLIC	const PayloadType* linphone_call_params_get_used_video_codec(const LinphoneCallParams *cp);
360 361 362
LINPHONE_PUBLIC	LinphoneCallParams * linphone_call_params_copy(const LinphoneCallParams *cp);
LINPHONE_PUBLIC	void linphone_call_params_enable_video(LinphoneCallParams *cp, bool_t enabled);
LINPHONE_PUBLIC	bool_t linphone_call_params_video_enabled(const LinphoneCallParams *cp);
363 364 365 366 367 368 369 370 371 372 373
LINPHONE_PUBLIC	LinphoneMediaEncryption linphone_call_params_get_media_encryption(const LinphoneCallParams *cp);
LINPHONE_PUBLIC	void linphone_call_params_set_media_encryption(LinphoneCallParams *cp, LinphoneMediaEncryption e);
LINPHONE_PUBLIC	void linphone_call_params_enable_early_media_sending(LinphoneCallParams *cp, bool_t enabled);
LINPHONE_PUBLIC	bool_t linphone_call_params_early_media_sending_enabled(const LinphoneCallParams *cp);
LINPHONE_PUBLIC	bool_t linphone_call_params_local_conference_mode(const LinphoneCallParams *cp);
LINPHONE_PUBLIC	void linphone_call_params_set_audio_bandwidth_limit(LinphoneCallParams *cp, int bw);
LINPHONE_PUBLIC	void linphone_call_params_destroy(LinphoneCallParams *cp);
LINPHONE_PUBLIC	bool_t linphone_call_params_low_bandwidth_enabled(const LinphoneCallParams *cp);
LINPHONE_PUBLIC	void linphone_call_params_enable_low_bandwidth(LinphoneCallParams *cp, bool_t enabled);
LINPHONE_PUBLIC	void linphone_call_params_set_record_file(LinphoneCallParams *cp, const char *path);
LINPHONE_PUBLIC	const char *linphone_call_params_get_record_file(const LinphoneCallParams *cp);
Ghislain MARY's avatar
Ghislain MARY committed
374 375 376 377 378 379 380 381

/**
 * Add a custom SIP header in the INVITE for a call.
 * @param[in] params The #LinphoneCallParams to add a custom SIP header to.
 * @param[in] header_name The name of the header to add.
 * @param[in] header_value The content of the header to add.
 * @ingroup call_control
**/
382
LINPHONE_PUBLIC	void linphone_call_params_add_custom_header(LinphoneCallParams *params, const char *header_name, const char *header_value);
Ghislain MARY's avatar
Ghislain MARY committed
383 384 385 386 387 388 389 390

/**
 * Get a custom SIP header.
 * @param[in] params The #LinphoneCallParams to get the custom SIP header from.
 * @param[in] header_name The name of the header to get.
 * @returns The content of the header or NULL if not found.
 * @ingroup call_control
**/
391
LINPHONE_PUBLIC	const char *linphone_call_params_get_custom_header(const LinphoneCallParams *params, const char *header_name);
Simon Morlat's avatar
Simon Morlat committed
392

393 394 395 396 397 398 399 400 401 402 403 404 405 406 407
/**
 * Gets the size of the video that is sent.
 * @param[in] cp The call parameters for which to get the sent video size.
 * @return The sent video size or MS_VIDEO_SIZE_UNKNOWN if not available.
 */
LINPHONE_PUBLIC MSVideoSize linphone_call_params_get_sent_video_size(const LinphoneCallParams *cp);

/**
 * Gets the size of the video that is received.
 * @param[in] cp The call paramaters for which to get the received video size.
 * @return The received video size or MS_VIDEO_SIZE_UNKNOWN if not available.
 */
LINPHONE_PUBLIC MSVideoSize linphone_call_params_get_received_video_size(const LinphoneCallParams *cp);


Simon Morlat's avatar
Simon Morlat committed
408 409 410
/*
 * Note for developers: this enum must be kept synchronized with the SalPrivacy enum declared in sal.h
 */
Simon Morlat's avatar
Simon Morlat committed
411
/**
jehan's avatar
jehan committed
412
 * @ingroup call_control
jehan's avatar
jehan committed
413
 * Defines privacy policy to apply as described by rfc3323
Simon Morlat's avatar
Simon Morlat committed
414
**/
jehan's avatar
jehan committed
415 416
typedef enum _LinphonePrivacy {
	/**
Simon Morlat's avatar
Simon Morlat committed
417
	 * Privacy services must not perform any privacy function
jehan's avatar
jehan committed
418
	 */
Simon Morlat's avatar
Simon Morlat committed
419
	LinphonePrivacyNone=0x0,
jehan's avatar
jehan committed
420
	/**
jehan's avatar
jehan committed
421
	 * Request that privacy services provide a user-level privacy
Simon Morlat's avatar
Simon Morlat committed
422 423
	 * function.
	 * With this mode, "from" header is hidden, usually replaced by  From: "Anonymous" <sip:anonymous@anonymous.invalid>
jehan's avatar
jehan committed
424
	 */
jehan's avatar
jehan committed
425
	LinphonePrivacyUser=0x1,
jehan's avatar
jehan committed
426
	/**
jehan's avatar
jehan committed
427
	 * Request that privacy services modify headers that cannot
Simon Morlat's avatar
Simon Morlat committed
428
	 * be set arbitrarily by the user (Contact/Via).
jehan's avatar
jehan committed
429
	 */
jehan's avatar
jehan committed
430
	LinphonePrivacyHeader=0x2,
Simon Morlat's avatar
Simon Morlat committed
431
	/**
jehan's avatar
jehan committed
432
	 *  Request that privacy services provide privacy for session
Simon Morlat's avatar
Simon Morlat committed
433 434
	 * media
	 */
jehan's avatar
jehan committed
435 436 437 438
	LinphonePrivacySession=0x4,
	/**
	 * rfc3325
	 * The presence of this privacy type in
Simon Morlat's avatar
Simon Morlat committed
439 440 441 442 443
	 * 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
444 445 446 447 448
	 *
	 */
	LinphonePrivacyId=0x8,
	/**
	 * Privacy service must perform the specified services or
Simon Morlat's avatar
Simon Morlat committed
449
	 * fail the request
jehan's avatar
jehan committed
450 451
	 *
	 **/
Simon Morlat's avatar
Simon Morlat committed
452
	LinphonePrivacyCritical=0x10,
Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
453

Simon Morlat's avatar
Simon Morlat committed
454
	/**
Simon Morlat's avatar
Simon Morlat committed
455
	 * 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
456 457
	 */
	LinphonePrivacyDefault=0x8000,
jehan's avatar
jehan committed
458
} LinphonePrivacy;
jehan's avatar
jehan committed
459 460 461 462 463
/*
 * a mask  of #LinphonePrivacy values
 * */
typedef unsigned int LinphonePrivacyMask;

Simon Morlat's avatar
Simon Morlat committed
464 465

LINPHONE_PUBLIC const char* linphone_privacy_to_string(LinphonePrivacy privacy);
Simon Morlat's avatar
Simon Morlat committed
466
LINPHONE_PUBLIC void linphone_call_params_set_privacy(LinphoneCallParams *params, LinphonePrivacyMask privacy);
jehan's avatar
jehan committed
467
LINPHONE_PUBLIC LinphonePrivacyMask linphone_call_params_get_privacy(const LinphoneCallParams *params);
Simon Morlat's avatar
Simon Morlat committed
468 469 470 471 472 473 474 475


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

476 477
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
478
LINPHONE_PUBLIC void linphone_info_message_add_header(LinphoneInfoMessage *im, const char *name, const char *value);
Simon Morlat's avatar
Simon Morlat committed
479
LINPHONE_PUBLIC const char *linphone_info_message_get_header(const LinphoneInfoMessage *im, const char *name);
Simon Morlat's avatar
Simon Morlat committed
480
LINPHONE_PUBLIC void linphone_info_message_set_content(LinphoneInfoMessage *im,  const LinphoneContent *content);
Simon Morlat's avatar
Simon Morlat committed
481
LINPHONE_PUBLIC const LinphoneContent * linphone_info_message_get_content(const LinphoneInfoMessage *im);
482
LINPHONE_PUBLIC const char *linphone_info_message_get_from(const LinphoneInfoMessage *im);
Simon Morlat's avatar
Simon Morlat committed
483
LINPHONE_PUBLIC void linphone_info_message_destroy(LinphoneInfoMessage *im);
484
LINPHONE_PUBLIC LinphoneInfoMessage *linphone_info_message_copy(const LinphoneInfoMessage *orig);
Simon Morlat's avatar
Simon Morlat committed
485

Simon Morlat's avatar
Simon Morlat committed
486 487


488 489
/**
 * Structure describing policy regarding video streams establishments.
Simon Morlat's avatar
Simon Morlat committed
490
 * @ingroup media_parameters
491 492
**/
struct _LinphoneVideoPolicy{
Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
493
	bool_t automatically_initiate; /**<Whether video shall be automatically proposed for outgoing calls.*/
494 495 496 497
	bool_t automatically_accept; /**<Whether video shall be automatically accepted for incoming calls*/
	bool_t unused[2];
};

Simon Morlat's avatar
Simon Morlat committed
498 499 500 501
/**
 * Structure describing policy regarding video streams establishments.
 * @ingroup media_parameters
**/
502 503
typedef struct _LinphoneVideoPolicy LinphoneVideoPolicy;

504

Yann Diorcet's avatar
Yann Diorcet committed
505 506


Simon Morlat's avatar
Simon Morlat committed
507 508 509 510 511
/**
 * @addtogroup call_misc
 * @{
**/

Yann Diorcet's avatar
Yann Diorcet committed
512 513 514
#define LINPHONE_CALL_STATS_AUDIO 0
#define LINPHONE_CALL_STATS_VIDEO 1

515 516 517 518 519 520
/**
 * Enum describing ICE states.
 * @ingroup initializing
**/
enum _LinphoneIceState{
	LinphoneIceStateNotActivated, /**< ICE has not been activated for this call */
Ghislain MARY's avatar
Ghislain MARY committed
521
	LinphoneIceStateFailed, /**< ICE processing has failed */
522 523 524 525 526 527 528 529 530 531 532 533
	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
534 535 536 537 538 539 540 541 542 543 544 545
/**
 * 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
546
	LinphoneUpnpStateBlacklisted, /**< IGD router is blacklisted */
Yann Diorcet's avatar
Yann Diorcet committed
547 548 549 550 551 552 553 554 555
};

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


Simon Morlat's avatar
Simon Morlat committed
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579
/**
 * The LinphoneCallStats objects carries various statistic informations regarding quality of audio or video streams.
 *
 * To receive these informations periodically and as soon as they are computed, the application is invited to place a #CallStatsUpdated callback in the LinphoneCoreVTable structure
 * 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.
 *
 * To receive these informations periodically and as soon as they are computed, the application is invited to place a #CallStatsUpdated callback in the LinphoneCoreVTable structure
 * 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.*/
580
	LinphoneIceState	ice_state; /**< State of ICE processing. */
Yann Diorcet's avatar
Yann Diorcet committed
581
	LinphoneUpnpState	upnp_state; /**< State of uPnP processing. */
582 583
	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*/
584 585
	float local_late_rate; /**<percentage of packet received too late over last second*/
	float local_loss_rate; /**<percentage of lost packet over last second*/
Simon Morlat's avatar
Simon Morlat committed
586 587 588 589 590
};

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

Sylvain Berfini's avatar
Sylvain Berfini committed
592 593
LINPHONE_PUBLIC const LinphoneCallStats *linphone_call_get_audio_stats(LinphoneCall *call);
LINPHONE_PUBLIC const LinphoneCallStats *linphone_call_get_video_stats(LinphoneCall *call);
594 595 596 597 598
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);
Yann Diorcet's avatar
Yann Diorcet committed
599

600
/** Callback prototype */
601
typedef void (*LinphoneCallCbFunc)(LinphoneCall *call,void * user_data);
602

Simon Morlat's avatar
Simon Morlat committed
603 604 605 606 607
/**
 * 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
**/
608
typedef enum _LinphoneCallState{
Simon Morlat's avatar
Simon Morlat committed
609
	LinphoneCallIdle,					/**<Initial call state */
610 611 612 613 614 615 616 617 618 619 620 621 622 623
	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
624
	LinphoneCallUpdatedByRemote, /**<The call's parameters change is requested by remote end, used for example when video is added by remote */
625
	LinphoneCallIncomingEarlyMedia, /**<We are proposing early media to an incoming call */
626
	LinphoneCallUpdating, /**<A call update has been initiated by us */
627
	LinphoneCallReleased /**< The call object is no more retained by the core */
628 629
} LinphoneCallState;

630
LINPHONE_PUBLIC	const char *linphone_call_state_to_string(LinphoneCallState cs);
631

632
LINPHONE_PUBLIC LinphoneCore *linphone_call_get_core(const LinphoneCall *call);
633
LINPHONE_PUBLIC	LinphoneCallState linphone_call_get_state(const LinphoneCall *call);
Ghislain MARY's avatar
Ghislain MARY committed
634
LINPHONE_PUBLIC bool_t linphone_call_asked_to_autoanswer(LinphoneCall *call);
Simon Morlat's avatar
Simon Morlat committed
635
LINPHONE_PUBLIC	const LinphoneAddress * linphone_core_get_current_call_remote_address(LinphoneCore *lc);
Sylvain Berfini's avatar
Sylvain Berfini committed
636 637 638
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);
639 640 641
LINPHONE_PUBLIC	LinphoneCall * linphone_call_ref(LinphoneCall *call);
LINPHONE_PUBLIC	void linphone_call_unref(LinphoneCall *call);
LINPHONE_PUBLIC	LinphoneCallLog *linphone_call_get_call_log(const LinphoneCall *call);
642 643 644 645
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);
646
LINPHONE_PUBLIC	LinphoneCall *linphone_call_get_replaced_call(LinphoneCall *call);
Sylvain Berfini's avatar
Sylvain Berfini committed
647
LINPHONE_PUBLIC	int linphone_call_get_duration(const LinphoneCall *call);
648
LINPHONE_PUBLIC	const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call);
649
LINPHONE_PUBLIC	const LinphoneCallParams * linphone_call_get_remote_params(LinphoneCall *call);
Ghislain MARY's avatar
Ghislain MARY committed
650 651
LINPHONE_PUBLIC void linphone_call_enable_camera(LinphoneCall *lc, bool_t enabled);
LINPHONE_PUBLIC bool_t linphone_call_camera_enabled(const LinphoneCall *lc);
652
LINPHONE_PUBLIC int linphone_call_take_video_snapshot(LinphoneCall *call, const char *file);
653
LINPHONE_PUBLIC	LinphoneReason linphone_call_get_reason(const LinphoneCall *call);
654
LINPHONE_PUBLIC	const char *linphone_call_get_remote_user_agent(LinphoneCall *call);
Sylvain Berfini's avatar
Sylvain Berfini committed
655
LINPHONE_PUBLIC	const char *linphone_call_get_remote_contact(LinphoneCall *call);
656 657 658 659 660 661 662
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);
663 664
LINPHONE_PUBLIC void linphone_call_send_vfu_request(LinphoneCall *call);
LINPHONE_PUBLIC void *linphone_call_get_user_pointer(LinphoneCall *call);
Sylvain Berfini's avatar
Sylvain Berfini committed
665
LINPHONE_PUBLIC	void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer);
666
LINPHONE_PUBLIC	void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, LinphoneCallCbFunc cb, void* user_data);
667 668
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);
669 670
LINPHONE_PUBLIC	void linphone_call_start_recording(LinphoneCall *call);
LINPHONE_PUBLIC	void linphone_call_stop_recording(LinphoneCall *call);
Sylvain Berfini's avatar
Sylvain Berfini committed
671

jehan's avatar
jehan committed
672 673
/**
 * Return TRUE if this call is currently part of a conference
674 675
 * @param call #LinphoneCall
 * @return TRUE if part of a conference.
jehan's avatar
jehan committed
676
 *
677 678
 * @deprecated
 * @ingroup call_control
jehan's avatar
jehan committed
679
 */
680
LINPHONE_PUBLIC	bool_t linphone_call_is_in_conference(const LinphoneCall *call);
jehan's avatar
jehan committed
681 682 683 684 685 686 687
/**
 * Enables or disable echo cancellation for this call
 * @param call
 * @param val
 *
 * @ingroup media_parameters
**/
688
LINPHONE_PUBLIC	void linphone_call_enable_echo_cancellation(LinphoneCall *call, bool_t val) ;
jehan's avatar
jehan committed
689 690 691 692 693
/**
 * Returns TRUE if echo cancellation is enabled.
 *
 * @ingroup media_parameters
**/
694
LINPHONE_PUBLIC	bool_t linphone_call_echo_cancellation_enabled(LinphoneCall *lc);
jehan's avatar
jehan committed
695 696 697 698 699 700 701
/**
 * Enables or disable echo limiter for this call
 * @param call
 * @param val
 *
 * @ingroup media_parameters
**/
702
LINPHONE_PUBLIC	void linphone_call_enable_echo_limiter(LinphoneCall *call, bool_t val);
jehan's avatar
jehan committed
703 704 705 706 707
/**
 * Returns TRUE if echo limiter is enabled.
 *
 * @ingroup media_parameters
**/
708
LINPHONE_PUBLIC	bool_t linphone_call_echo_limiter_enabled(const LinphoneCall *call);
Simon Morlat's avatar
Simon Morlat committed
709 710

/*keep this in sync with mediastreamer2/msvolume.h*/
Simon Morlat's avatar
Simon Morlat committed
711 712 713 714 715 716

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

smorlat's avatar
smorlat committed
718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737
/**
 * @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.
**/
738
typedef struct _LinphoneProxyConfig LinphoneProxyConfig;
aymeric's avatar
aymeric committed
739

740 741 742 743
/**
 * LinphoneRegistrationState describes proxy registration states.
**/
typedef enum _LinphoneRegistrationState{
Simon Morlat's avatar
Simon Morlat committed
744 745 746 747 748
	LinphoneRegistrationNone, /**<Initial state for registrations */
	LinphoneRegistrationProgress, /**<Registration is in progress */
	LinphoneRegistrationOk,	/**< Registration is successful */
	LinphoneRegistrationCleared, /**< Unregistration succeeded */
	LinphoneRegistrationFailed	/**<Registration failed */
749 750
}LinphoneRegistrationState;

jehan's avatar
jehan committed
751 752 753 754
/**
 * Human readable version of the #LinphoneRegistrationState
 * @param cs sate
 */
755 756 757 758 759
LINPHONE_PUBLIC	const char *linphone_registration_state_to_string(LinphoneRegistrationState cs);
LINPHONE_PUBLIC	LinphoneProxyConfig *linphone_proxy_config_new(void);
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);
760 761
LINPHONE_PUBLIC	void linphone_proxy_config_set_expires(LinphoneProxyConfig *obj, int expires);
#define linphone_proxy_config_expires linphone_proxy_config_set_expires
jehan's avatar
jehan committed
762 763 764 765 766 767
/**
 * 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
 */
768
LINPHONE_PUBLIC	void linphone_proxy_config_enable_register(LinphoneProxyConfig *obj, bool_t val);
aymeric's avatar
aymeric committed
769
#define linphone_proxy_config_enableregister linphone_proxy_config_enable_register
770 771
LINPHONE_PUBLIC	void linphone_proxy_config_edit(LinphoneProxyConfig *obj);
LINPHONE_PUBLIC	int linphone_proxy_config_done(LinphoneProxyConfig *obj);
jehan's avatar
jehan committed
772 773 774 775 776 777 778
/**
 * 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
 *
 */
779
LINPHONE_PUBLIC	void linphone_proxy_config_enable_publish(LinphoneProxyConfig *obj, bool_t val);
Sylvain Berfini's avatar
Sylvain Berfini committed
780 781
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);
782

Ghislain MARY's avatar
Ghislain MARY committed
783 784 785 786 787
/**
 * 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
788
LINPHONE_PUBLIC	LinphoneRegistrationState linphone_proxy_config_get_state(const LinphoneProxyConfig *obj);
Ghislain MARY's avatar
Ghislain MARY committed
789

790
LINPHONE_PUBLIC	bool_t linphone_proxy_config_is_registered(const LinphoneProxyConfig *obj);
Ghislain MARY's avatar
Ghislain MARY committed
791 792 793 794 795 796

/**
 * 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
797
LINPHONE_PUBLIC	const char *linphone_proxy_config_get_domain(const LinphoneProxyConfig *cfg);
798

Sylvain Berfini's avatar
Sylvain Berfini committed
799
LINPHONE_PUBLIC	const char *linphone_proxy_config_get_route(const LinphoneProxyConfig *obj);
800
LINPHONE_PUBLIC	const char *linphone_proxy_config_get_identity(const LinphoneProxyConfig *obj);
801
LINPHONE_PUBLIC	bool_t linphone_proxy_config_publish_enabled(const LinphoneProxyConfig *obj);
802
LINPHONE_PUBLIC	const char *linphone_proxy_config_get_addr(const LinphoneProxyConfig *obj);
803
LINPHONE_PUBLIC	int linphone_proxy_config_get_expires(const LinphoneProxyConfig *obj);
Sylvain Berfini's avatar
Sylvain Berfini committed
804
LINPHONE_PUBLIC	bool_t linphone_proxy_config_register_enabled(const LinphoneProxyConfig *obj);
805 806
LINPHONE_PUBLIC	void linphone_proxy_config_refresh_register(LinphoneProxyConfig *obj);
LINPHONE_PUBLIC	const char *linphone_proxy_config_get_contact_parameters(const LinphoneProxyConfig *obj);
Sylvain Berfini's avatar
Sylvain Berfini committed
807
LINPHONE_PUBLIC	void linphone_proxy_config_set_contact_parameters(LinphoneProxyConfig *obj, const char *contact_params);
808 809
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
810 811 812 813 814 815

/**
 * 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
816
LINPHONE_PUBLIC LinphoneCore * linphone_proxy_config_get_core(const LinphoneProxyConfig *obj);
817

818 819
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);
820

Ghislain MARY's avatar
Ghislain MARY committed
821 822 823 824 825
/**
 * 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
826
LINPHONE_PUBLIC LinphoneReason linphone_proxy_config_get_error(const LinphoneProxyConfig *cfg);
Ghislain MARY's avatar
Ghislain MARY committed
827

jehan's avatar
jehan committed
828 829 830 831 832 833 834
/*
 * 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
835

aymeric's avatar
aymeric committed
836
/* destruction is called automatically when removing the proxy config */
Ghislain MARY's avatar
Ghislain MARY committed
837 838
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
839
SipSetupContext *linphone_proxy_config_get_sip_setup_context(LinphoneProxyConfig *cfg);
Ghislain MARY's avatar
Ghislain MARY committed
840
LINPHONE_PUBLIC SipSetup *linphone_proxy_config_get_sip_setup(LinphoneProxyConfig *cfg);
841 842 843
/**
 * normalize a human readable phone number into a basic string. 888-444-222 becomes 888444222
 */
Sylvain Berfini's avatar
Sylvain Berfini committed
844
LINPHONE_PUBLIC	int linphone_proxy_config_normalize_number(LinphoneProxyConfig *proxy, const char *username, char *result, size_t result_len);
jehan's avatar
jehan committed
845 846 847
/*
 *  attached a user data to a proxy config
 */
848
LINPHONE_PUBLIC	void linphone_proxy_config_set_user_data(LinphoneProxyConfig *cr, void * ud);
jehan's avatar
jehan committed
849 850 851
/*
 *  get user data to a proxy config. return null if any
 */
852
LINPHONE_PUBLIC	void * linphone_proxy_config_get_user_data(LinphoneProxyConfig *cr);
smorlat's avatar
smorlat committed
853

jehan's avatar
jehan committed
854
/**
Simon Morlat's avatar
Simon Morlat committed
855
 * Set default privacy policy for all calls routed through this proxy.
jehan's avatar
jehan committed
856 857 858
 * @param params to be modified
 * @param LinphonePrivacy to configure privacy
 * */
Simon Morlat's avatar
Simon Morlat committed
859
LINPHONE_PUBLIC void linphone_proxy_config_set_privacy(LinphoneProxyConfig *params, LinphonePrivacyMask privacy);
jehan's avatar
jehan committed
860
/**
Simon Morlat's avatar
Simon Morlat committed
861
 * Get default privacy policy for all calls routed through this proxy.
jehan's avatar
jehan committed
862 863 864 865 866
 * @param params object
 * @return Privacy mode
 * */
LINPHONE_PUBLIC LinphonePrivacyMask linphone_proxy_config_get_privacy(const LinphoneProxyConfig *params);

smorlat's avatar
smorlat committed
867 868 869 870
/**
 * @}
**/

smorlat's avatar
smorlat committed
871
typedef struct _LinphoneAccountCreator{
Simon Morlat's avatar
Simon Morlat committed
872
	LinphoneCore *lc;
smorlat's avatar
smorlat committed
873 874 875 876
	struct _SipSetupContext *ssctx;
	char *username;
	char *password;
	char *domain;
Sylvain Berfini's avatar
Wizard  
Sylvain Berfini committed
877 878 879
	char *route;
	char *email;
	int suscribe;
smorlat's avatar
smorlat committed
880 881 882
	bool_t succeeded;
}LinphoneAccountCreator;

Simon Morlat's avatar
Simon Morlat committed
883
LinphoneAccountCreator *linphone_account_creator_new(LinphoneCore *core, const char *type);
smorlat's avatar
smorlat committed
884 885 886
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
887 888 889
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
890 891
const char * linphone_account_creator_get_username(LinphoneAccountCreator *obj);
const char * linphone_account_creator_get_domain(LinphoneAccountCreator *obj);
892
int linphone_account_creator_test_existence(LinphoneAccountCreator *obj);
Sylvain Berfini's avatar
Wizard  
Sylvain Berfini committed
893
int linphone_account_creator_test_validation(LinphoneAccountCreator *obj);
smorlat's avatar
smorlat committed
894 895 896
LinphoneProxyConfig * linphone_account_creator_validate(LinphoneAccountCreator *obj);
void linphone_account_creator_destroy(LinphoneAccountCreator *obj);

897 898
struct _LinphoneAuthInfo;

smorlat's avatar
smorlat committed
899 900 901 902 903 904 905 906 907 908 909 910
/**
 * @ingroup authentication
 * Object holding authentication information.
 *
 * @note The object's fields should not be accessed directly. Prefer using
 * the accessor methods.
 *
 * In most case, authentication information consists of a username and password.
 * Sometimes, a userid is required by proxy, and realm can be useful to discriminate
 * different SIP domains.
 *
 * Once created and filled, a LinphoneAuthInfo must be added to the LinphoneCore in
911
 * order to become known and used automatically when needed.
smorlat's avatar
smorlat committed
912 913 914 915 916 917
 * 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.
 *
918 919
 * 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
920 921 922
 * transactions and retry them with authentication headers.
 *
**/
923
typedef struct _LinphoneAuthInfo LinphoneAuthInfo;
aymeric's avatar
aymeric committed
924

925
LINPHONE_PUBLIC	LinphoneAuthInfo *linphone_auth_info_new(const char *username, const char *userid,
926
		const char *passwd, const char *ha1,const char *realm, const char *domain);
927 928 929 930 931 932 933
/**
 * @addtogroup authentication
 * Instanciate a new auth info with values from source
 * @param source auth info object to be cloned
 * @return newly created auth info
 */
LINPHONE_PUBLIC	LinphoneAuthInfo *linphone_auth_info_clone(const LinphoneAuthInfo* source);
Ghislain MARY's avatar
Ghislain MARY committed
934 935 936 937
LINPHONE_PUBLIC void linphone_auth_info_set_passwd(LinphoneAuthInfo *info, const char *passwd);
LINPHONE_PUBLIC void linphone_auth_info_set_username(LinphoneAuthInfo *info, const char *username);
LINPHONE_PUBLIC void linphone_auth_info_set_userid(LinphoneAuthInfo *info, const char *userid);
LINPHONE_PUBLIC void linphone_auth_info_set_realm(LinphoneAuthInfo *info, const char *realm);
938
LINPHONE_PUBLIC void linphone_auth_info_set_domain(LinphoneAuthInfo *info, const char *domain);
Ghislain MARY's avatar
Ghislain MARY committed
939 940 941 942 943 944
LINPHONE_PUBLIC void linphone_auth_info_set_ha1(LinphoneAuthInfo *info, const char *ha1);

LINPHONE_PUBLIC const char *linphone_auth_info_get_username(const LinphoneAuthInfo *i);
LINPHONE_PUBLIC const char *linphone_auth_info_get_passwd(const LinphoneAuthInfo *i);
LINPHONE_PUBLIC const char *linphone_auth_info_get_userid(const LinphoneAuthInfo *i);
LINPHONE_PUBLIC const char *linphone_auth_info_get_realm(const LinphoneAuthInfo *i);
945
LINPHONE_PUBLIC const char *linphone_auth_info_get_domain(const LinphoneAuthInfo *i);
Ghislain MARY's avatar
Ghislain MARY committed
946
LINPHONE_PUBLIC const char *linphone_auth_info_get_ha1(const LinphoneAuthInfo *i);
947

aymeric's avatar
aymeric committed
948
/* you don't need those function*/
Ghislain MARY's avatar
Ghislain MARY committed
949 950
LINPHONE_PUBLIC void linphone_auth_info_destroy(LinphoneAuthInfo *info);
LINPHONE_PUBLIC LinphoneAuthInfo * linphone_auth_info_new_from_config_file(LpConfig *config, int pos);
aymeric's avatar
aymeric committed
951

jehan's avatar
jehan committed
952

953
struct _LinphoneChatRoom;
jehan's avatar
jehan committed
954 955 956 957
/**
 * @addtogroup chatroom
 * @{
 */
jehan's avatar
jehan committed
958 959 960 961 962 963

/**
 * A chat room message to old content to be sent.
 * <br> Can be created by linphone_chat_room_create_message().
 */
typedef struct _LinphoneChatMessage LinphoneChatMessage;
Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
964

jehan's avatar
jehan committed
965 966 967 968
/**
 * A chat room is the place where text messages are exchanged.
 * <br> Can be created by linphone_core_create_chat_room().
 */
aymeric's avatar
aymeric committed