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

189 190
#define LinphoneReasonBadCredentials LinphoneReasonForbidden

191 192 193
/*for compatibility*/
#define LinphoneReasonMedia LinphoneReasonUnsupportedContent

194 195 196 197 198 199 200 201 202 203 204 205
/**
 * 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);

206 207 208 209 210 211 212 213 214 215 216 217
/**
 * 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);
218 219 220 221 222 223 224 225 226 227 228 229 230 231

/* 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);
232
LINPHONE_PUBLIC int linphone_dictionary_haskey(const LinphoneDictionary* obj, const char* key);
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
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
249 250
#ifdef IN_LINPHONE
#include "linphonefriend.h"
251
#include "event.h"
jehan's avatar
jehan committed
252 253
#else
#include "linphone/linphonefriend.h"
254
#include "linphone/event.h"
jehan's avatar
jehan committed
255
#endif
256

257
LINPHONE_PUBLIC	LinphoneAddress * linphone_address_new(const char *addr);
Ghislain MARY's avatar
Ghislain MARY committed
258 259 260 261
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);
262 263 264
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);
265
LINPHONE_PUBLIC int linphone_address_get_port(const LinphoneAddress *u);
266 267 268
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);
269
LINPHONE_PUBLIC	void linphone_address_set_port(LinphoneAddress *uri, int port);
270
/*remove tags, params etc... so that it is displayable to the user*/
271
LINPHONE_PUBLIC	void linphone_address_clean(LinphoneAddress *uri);
272 273 274
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);
275
LINPHONE_PUBLIC	char *linphone_address_as_string(const LinphoneAddress *u);
Sylvain Berfini's avatar
Sylvain Berfini committed
276
LINPHONE_PUBLIC	char *linphone_address_as_string_uri_only(const LinphoneAddress *u);
277 278
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
279

280 281 282 283 284 285 286 287 288
/**
 * 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
289
struct _SipSetupContext;
290

aymeric's avatar
aymeric committed
291

smorlat's avatar
smorlat committed
292 293 294 295 296 297 298 299
/**
 * Enum representing the direction of a call.
 * @ingroup call_logs
**/
enum _LinphoneCallDir {
	LinphoneCallOutgoing, /**< outgoing calls*/
	LinphoneCallIncoming  /**< incoming calls*/
};
aymeric's avatar
aymeric committed
300

smorlat's avatar
smorlat committed
301 302 303 304 305
/**
 * Typedef for enum
 * @ingroup call_logs
**/
typedef enum _LinphoneCallDir LinphoneCallDir;
aymeric's avatar
aymeric committed
306

smorlat's avatar
smorlat committed
307 308 309 310
/**
 * Enum representing the status of a call
 * @ingroup call_logs
**/
311
typedef enum _LinphoneCallStatus {
smorlat's avatar
smorlat committed
312 313
	LinphoneCallSuccess, /**< The call was sucessful*/
	LinphoneCallAborted, /**< The call was aborted */
314 315
	LinphoneCallMissed, /**< The call was missed (unanswered)*/
	LinphoneCallDeclined /**< The call was declined, either locally or by remote end*/
aymeric's avatar
aymeric committed
316 317
} LinphoneCallStatus;

smorlat's avatar
smorlat committed
318 319 320 321
/**
 * Structure representing a call log.
 *
 * @ingroup call_logs
322
 *
smorlat's avatar
smorlat committed
323
**/
324
typedef struct _LinphoneCallLog LinphoneCallLog;
Simon Morlat's avatar
Simon Morlat committed
325 326 327

/**
 * Enum describing type of media encryption types.
328
 * @ingroup media_parameters
Simon Morlat's avatar
Simon Morlat committed
329
**/
330 331 332 333
enum _LinphoneMediaEncryption {
	LinphoneMediaEncryptionNone, /**< No media encryption is used */
	LinphoneMediaEncryptionSRTP, /**< Use SRTP media encryption */
	LinphoneMediaEncryptionZRTP /**< Use ZRTP media encryption */
334
};
smorlat's avatar
smorlat committed
335

Simon Morlat's avatar
Simon Morlat committed
336 337
/**
 * Enum describing type of media encryption types.
338
 * @ingroup media_parameters
Simon Morlat's avatar
Simon Morlat committed
339
**/
340
typedef enum _LinphoneMediaEncryption LinphoneMediaEncryption;
aymeric's avatar
aymeric committed
341

Simon Morlat's avatar
Simon Morlat committed
342 343 344 345 346 347
/**
 * Convert enum member to string.
 * @ingroup media_parameters
**/
LINPHONE_PUBLIC const char *linphone_media_encryption_to_string(LinphoneMediaEncryption menc);

aymeric's avatar
aymeric committed
348
/*public: */
Sylvain Berfini's avatar
Sylvain Berfini committed
349 350 351 352 353
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);
354
LINPHONE_PUBLIC	bool_t linphone_call_log_video_enabled(LinphoneCallLog *cl);
Sylvain Berfini's avatar
Sylvain Berfini committed
355 356 357 358 359
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);
360 361
void linphone_call_log_set_ref_key(LinphoneCallLog *cl, const char *refkey);
const char *linphone_call_log_get_ref_key(const LinphoneCallLog *cl);
362 363
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
364 365
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
366

367 368 369 370
/**
 * Private structure definition for LinphoneCallParams.
 * @ingroup call_control
**/
Simon Morlat's avatar
Simon Morlat committed
371
struct _LinphoneCallParams;
372

373
/**
Guillaume Beraudo's avatar
Typo  
Guillaume Beraudo committed
374
 * The LinphoneCallParams is an object containing various call related parameters.
375
 * It can be used to retrieve parameters from a currently running call or modify the call's characteristics
376
 * dynamically.
377
 * @ingroup call_control
378 379 380
**/
typedef struct _LinphoneCallParams LinphoneCallParams;

381 382
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);
383 384 385
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);
386 387 388 389 390 391 392 393 394 395 396
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);
397 398
LINPHONE_PUBLIC const char *linphone_call_params_get_session_name(const LinphoneCallParams *cp);
LINPHONE_PUBLIC void linphone_call_params_set_session_name(LinphoneCallParams *cp, const char *subject);
Ghislain MARY's avatar
Ghislain MARY committed
399 400 401 402 403 404 405 406

/**
 * 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
**/
407
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
408 409 410 411 412 413 414 415

/**
 * 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
**/
416
LINPHONE_PUBLIC	const char *linphone_call_params_get_custom_header(const LinphoneCallParams *params, const char *header_name);
Simon Morlat's avatar
Simon Morlat committed
417

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

Simon Morlat's avatar
Simon Morlat committed
479
	/**
Simon Morlat's avatar
Simon Morlat committed
480
	 * 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
481 482
	 */
	LinphonePrivacyDefault=0x8000,
jehan's avatar
jehan committed
483
} LinphonePrivacy;
jehan's avatar
jehan committed
484 485 486 487 488
/*
 * a mask  of #LinphonePrivacy values
 * */
typedef unsigned int LinphonePrivacyMask;

Simon Morlat's avatar
Simon Morlat committed
489 490

LINPHONE_PUBLIC const char* linphone_privacy_to_string(LinphonePrivacy privacy);
Simon Morlat's avatar
Simon Morlat committed
491
LINPHONE_PUBLIC void linphone_call_params_set_privacy(LinphoneCallParams *params, LinphonePrivacyMask privacy);
jehan's avatar
jehan committed
492
LINPHONE_PUBLIC LinphonePrivacyMask linphone_call_params_get_privacy(const LinphoneCallParams *params);
Simon Morlat's avatar
Simon Morlat committed
493 494 495 496 497 498 499 500


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

501 502
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
503
LINPHONE_PUBLIC void linphone_info_message_add_header(LinphoneInfoMessage *im, const char *name, const char *value);
Simon Morlat's avatar
Simon Morlat committed
504
LINPHONE_PUBLIC const char *linphone_info_message_get_header(const LinphoneInfoMessage *im, const char *name);
Simon Morlat's avatar
Simon Morlat committed
505
LINPHONE_PUBLIC void linphone_info_message_set_content(LinphoneInfoMessage *im,  const LinphoneContent *content);
Simon Morlat's avatar
Simon Morlat committed
506
LINPHONE_PUBLIC const LinphoneContent * linphone_info_message_get_content(const LinphoneInfoMessage *im);
507
LINPHONE_PUBLIC const char *linphone_info_message_get_from(const LinphoneInfoMessage *im);
Simon Morlat's avatar
Simon Morlat committed
508
LINPHONE_PUBLIC void linphone_info_message_destroy(LinphoneInfoMessage *im);
509
LINPHONE_PUBLIC LinphoneInfoMessage *linphone_info_message_copy(const LinphoneInfoMessage *orig);
Simon Morlat's avatar
Simon Morlat committed
510

Simon Morlat's avatar
Simon Morlat committed
511 512


513 514
/**
 * Structure describing policy regarding video streams establishments.
Simon Morlat's avatar
Simon Morlat committed
515
 * @ingroup media_parameters
516 517
**/
struct _LinphoneVideoPolicy{
Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
518
	bool_t automatically_initiate; /**<Whether video shall be automatically proposed for outgoing calls.*/
519 520 521 522
	bool_t automatically_accept; /**<Whether video shall be automatically accepted for incoming calls*/
	bool_t unused[2];
};

Simon Morlat's avatar
Simon Morlat committed
523 524 525 526
/**
 * Structure describing policy regarding video streams establishments.
 * @ingroup media_parameters
**/
527 528
typedef struct _LinphoneVideoPolicy LinphoneVideoPolicy;

529

Yann Diorcet's avatar
Yann Diorcet committed
530 531


Simon Morlat's avatar
Simon Morlat committed
532 533 534 535 536
/**
 * @addtogroup call_misc
 * @{
**/

Yann Diorcet's avatar
Yann Diorcet committed
537 538 539
#define LINPHONE_CALL_STATS_AUDIO 0
#define LINPHONE_CALL_STATS_VIDEO 1

540 541 542 543 544 545
/**
 * Enum describing ICE states.
 * @ingroup initializing
**/
enum _LinphoneIceState{
	LinphoneIceStateNotActivated, /**< ICE has not been activated for this call */
Ghislain MARY's avatar
Ghislain MARY committed
546
	LinphoneIceStateFailed, /**< ICE processing has failed */
547 548 549 550 551 552 553 554 555 556 557 558
	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
559 560 561 562 563 564 565 566 567 568 569 570
/**
 * 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
571
	LinphoneUpnpStateBlacklisted, /**< IGD router is blacklisted */
Yann Diorcet's avatar
Yann Diorcet committed
572 573 574 575 576 577 578 579
};

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

580

Ghislain MARY's avatar
Ghislain MARY committed
581 582
#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 */
583 584


Simon Morlat's avatar
Simon Morlat committed
585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608
/**
 * 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.*/
609
	LinphoneIceState	ice_state; /**< State of ICE processing. */
Yann Diorcet's avatar
Yann Diorcet committed
610
	LinphoneUpnpState	upnp_state; /**< State of uPnP processing. */
611 612
	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*/
613 614
	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
615
	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
616 617 618 619 620
};

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

Sylvain Berfini's avatar
Sylvain Berfini committed
622 623
LINPHONE_PUBLIC const LinphoneCallStats *linphone_call_get_audio_stats(LinphoneCall *call);
LINPHONE_PUBLIC const LinphoneCallStats *linphone_call_get_video_stats(LinphoneCall *call);
624 625 626 627 628
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
629

630
/** Callback prototype */
631
typedef void (*LinphoneCallCbFunc)(LinphoneCall *call,void * user_data);
632

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

660
LINPHONE_PUBLIC	const char *linphone_call_state_to_string(LinphoneCallState cs);
661

662
LINPHONE_PUBLIC LinphoneCore *linphone_call_get_core(const LinphoneCall *call);
663
LINPHONE_PUBLIC	LinphoneCallState linphone_call_get_state(const LinphoneCall *call);
Ghislain MARY's avatar
Ghislain MARY committed
664
LINPHONE_PUBLIC bool_t linphone_call_asked_to_autoanswer(LinphoneCall *call);
Simon Morlat's avatar
Simon Morlat committed
665
LINPHONE_PUBLIC	const LinphoneAddress * linphone_core_get_current_call_remote_address(LinphoneCore *lc);
Sylvain Berfini's avatar
Sylvain Berfini committed
666 667 668
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);
669 670 671
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);
672 673 674 675
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);
676
LINPHONE_PUBLIC	LinphoneCall *linphone_call_get_replaced_call(LinphoneCall *call);
Sylvain Berfini's avatar
Sylvain Berfini committed
677
LINPHONE_PUBLIC	int linphone_call_get_duration(const LinphoneCall *call);
678
LINPHONE_PUBLIC	const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call);
679
LINPHONE_PUBLIC	const LinphoneCallParams * linphone_call_get_remote_params(LinphoneCall *call);
Ghislain MARY's avatar
Ghislain MARY committed
680 681
LINPHONE_PUBLIC void linphone_call_enable_camera(LinphoneCall *lc, bool_t enabled);
LINPHONE_PUBLIC bool_t linphone_call_camera_enabled(const LinphoneCall *lc);
682
LINPHONE_PUBLIC int linphone_call_take_video_snapshot(LinphoneCall *call, const char *file);
683
LINPHONE_PUBLIC	LinphoneReason linphone_call_get_reason(const LinphoneCall *call);
684
LINPHONE_PUBLIC const LinphoneErrorInfo *linphone_call_get_error_info(const LinphoneCall *call);
685
LINPHONE_PUBLIC	const char *linphone_call_get_remote_user_agent(LinphoneCall *call);
Sylvain Berfini's avatar
Sylvain Berfini committed
686
LINPHONE_PUBLIC	const char *linphone_call_get_remote_contact(LinphoneCall *call);
687
LINPHONE_PUBLIC LinphoneAddress *linphone_call_get_remote_contact_address(LinphoneCall *call);
688 689 690 691 692 693 694
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);
695 696
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
697
LINPHONE_PUBLIC	void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer);
698
LINPHONE_PUBLIC	void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, LinphoneCallCbFunc cb, void* user_data);
699 700
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);
701 702
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
703

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

/*keep this in sync with mediastreamer2/msvolume.h*/
Simon Morlat's avatar
Simon Morlat committed
743 744 745 746 747 748

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

smorlat's avatar
smorlat committed
750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769
/**
 * @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.
**/
770
typedef struct _LinphoneProxyConfig LinphoneProxyConfig;
aymeric's avatar
aymeric committed
771

772 773 774 775
/**
 * LinphoneRegistrationState describes proxy registration states.
**/
typedef enum _LinphoneRegistrationState{
Simon Morlat's avatar
Simon Morlat committed
776 777 778 779 780
	LinphoneRegistrationNone, /**<Initial state for registrations */
	LinphoneRegistrationProgress, /**<Registration is in progress */
	LinphoneRegistrationOk,	/**< Registration is successful */
	LinphoneRegistrationCleared, /**< Unregistration succeeded */
	LinphoneRegistrationFailed	/**<Registration failed */
781 782
}LinphoneRegistrationState;

jehan's avatar
jehan committed
783 784 785 786
/**
 * Human readable version of the #LinphoneRegistrationState
 * @param cs sate
 */
787 788 789 790 791
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);
792 793
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
794 795 796 797 798 799
/**
 * 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
 */
800
LINPHONE_PUBLIC	void linphone_proxy_config_enable_register(LinphoneProxyConfig *obj, bool_t val);
aymeric's avatar
aymeric committed
801
#define linphone_proxy_config_enableregister linphone_proxy_config_enable_register
802 803
LINPHONE_PUBLIC	void linphone_proxy_config_edit(LinphoneProxyConfig *obj);
LINPHONE_PUBLIC	int linphone_proxy_config_done(LinphoneProxyConfig *obj);
jehan's avatar
jehan committed
804 805 806 807 808 809 810
/**
 * 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
 *
 */
811
LINPHONE_PUBLIC	void linphone_proxy_config_enable_publish(LinphoneProxyConfig *obj, bool_t val);
Sylvain Berfini's avatar
Sylvain Berfini committed
812 813
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);
814

815 816 817 818 819 820 821 822 823 824 825
/**
 * Indicates  either or not, quality statistics during call should be stored and sent to a collector at termination.
 * @param cfg #LinphoneProxyConfig object 
 * @param val if true, quality statistics publish will be stored and sent to the collector
 *
 */
LINPHONE_PUBLIC	void linphone_proxy_config_enable_statistics(LinphoneProxyConfig *cfg, bool_t val);
LINPHONE_PUBLIC	bool_t linphone_proxy_config_send_statistics_enabled(LinphoneProxyConfig *cfg);
LINPHONE_PUBLIC	void linphone_proxy_config_set_statistics_collector(LinphoneProxyConfig *cfg, const char *collector);
LINPHONE_PUBLIC	const char *linphone_proxy_config_get_statistics_collector(const LinphoneProxyConfig *obj);

Ghislain MARY's avatar
Ghislain MARY committed
826 827 828 829 830
/**
 * 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
831
LINPHONE_PUBLIC	LinphoneRegistrationState linphone_proxy_config_get_state(const LinphoneProxyConfig *obj);
Ghislain MARY's avatar
Ghislain MARY committed
832

833
LINPHONE_PUBLIC	bool_t linphone_proxy_config_is_registered(const LinphoneProxyConfig *obj);
Ghislain MARY's avatar
Ghislain MARY committed
834 835 836 837 838 839

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

Sylvain Berfini's avatar
Sylvain Berfini committed
842
LINPHONE_PUBLIC	const char *linphone_proxy_config_get_route(const LinphoneProxyConfig *obj);
843
LINPHONE_PUBLIC	const char *linphone_proxy_config_get_identity(const LinphoneProxyConfig *obj);
844
LINPHONE_PUBLIC	bool_t linphone_proxy_config_publish_enabled(const LinphoneProxyConfig *obj);
845
LINPHONE_PUBLIC	const char *linphone_proxy_config_get_addr(const LinphoneProxyConfig *obj);
846
LINPHONE_PUBLIC	int linphone_proxy_config_get_expires(const LinphoneProxyConfig *obj);
Sylvain Berfini's avatar
Sylvain Berfini committed
847
LINPHONE_PUBLIC	bool_t linphone_proxy_config_register_enabled(const LinphoneProxyConfig *obj);
848 849
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
850
LINPHONE_PUBLIC	void linphone_proxy_config_set_contact_parameters(LinphoneProxyConfig *obj, const char *contact_params);
851 852
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
853 854 855 856 857 858

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

861 862
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);
863

Ghislain MARY's avatar
Ghislain MARY committed
864 865 866 867 868
/**
 * 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
869
LINPHONE_PUBLIC LinphoneReason linphone_proxy_config_get_error(const LinphoneProxyConfig *cfg);
Ghislain MARY's avatar
Ghislain MARY committed
870

871 872 873 874 875 876 877
/**
 * 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
878 879 880 881 882 883 884
/*
 * 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
885

aymeric's avatar
aymeric committed
886
/* destruction is called automatically when removing the proxy config */
Ghislain MARY's avatar
Ghislain MARY committed
887 888
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
889
SipSetupContext *linphone_proxy_config_get_sip_setup_context(LinphoneProxyConfig *cfg);
Ghislain MARY's avatar
Ghislain MARY committed
890
LINPHONE_PUBLIC SipSetup *linphone_proxy_config_get_sip_setup(LinphoneProxyConfig *cfg);
891 892 893
/**
 * normalize a human readable phone number into a basic string. 888-444-222 becomes 888444222
 */
Sylvain Berfini's avatar
Sylvain Berfini committed
894
LINPHONE_PUBLIC	int linphone_proxy_config_normalize_number(LinphoneProxyConfig *proxy, const char *username, char *result, size_t result_len);
jehan's avatar
jehan committed
895 896 897
/*
 *  attached a user data to a proxy config
 */
898
LINPHONE_PUBLIC	void linphone_proxy_config_set_user_data(LinphoneProxyConfig *cr, void * ud);
jehan's avatar
jehan committed
899 900 901
/*
 *  get user data to a proxy config. return null if any
 */
902
LINPHONE_PUBLIC	void * linphone_proxy_config_get_user_data(LinphoneProxyConfig *cr);
smorlat's avatar
smorlat committed
903

jehan's avatar
jehan committed
904
/**
Simon Morlat's avatar
Simon Morlat committed
905
 * Set default privacy policy for all calls routed through this proxy.
jehan's avatar
jehan committed
906 907 908
 * @param params to be modified
 * @param LinphonePrivacy to configure privacy
 * */
Simon Morlat's avatar
Simon Morlat committed
909
LINPHONE_PUBLIC void linphone_proxy_config_set_privacy(LinphoneProxyConfig *params, LinphonePrivacyMask privacy);
jehan's avatar
jehan committed
910
/**
Simon Morlat's avatar
Simon Morlat committed
911
 * Get default privacy policy for all calls routed through this proxy.
jehan's avatar
jehan committed
912 913 914 915 916
 * @param params object
 * @return Privacy mode
 * */
LINPHONE_PUBLIC LinphonePrivacyMask linphone_proxy_config_get_privacy(const LinphoneProxyConfig *params);

smorlat's avatar
smorlat committed
917 918 919 920
/**
 * @}
**/

smorlat's avatar
smorlat committed
921
typedef struct _LinphoneAccountCreator{
Simon Morlat's avatar
Simon Morlat committed
922
	LinphoneCore *lc;
smorlat's avatar
smorlat committed
923 924 925 926
	struct _SipSetupContext *ssctx;
	char *username;
	char *password;
	char *domain;
Sylvain Berfini's avatar
Wizard  
Sylvain Berfini committed
927 928 929
	char *route;
	char *email;
	int suscribe;
smorlat's avatar
smorlat committed
930 931 932
	bool_t succeeded;
}LinphoneAccountCreator;

Simon Morlat's avatar
Simon Morlat committed
933
LinphoneAccountCreator *linphone_account_creator_new(LinphoneCore *core, const char *type);
smorlat's avatar
smorlat committed
934 935 936
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
937 938 939
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
940 941
const char * linphone_account_creator_get_username(LinphoneAccountCreator *obj);
const char * linphone_account_creator_get_domain(LinphoneAccountCreator *obj);
942
int linphone_account_creator_test_existence(LinphoneAccountCreator *obj);
Sylvain Berfini's avatar
Wizard  
Sylvain Berfini committed
943
int linphone_account_creator_test_validation(LinphoneAccountCreator *obj);
smorlat's avatar
smorlat committed
944 945 946
LinphoneProxyConfig * linphone_account_creator_validate(LinphoneAccountCreator *obj);
void linphone_account_creator_destroy(LinphoneAccountCreator *obj);

947 948
struct _LinphoneAuthInfo;

smorlat's avatar
smorlat committed
949 950 951 952 953 954 955 956 957 958 959 960
/**
 * @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
961
 * order to become known and used automatically when needed.
smorlat's avatar
smorlat committed
962 963 964 965 966 967
 * 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.
 *
968 969
 * 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
970 971 972
 * transactions and retry them with authentication headers.
 *
**/
973
typedef struct _LinphoneAuthInfo LinphoneAuthInfo;
aymeric's avatar
aymeric committed
974

<