| 1 | /* |
|---|
| 2 | linphone |
|---|
| 3 | Copyright (C) 2000 Simon MORLAT (simon.morlat@linphone.org) |
|---|
| 4 | |
|---|
| 5 | This program is free software; you can redistribute it and/or |
|---|
| 6 | modify it under the terms of the GNU General Public License |
|---|
| 7 | as published by the Free Software Foundation; either version 2 |
|---|
| 8 | of the License, or (at your option) any later version. |
|---|
| 9 | |
|---|
| 10 | This program is distributed in the hope that it will be useful, |
|---|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | GNU General Public License for more details. |
|---|
| 14 | |
|---|
| 15 | You should have received a copy of the GNU General Public License |
|---|
| 16 | along with this program; if not, write to the Free Software |
|---|
| 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|---|
| 18 | */ |
|---|
| 19 | #ifndef LINPHONECORE_H |
|---|
| 20 | #define LINPHONECORE_H |
|---|
| 21 | |
|---|
| 22 | #include "ortp/ortp.h" |
|---|
| 23 | #include "ortp/payloadtype.h" |
|---|
| 24 | #include "mediastreamer2/mscommon.h" |
|---|
| 25 | #include "mediastreamer2/msvideo.h" |
|---|
| 26 | |
|---|
| 27 | #ifdef IN_LINPHONE |
|---|
| 28 | #include "sipsetup.h" |
|---|
| 29 | #else |
|---|
| 30 | #include "linphone/sipsetup.h" |
|---|
| 31 | #endif |
|---|
| 32 | |
|---|
| 33 | #define LINPHONE_IPADDR_SIZE 64 |
|---|
| 34 | #define LINPHONE_HOSTNAME_SIZE 128 |
|---|
| 35 | |
|---|
| 36 | #ifdef __cplusplus |
|---|
| 37 | extern "C" { |
|---|
| 38 | #endif |
|---|
| 39 | |
|---|
| 40 | struct _MSSndCard; |
|---|
| 41 | struct _LinphoneCore; |
|---|
| 42 | |
|---|
| 43 | bool_t payload_type_enabled(struct _PayloadType *pt); |
|---|
| 44 | void payload_type_set_enable(struct _PayloadType *pt,int value); |
|---|
| 45 | const char *payload_type_get_description(struct _PayloadType *pt); |
|---|
| 46 | int payload_type_get_bitrate(PayloadType *pt); |
|---|
| 47 | const char *payload_type_get_mime(PayloadType *pt); |
|---|
| 48 | int payload_type_get_rate(PayloadType *pt); |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | struct _LpConfig; |
|---|
| 52 | |
|---|
| 53 | typedef struct sip_config |
|---|
| 54 | { |
|---|
| 55 | char *contact; |
|---|
| 56 | char *guessed_contact; |
|---|
| 57 | int sip_port; |
|---|
| 58 | MSList *proxies; |
|---|
| 59 | MSList *deleted_proxies; |
|---|
| 60 | int inc_timeout; /*timeout after an un-answered incoming call is rejected*/ |
|---|
| 61 | bool_t use_info; |
|---|
| 62 | bool_t use_rfc2833; /*force RFC2833 to be sent*/ |
|---|
| 63 | bool_t guess_hostname; |
|---|
| 64 | bool_t loopback_only; |
|---|
| 65 | bool_t ipv6_enabled; |
|---|
| 66 | bool_t sdp_200_ack; |
|---|
| 67 | bool_t only_one_codec; /*in SDP answers*/ |
|---|
| 68 | bool_t register_only_when_network_is_up; |
|---|
| 69 | } sip_config_t; |
|---|
| 70 | |
|---|
| 71 | typedef struct rtp_config |
|---|
| 72 | { |
|---|
| 73 | int audio_rtp_port; |
|---|
| 74 | int video_rtp_port; |
|---|
| 75 | int audio_jitt_comp; /*jitter compensation*/ |
|---|
| 76 | int video_jitt_comp; /*jitter compensation*/ |
|---|
| 77 | int nortp_timeout; |
|---|
| 78 | }rtp_config_t; |
|---|
| 79 | |
|---|
| 80 | |
|---|
| 81 | |
|---|
| 82 | typedef struct net_config |
|---|
| 83 | { |
|---|
| 84 | char *nat_address; |
|---|
| 85 | char *stun_server; |
|---|
| 86 | char *relay; |
|---|
| 87 | int download_bw; |
|---|
| 88 | int upload_bw; |
|---|
| 89 | int firewall_policy; |
|---|
| 90 | int mtu; |
|---|
| 91 | bool_t nat_sdp_only; |
|---|
| 92 | }net_config_t; |
|---|
| 93 | |
|---|
| 94 | |
|---|
| 95 | typedef struct sound_config |
|---|
| 96 | { |
|---|
| 97 | struct _MSSndCard * ring_sndcard; /* the playback sndcard currently used */ |
|---|
| 98 | struct _MSSndCard * play_sndcard; /* the playback sndcard currently used */ |
|---|
| 99 | struct _MSSndCard * capt_sndcard; /* the capture sndcard currently used */ |
|---|
| 100 | const char **cards; |
|---|
| 101 | int latency; /* latency in samples of the current used sound device */ |
|---|
| 102 | char rec_lev; |
|---|
| 103 | char play_lev; |
|---|
| 104 | char ring_lev; |
|---|
| 105 | char source; |
|---|
| 106 | char *local_ring; |
|---|
| 107 | char *remote_ring; |
|---|
| 108 | bool_t ec; |
|---|
| 109 | bool_t ea; |
|---|
| 110 | bool_t agc; |
|---|
| 111 | } sound_config_t; |
|---|
| 112 | |
|---|
| 113 | typedef struct codecs_config |
|---|
| 114 | { |
|---|
| 115 | MSList *audio_codecs; /* list of audio codecs in order of preference*/ |
|---|
| 116 | MSList *video_codecs; /* for later use*/ |
|---|
| 117 | }codecs_config_t; |
|---|
| 118 | |
|---|
| 119 | typedef struct video_config{ |
|---|
| 120 | struct _MSWebCam *device; |
|---|
| 121 | const char **cams; |
|---|
| 122 | MSVideoSize vsize; |
|---|
| 123 | bool_t capture; |
|---|
| 124 | bool_t show_local; |
|---|
| 125 | bool_t display; |
|---|
| 126 | bool_t selfview; /*during calls*/ |
|---|
| 127 | }video_config_t; |
|---|
| 128 | |
|---|
| 129 | typedef struct ui_config |
|---|
| 130 | { |
|---|
| 131 | int is_daemon; |
|---|
| 132 | int is_applet; |
|---|
| 133 | unsigned int timer_id; /* the timer id for registration */ |
|---|
| 134 | }ui_config_t; |
|---|
| 135 | |
|---|
| 136 | |
|---|
| 137 | |
|---|
| 138 | typedef struct autoreplier_config |
|---|
| 139 | { |
|---|
| 140 | int enabled; |
|---|
| 141 | int after_seconds; /* accept the call after x seconds*/ |
|---|
| 142 | int max_users; /* maximum number of user that can call simultaneously */ |
|---|
| 143 | int max_rec_time; /* the max time of incoming voice recorded */ |
|---|
| 144 | int max_rec_msg; /* maximum number of recorded messages */ |
|---|
| 145 | const char *message; /* the path of the file to be played */ |
|---|
| 146 | }autoreplier_config_t; |
|---|
| 147 | |
|---|
| 148 | struct osip_from; |
|---|
| 149 | |
|---|
| 150 | /** |
|---|
| 151 | * Object that represents a SIP address. |
|---|
| 152 | * |
|---|
| 153 | * The LinphoneAddress is an opaque object to represents SIP addresses, ie |
|---|
| 154 | * the content of SIP's 'from' and 'to' headers. |
|---|
| 155 | * A SIP address is made of display name, username, domain name, port, and various |
|---|
| 156 | * uri headers (such as tags). It looks like 'Alice <sip:alice@example.net>'. |
|---|
| 157 | * The LinphoneAddress has methods to extract and manipulate all parts of the address. |
|---|
| 158 | * When some part of the address (for example the username) is empty, the accessor methods |
|---|
| 159 | * return NULL. |
|---|
| 160 | * |
|---|
| 161 | * @ingroup linphone_address |
|---|
| 162 | * @var LinphoneAddress |
|---|
| 163 | */ |
|---|
| 164 | typedef struct osip_from LinphoneAddress; |
|---|
| 165 | |
|---|
| 166 | LinphoneAddress * linphone_address_new(const char *uri); |
|---|
| 167 | LinphoneAddress * linphone_address_clone(const LinphoneAddress *uri); |
|---|
| 168 | const char *linphone_address_get_scheme(const LinphoneAddress *u); |
|---|
| 169 | const char *linphone_address_get_display_name(const LinphoneAddress* u); |
|---|
| 170 | const char *linphone_address_get_username(const LinphoneAddress *u); |
|---|
| 171 | const char *linphone_address_get_domain(const LinphoneAddress *u); |
|---|
| 172 | void linphone_address_set_display_name(LinphoneAddress *u, const char *display_name); |
|---|
| 173 | void linphone_address_set_username(LinphoneAddress *uri, const char *username); |
|---|
| 174 | void linphone_address_set_domain(LinphoneAddress *uri, const char *host); |
|---|
| 175 | void linphone_address_set_port(LinphoneAddress *uri, const char *port); |
|---|
| 176 | void linphone_address_set_port_int(LinphoneAddress *uri, int port); |
|---|
| 177 | /*remove tags, params etc... so that it is displayable to the user*/ |
|---|
| 178 | void linphone_address_clean(LinphoneAddress *uri); |
|---|
| 179 | char *linphone_address_as_string(const LinphoneAddress *u); |
|---|
| 180 | char *linphone_address_as_string_uri_only(const LinphoneAddress *u); |
|---|
| 181 | void linphone_address_destroy(LinphoneAddress *u); |
|---|
| 182 | |
|---|
| 183 | struct _LinphoneCore; |
|---|
| 184 | struct _sdp_context; |
|---|
| 185 | struct _SipSetupContext; |
|---|
| 186 | struct _LinphoneCall; |
|---|
| 187 | |
|---|
| 188 | /** |
|---|
| 189 | * Enum representing the direction of a call. |
|---|
| 190 | * @ingroup call_logs |
|---|
| 191 | **/ |
|---|
| 192 | enum _LinphoneCallDir { |
|---|
| 193 | LinphoneCallOutgoing, /**< outgoing calls*/ |
|---|
| 194 | LinphoneCallIncoming /**< incoming calls*/ |
|---|
| 195 | }; |
|---|
| 196 | |
|---|
| 197 | /** |
|---|
| 198 | * Typedef for enum |
|---|
| 199 | * @ingroup call_logs |
|---|
| 200 | **/ |
|---|
| 201 | typedef enum _LinphoneCallDir LinphoneCallDir; |
|---|
| 202 | |
|---|
| 203 | /** |
|---|
| 204 | * Enum representing the status of a call |
|---|
| 205 | * @ingroup call_logs |
|---|
| 206 | **/ |
|---|
| 207 | typedef enum _LinphoneCallStatus { |
|---|
| 208 | LinphoneCallSuccess, /**< The call was sucessful*/ |
|---|
| 209 | LinphoneCallAborted, /**< The call was aborted */ |
|---|
| 210 | LinphoneCallMissed /**< The call was missed (unanswered)*/ |
|---|
| 211 | } LinphoneCallStatus; |
|---|
| 212 | |
|---|
| 213 | /** |
|---|
| 214 | * Structure representing a call log. |
|---|
| 215 | * |
|---|
| 216 | * @ingroup call_logs |
|---|
| 217 | * |
|---|
| 218 | **/ |
|---|
| 219 | typedef struct _LinphoneCallLog{ |
|---|
| 220 | LinphoneCallDir dir; /**< The direction of the call*/ |
|---|
| 221 | LinphoneCallStatus status; /**< The status of the call*/ |
|---|
| 222 | LinphoneAddress *from; /**<Originator of the call as a LinphoneAddress object*/ |
|---|
| 223 | LinphoneAddress *to; /**<Destination of the call as a LinphoneAddress object*/ |
|---|
| 224 | char start_date[128]; /**<Human readable string containg the start date*/ |
|---|
| 225 | int duration; /**<Duration of the call in seconds*/ |
|---|
| 226 | char *refkey; |
|---|
| 227 | void *user_pointer; |
|---|
| 228 | struct _LinphoneCore *lc; |
|---|
| 229 | } LinphoneCallLog; |
|---|
| 230 | |
|---|
| 231 | |
|---|
| 232 | |
|---|
| 233 | /*public: */ |
|---|
| 234 | void linphone_call_log_set_user_pointer(LinphoneCallLog *cl, void *up); |
|---|
| 235 | void *linphone_call_log_get_user_pointer(const LinphoneCallLog *cl); |
|---|
| 236 | void linphone_call_log_set_ref_key(LinphoneCallLog *cl, const char *refkey); |
|---|
| 237 | const char *linphone_call_log_get_ref_key(const LinphoneCallLog *cl); |
|---|
| 238 | char * linphone_call_log_to_str(LinphoneCallLog *cl); |
|---|
| 239 | |
|---|
| 240 | typedef enum{ |
|---|
| 241 | LinphoneSPWait, |
|---|
| 242 | LinphoneSPDeny, |
|---|
| 243 | LinphoneSPAccept |
|---|
| 244 | }LinphoneSubscribePolicy; |
|---|
| 245 | |
|---|
| 246 | typedef enum _LinphoneOnlineStatus{ |
|---|
| 247 | LINPHONE_STATUS_UNKNOWN, |
|---|
| 248 | LINPHONE_STATUS_ONLINE, |
|---|
| 249 | LINPHONE_STATUS_BUSY, |
|---|
| 250 | LINPHONE_STATUS_BERIGHTBACK, |
|---|
| 251 | LINPHONE_STATUS_AWAY, |
|---|
| 252 | LINPHONE_STATUS_ONTHEPHONE, |
|---|
| 253 | LINPHONE_STATUS_OUTTOLUNCH, |
|---|
| 254 | LINPHONE_STATUS_NOT_DISTURB, |
|---|
| 255 | LINPHONE_STATUS_MOVED, |
|---|
| 256 | LINPHONE_STATUS_ALT_SERVICE, |
|---|
| 257 | LINPHONE_STATUS_OFFLINE, |
|---|
| 258 | LINPHONE_STATUS_PENDING, |
|---|
| 259 | LINPHONE_STATUS_CLOSED, |
|---|
| 260 | LINPHONE_STATUS_END |
|---|
| 261 | }LinphoneOnlineStatus; |
|---|
| 262 | |
|---|
| 263 | const char *linphone_online_status_to_string(LinphoneOnlineStatus ss); |
|---|
| 264 | |
|---|
| 265 | typedef struct _LinphoneFriend{ |
|---|
| 266 | LinphoneAddress *uri; |
|---|
| 267 | int in_did; |
|---|
| 268 | int out_did; |
|---|
| 269 | int sid; |
|---|
| 270 | int nid; |
|---|
| 271 | LinphoneSubscribePolicy pol; |
|---|
| 272 | LinphoneOnlineStatus status; |
|---|
| 273 | struct _LinphoneProxyConfig *proxy; |
|---|
| 274 | struct _LinphoneCore *lc; |
|---|
| 275 | BuddyInfo *info; |
|---|
| 276 | char *refkey; |
|---|
| 277 | bool_t subscribe; |
|---|
| 278 | bool_t inc_subscribe_pending; |
|---|
| 279 | }LinphoneFriend; |
|---|
| 280 | |
|---|
| 281 | LinphoneFriend * linphone_friend_new(); |
|---|
| 282 | LinphoneFriend *linphone_friend_new_with_addr(const char *addr); |
|---|
| 283 | int linphone_friend_set_sip_addr(LinphoneFriend *fr, const char *uri); |
|---|
| 284 | int linphone_friend_set_name(LinphoneFriend *fr, const char *name); |
|---|
| 285 | int linphone_friend_send_subscribe(LinphoneFriend *fr, bool_t val); |
|---|
| 286 | int linphone_friend_set_inc_subscribe_policy(LinphoneFriend *fr, LinphoneSubscribePolicy pol); |
|---|
| 287 | int linphone_friend_set_proxy(LinphoneFriend *fr, struct _LinphoneProxyConfig *cfg); |
|---|
| 288 | void linphone_friend_edit(LinphoneFriend *fr); |
|---|
| 289 | void linphone_friend_done(LinphoneFriend *fr); |
|---|
| 290 | void linphone_friend_destroy(LinphoneFriend *lf); |
|---|
| 291 | const LinphoneAddress *linphone_friend_get_uri(const LinphoneFriend *lf); |
|---|
| 292 | bool_t linphone_friend_get_send_subscribe(const LinphoneFriend *lf); |
|---|
| 293 | LinphoneSubscribePolicy linphone_friend_get_inc_subscribe_policy(const LinphoneFriend *lf); |
|---|
| 294 | LinphoneOnlineStatus linphone_friend_get_status(const LinphoneFriend *lf); |
|---|
| 295 | BuddyInfo * linphone_friend_get_info(const LinphoneFriend *lf); |
|---|
| 296 | void linphone_friend_set_ref_key(LinphoneFriend *lf, const char *key); |
|---|
| 297 | const char *linphone_friend_get_ref_key(const LinphoneFriend *lf); |
|---|
| 298 | #define linphone_friend_in_list(lf) ((lf)->lc!=NULL) |
|---|
| 299 | |
|---|
| 300 | #define linphone_friend_url(lf) ((lf)->url) |
|---|
| 301 | |
|---|
| 302 | /** |
|---|
| 303 | * @addtogroup proxies |
|---|
| 304 | * @{ |
|---|
| 305 | **/ |
|---|
| 306 | /** |
|---|
| 307 | * The LinphoneProxyConfig object represents a proxy configuration to be used |
|---|
| 308 | * by the LinphoneCore object. |
|---|
| 309 | * Its fields must not be used directly in favour of the accessors methods. |
|---|
| 310 | * Once created and filled properly the LinphoneProxyConfig can be given to |
|---|
| 311 | * LinphoneCore with linphone_core_add_proxy_config(). |
|---|
| 312 | * This will automatically triggers the registration, if enabled. |
|---|
| 313 | * |
|---|
| 314 | * The proxy configuration are persistent to restarts because they are saved |
|---|
| 315 | * in the configuration file. As a consequence, after linphone_core_new() there |
|---|
| 316 | * might already be a list of configured proxy that can be examined with |
|---|
| 317 | * linphone_core_get_proxy_config_list(). |
|---|
| 318 | * |
|---|
| 319 | * The default proxy (see linphone_core_set_default_proxy() ) is the one of the list |
|---|
| 320 | * that is used by default for calls. |
|---|
| 321 | **/ |
|---|
| 322 | typedef struct _LinphoneProxyConfig |
|---|
| 323 | { |
|---|
| 324 | struct _LinphoneCore *lc; |
|---|
| 325 | char *reg_proxy; |
|---|
| 326 | char *reg_identity; |
|---|
| 327 | char *reg_route; |
|---|
| 328 | char *realm; |
|---|
| 329 | int expires; |
|---|
| 330 | int reg_time; |
|---|
| 331 | int rid; |
|---|
| 332 | char *type; |
|---|
| 333 | struct _SipSetupContext *ssctx; |
|---|
| 334 | int auth_failures; |
|---|
| 335 | char *contact_addr; /* our IP address as seen by the proxy, read from via 's received= parameter*/ |
|---|
| 336 | int contact_port; /*our IP port as seen by the proxy, read from via's rport= parameter */ |
|---|
| 337 | bool_t commit; |
|---|
| 338 | bool_t reg_sendregister; |
|---|
| 339 | bool_t registered; |
|---|
| 340 | bool_t publish; |
|---|
| 341 | } LinphoneProxyConfig; |
|---|
| 342 | |
|---|
| 343 | LinphoneProxyConfig *linphone_proxy_config_new(void); |
|---|
| 344 | int linphone_proxy_config_set_server_addr(LinphoneProxyConfig *obj, const char *server_addr); |
|---|
| 345 | void linphone_proxy_config_set_identity(LinphoneProxyConfig *obj, const char *identity); |
|---|
| 346 | void linphone_proxy_config_set_route(LinphoneProxyConfig *obj, const char *route); |
|---|
| 347 | void linphone_proxy_config_expires(LinphoneProxyConfig *obj, const int expires); |
|---|
| 348 | void linphone_proxy_config_enable_register(LinphoneProxyConfig *obj, bool_t val); |
|---|
| 349 | #define linphone_proxy_config_enableregister linphone_proxy_config_enable_register |
|---|
| 350 | void linphone_proxy_config_edit(LinphoneProxyConfig *obj); |
|---|
| 351 | int linphone_proxy_config_done(LinphoneProxyConfig *obj); |
|---|
| 352 | void linphone_proxy_config_enable_publish(LinphoneProxyConfig *obj, bool_t val); |
|---|
| 353 | bool_t linphone_proxy_config_is_registered(const LinphoneProxyConfig *obj); |
|---|
| 354 | const char *linphone_proxy_config_get_domain(const LinphoneProxyConfig *cfg); |
|---|
| 355 | |
|---|
| 356 | /** Returns the proxy configured identity as a const char * */ |
|---|
| 357 | #define linphone_proxy_config_get_route(obj) ((obj)->reg_route) |
|---|
| 358 | /** Returns the proxy configured identity as a const char * */ |
|---|
| 359 | #define linphone_proxy_config_get_identity(obj) ((obj)->reg_identity) |
|---|
| 360 | #define linphone_proxy_config_publish_enabled(obj) ((obj)->publish) |
|---|
| 361 | /** Returns the proxy sip address as const char * */ |
|---|
| 362 | #define linphone_proxy_config_get_addr(obj) ((obj)->reg_proxy) |
|---|
| 363 | /** Returns the 'expire' time of the registration */ |
|---|
| 364 | #define linphone_proxy_config_get_expires(obj) ((obj)->expires) |
|---|
| 365 | /** Returns TRUE if registration is enabled, FALSE otherwise */ |
|---|
| 366 | #define linphone_proxy_config_register_enabled(obj) ((obj)->reg_sendregister) |
|---|
| 367 | #define linphone_proxy_config_get_core(obj) ((obj)->lc) |
|---|
| 368 | /* destruction is called automatically when removing the proxy config */ |
|---|
| 369 | void linphone_proxy_config_destroy(LinphoneProxyConfig *cfg); |
|---|
| 370 | void linphone_proxy_config_set_sip_setup(LinphoneProxyConfig *cfg, const char *type); |
|---|
| 371 | SipSetupContext *linphone_proxy_config_get_sip_setup_context(LinphoneProxyConfig *cfg); |
|---|
| 372 | SipSetup *linphone_proxy_config_get_sip_setup(LinphoneProxyConfig *cfg); |
|---|
| 373 | |
|---|
| 374 | /** |
|---|
| 375 | * @} |
|---|
| 376 | **/ |
|---|
| 377 | |
|---|
| 378 | typedef struct _LinphoneAccountCreator{ |
|---|
| 379 | struct _LinphoneCore *lc; |
|---|
| 380 | struct _SipSetupContext *ssctx; |
|---|
| 381 | char *username; |
|---|
| 382 | char *password; |
|---|
| 383 | char *domain; |
|---|
| 384 | bool_t succeeded; |
|---|
| 385 | }LinphoneAccountCreator; |
|---|
| 386 | |
|---|
| 387 | LinphoneAccountCreator *linphone_account_creator_new(struct _LinphoneCore *core, const char *type); |
|---|
| 388 | void linphone_account_creator_set_username(LinphoneAccountCreator *obj, const char *username); |
|---|
| 389 | void linphone_account_creator_set_password(LinphoneAccountCreator *obj, const char *password); |
|---|
| 390 | void linphone_account_creator_set_domain(LinphoneAccountCreator *obj, const char *domain); |
|---|
| 391 | const char * linphone_account_creator_get_username(LinphoneAccountCreator *obj); |
|---|
| 392 | const char * linphone_account_creator_get_domain(LinphoneAccountCreator *obj); |
|---|
| 393 | int linphone_account_creator_test_existence(LinphoneAccountCreator *obj); |
|---|
| 394 | LinphoneProxyConfig * linphone_account_creator_validate(LinphoneAccountCreator *obj); |
|---|
| 395 | void linphone_account_creator_destroy(LinphoneAccountCreator *obj); |
|---|
| 396 | |
|---|
| 397 | /** |
|---|
| 398 | * @ingroup authentication |
|---|
| 399 | * Object holding authentication information. |
|---|
| 400 | * |
|---|
| 401 | * @note The object's fields should not be accessed directly. Prefer using |
|---|
| 402 | * the accessor methods. |
|---|
| 403 | * |
|---|
| 404 | * In most case, authentication information consists of a username and password. |
|---|
| 405 | * Sometimes, a userid is required by proxy, and realm can be useful to discriminate |
|---|
| 406 | * different SIP domains. |
|---|
| 407 | * |
|---|
| 408 | * Once created and filled, a LinphoneAuthInfo must be added to the LinphoneCore in |
|---|
| 409 | * order to become known and used automatically when needed. |
|---|
| 410 | * Use linphone_core_add_auth_info() for that purpose. |
|---|
| 411 | * |
|---|
| 412 | * The LinphoneCore object can take the initiative to request authentication information |
|---|
| 413 | * when needed to the application through the auth_info_requested callback of the |
|---|
| 414 | * LinphoneCoreVTable structure. |
|---|
| 415 | * |
|---|
| 416 | * The application can respond to this information request later using |
|---|
| 417 | * linphone_core_add_auth_info(). This will unblock all pending authentication |
|---|
| 418 | * transactions and retry them with authentication headers. |
|---|
| 419 | * |
|---|
| 420 | **/ |
|---|
| 421 | typedef struct _LinphoneAuthInfo |
|---|
| 422 | { |
|---|
| 423 | char *username; |
|---|
| 424 | char *realm; |
|---|
| 425 | char *userid; |
|---|
| 426 | char *passwd; |
|---|
| 427 | char *ha1; |
|---|
| 428 | bool_t works; |
|---|
| 429 | bool_t first_time; |
|---|
| 430 | }LinphoneAuthInfo; |
|---|
| 431 | |
|---|
| 432 | LinphoneAuthInfo *linphone_auth_info_new(const char *username, const char *userid, |
|---|
| 433 | const char *passwd, const char *ha1,const char *realm); |
|---|
| 434 | void linphone_auth_info_set_passwd(LinphoneAuthInfo *info, const char *passwd); |
|---|
| 435 | void linphone_auth_info_set_username(LinphoneAuthInfo *info, const char *username); |
|---|
| 436 | void linphone_auth_info_set_userid(LinphoneAuthInfo *info, const char *userid); |
|---|
| 437 | /* you don't need those function*/ |
|---|
| 438 | void linphone_auth_info_destroy(LinphoneAuthInfo *info); |
|---|
| 439 | LinphoneAuthInfo * linphone_auth_info_new_from_config_file(struct _LpConfig *config, int pos); |
|---|
| 440 | |
|---|
| 441 | struct _LinphoneChatRoom{ |
|---|
| 442 | struct _LinphoneCore *lc; |
|---|
| 443 | char *peer; |
|---|
| 444 | char *route; |
|---|
| 445 | LinphoneAddress *peer_url; |
|---|
| 446 | void * user_data; |
|---|
| 447 | }; |
|---|
| 448 | typedef struct _LinphoneChatRoom LinphoneChatRoom; |
|---|
| 449 | |
|---|
| 450 | LinphoneChatRoom * linphone_core_create_chat_room(struct _LinphoneCore *lc, const char *to); |
|---|
| 451 | void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg); |
|---|
| 452 | void linphone_chat_room_destroy(LinphoneChatRoom *cr); |
|---|
| 453 | void linphone_chat_room_set_user_data(LinphoneChatRoom *cr, void * ud); |
|---|
| 454 | void * linphone_chat_room_get_user_data(LinphoneChatRoom *cr); |
|---|
| 455 | |
|---|
| 456 | /* describes the different groups of states */ |
|---|
| 457 | typedef enum _gstate_group { |
|---|
| 458 | GSTATE_GROUP_POWER, |
|---|
| 459 | GSTATE_GROUP_REG, |
|---|
| 460 | GSTATE_GROUP_CALL |
|---|
| 461 | } gstate_group_t; |
|---|
| 462 | |
|---|
| 463 | typedef enum _gstate { |
|---|
| 464 | /* states for GSTATE_GROUP_POWER */ |
|---|
| 465 | GSTATE_POWER_OFF = 0, /* initial state */ |
|---|
| 466 | GSTATE_POWER_STARTUP, |
|---|
| 467 | GSTATE_POWER_ON, |
|---|
| 468 | GSTATE_POWER_SHUTDOWN, |
|---|
| 469 | /* states for GSTATE_GROUP_REG */ |
|---|
| 470 | GSTATE_REG_NONE = 10, /* initial state */ |
|---|
| 471 | GSTATE_REG_OK, |
|---|
| 472 | GSTATE_REG_FAILED, |
|---|
| 473 | /* states for GSTATE_GROUP_CALL */ |
|---|
| 474 | GSTATE_CALL_IDLE = 20, /* initial state */ |
|---|
| 475 | GSTATE_CALL_OUT_INVITE, |
|---|
| 476 | GSTATE_CALL_OUT_CONNECTED, |
|---|
| 477 | GSTATE_CALL_IN_INVITE, |
|---|
| 478 | GSTATE_CALL_IN_CONNECTED, |
|---|
| 479 | GSTATE_CALL_END, |
|---|
| 480 | GSTATE_CALL_ERROR, |
|---|
| 481 | GSTATE_INVALID |
|---|
| 482 | } gstate_t; |
|---|
| 483 | |
|---|
| 484 | struct _LinphoneGeneralState { |
|---|
| 485 | gstate_t old_state; |
|---|
| 486 | gstate_t new_state; |
|---|
| 487 | gstate_group_t group; |
|---|
| 488 | const char *message; |
|---|
| 489 | }; |
|---|
| 490 | typedef struct _LinphoneGeneralState LinphoneGeneralState; |
|---|
| 491 | |
|---|
| 492 | /* private: set a new state */ |
|---|
| 493 | void gstate_new_state(struct _LinphoneCore *lc, gstate_t new_state, const char *message); |
|---|
| 494 | /*private*/ |
|---|
| 495 | void gstate_initialize(struct _LinphoneCore *lc) ; |
|---|
| 496 | |
|---|
| 497 | /** |
|---|
| 498 | * @addtogroup initializing |
|---|
| 499 | * @{ |
|---|
| 500 | **/ |
|---|
| 501 | |
|---|
| 502 | /** Callback prototype */ |
|---|
| 503 | typedef void (*ShowInterfaceCb)(struct _LinphoneCore *lc); |
|---|
| 504 | /** Callback prototype */ |
|---|
| 505 | typedef void (*InviteReceivedCb)(struct _LinphoneCore *lc, const char *from); |
|---|
| 506 | /** Callback prototype */ |
|---|
| 507 | typedef void (*ByeReceivedCb)(struct _LinphoneCore *lc, const char *from); |
|---|
| 508 | /** Callback prototype */ |
|---|
| 509 | typedef void (*DisplayStatusCb)(struct _LinphoneCore *lc, const char *message); |
|---|
| 510 | /** Callback prototype */ |
|---|
| 511 | typedef void (*DisplayMessageCb)(struct _LinphoneCore *lc, const char *message); |
|---|
| 512 | /** Callback prototype */ |
|---|
| 513 | typedef void (*DisplayUrlCb)(struct _LinphoneCore *lc, const char *message, const char *url); |
|---|
| 514 | /** Callback prototype */ |
|---|
| 515 | typedef void (*DisplayQuestionCb)(struct _LinphoneCore *lc, const char *message); |
|---|
| 516 | /** Callback prototype */ |
|---|
| 517 | typedef void (*LinphoneCoreCbFunc)(struct _LinphoneCore *lc,void * user_data); |
|---|
| 518 | /** Callback prototype */ |
|---|
| 519 | typedef void (*NotifyReceivedCb)(struct _LinphoneCore *lc, LinphoneFriend * fid, const char *url, const char *status, const char *img); |
|---|
| 520 | /** Callback prototype */ |
|---|
| 521 | typedef void (*NewUnknownSubscriberCb)(struct _LinphoneCore *lc, LinphoneFriend *lf, const char *url); |
|---|
| 522 | /** Callback prototype */ |
|---|
| 523 | typedef void (*AuthInfoRequested)(struct _LinphoneCore *lc, const char *realm, const char *username); |
|---|
| 524 | /** Callback prototype */ |
|---|
| 525 | typedef void (*CallLogUpdated)(struct _LinphoneCore *lc, struct _LinphoneCallLog *newcl); |
|---|
| 526 | /** Callback prototype */ |
|---|
| 527 | typedef void (*TextMessageReceived)(struct _LinphoneCore *lc, LinphoneChatRoom *room, const char *from, const char *message); |
|---|
| 528 | /** Callback prototype */ |
|---|
| 529 | typedef void (*GeneralStateChange)(struct _LinphoneCore *lc, LinphoneGeneralState *gstate); |
|---|
| 530 | /** Callback prototype */ |
|---|
| 531 | typedef void (*DtmfReceived)(struct _LinphoneCore* lc, int dtmf); |
|---|
| 532 | /** Callback prototype */ |
|---|
| 533 | typedef void (*ReferReceived)(struct _LinphoneCore *lc, const char *refer_to); |
|---|
| 534 | /** Callback prototype */ |
|---|
| 535 | typedef void (*BuddyInfoUpdated)(struct _LinphoneCore *lc, LinphoneFriend *lf); |
|---|
| 536 | |
|---|
| 537 | /** |
|---|
| 538 | * This structure holds all callbacks that the application should implement. |
|---|
| 539 | * |
|---|
| 540 | **/ |
|---|
| 541 | typedef struct _LinphoneVTable |
|---|
| 542 | { |
|---|
| 543 | ShowInterfaceCb show; /**< Notifies the application that it should show up*/ |
|---|
| 544 | InviteReceivedCb inv_recv; /**< Notifies incoming calls */ |
|---|
| 545 | ByeReceivedCb bye_recv; /**< Notify calls terminated by far end*/ |
|---|
| 546 | NotifyReceivedCb notify_recv; /**< Notify received presence events*/ |
|---|
| 547 | NewUnknownSubscriberCb new_unknown_subscriber; /**< Notify about unknown subscriber */ |
|---|
| 548 | AuthInfoRequested auth_info_requested; /**< Ask the application some authentication information */ |
|---|
| 549 | DisplayStatusCb display_status; /**< Callback that notifies various events with human readable text.*/ |
|---|
| 550 | DisplayMessageCb display_message;/**< Callback to display a message to the user */ |
|---|
| 551 | #ifdef VINCENT_MAURY_RSVP |
|---|
| 552 | /* the yes/no dialog box */ |
|---|
| 553 | DisplayMessageCb display_yes_no; |
|---|
| 554 | #endif |
|---|
| 555 | DisplayMessageCb display_warning;/** Callback to display a warning to the user */ |
|---|
| 556 | DisplayUrlCb display_url; |
|---|
| 557 | DisplayQuestionCb display_question; |
|---|
| 558 | CallLogUpdated call_log_updated; /**< Notifies that call log list has been updated */ |
|---|
| 559 | TextMessageReceived text_received; /**< A text message has been received */ |
|---|
| 560 | GeneralStateChange general_state; /**< State notification callback */ |
|---|
| 561 | DtmfReceived dtmf_received; /**< A dtmf has been received received */ |
|---|
| 562 | ReferReceived refer_received; /**< A refer was received */ |
|---|
| 563 | BuddyInfoUpdated buddy_info_updated; /**< a LinphoneFriend's BuddyInfo has changed*/ |
|---|
| 564 | } LinphoneCoreVTable; |
|---|
| 565 | |
|---|
| 566 | /** |
|---|
| 567 | * @} |
|---|
| 568 | **/ |
|---|
| 569 | |
|---|
| 570 | typedef struct _LCCallbackObj |
|---|
| 571 | { |
|---|
| 572 | LinphoneCoreCbFunc _func; |
|---|
| 573 | void * _user_data; |
|---|
| 574 | }LCCallbackObj; |
|---|
| 575 | |
|---|
| 576 | |
|---|
| 577 | |
|---|
| 578 | typedef enum _LinphoneFirewallPolicy{ |
|---|
| 579 | LINPHONE_POLICY_NO_FIREWALL, |
|---|
| 580 | LINPHONE_POLICY_USE_NAT_ADDRESS, |
|---|
| 581 | LINPHONE_POLICY_USE_STUN |
|---|
| 582 | } LinphoneFirewallPolicy; |
|---|
| 583 | |
|---|
| 584 | typedef enum _LinphoneWaitingState{ |
|---|
| 585 | LinphoneWaitingStart, |
|---|
| 586 | LinphoneWaitingProgress, |
|---|
| 587 | LinphoneWaitingFinished |
|---|
| 588 | } LinphoneWaitingState; |
|---|
| 589 | typedef void * (*LinphoneWaitingCallback)(struct _LinphoneCore *lc, void *context, LinphoneWaitingState ws, const char *purpose, float progress); |
|---|
| 590 | |
|---|
| 591 | |
|---|
| 592 | typedef struct _LinphoneCore |
|---|
| 593 | { |
|---|
| 594 | LinphoneCoreVTable vtable; |
|---|
| 595 | struct _LpConfig *config; |
|---|
| 596 | net_config_t net_conf; |
|---|
| 597 | sip_config_t sip_conf; |
|---|
| 598 | rtp_config_t rtp_conf; |
|---|
| 599 | sound_config_t sound_conf; |
|---|
| 600 | video_config_t video_conf; |
|---|
| 601 | codecs_config_t codecs_conf; |
|---|
| 602 | ui_config_t ui_conf; |
|---|
| 603 | autoreplier_config_t autoreplier_conf; |
|---|
| 604 | LinphoneProxyConfig *default_proxy; |
|---|
| 605 | MSList *friends; |
|---|
| 606 | MSList *auth_info; |
|---|
| 607 | struct _RingStream *ringstream; |
|---|
| 608 | LCCallbackObj preview_finished_cb; |
|---|
| 609 | bool_t preview_finished; |
|---|
| 610 | struct _LinphoneCall *call; /* the current call, in the future it will be a list of calls (conferencing)*/ |
|---|
| 611 | int rid; /*registration id*/ |
|---|
| 612 | MSList *queued_calls; /* used by the autoreplier */ |
|---|
| 613 | MSList *call_logs; |
|---|
| 614 | MSList *chatrooms; |
|---|
| 615 | int max_call_logs; |
|---|
| 616 | int missed_calls; |
|---|
| 617 | struct _AudioStream *audiostream; /**/ |
|---|
| 618 | struct _VideoStream *videostream; |
|---|
| 619 | struct _VideoStream *previewstream; |
|---|
| 620 | RtpTransport *a_rtp,*a_rtcp; |
|---|
| 621 | struct _RtpProfile *local_profile; |
|---|
| 622 | MSList *bl_reqs; |
|---|
| 623 | MSList *subscribers; /* unknown subscribers */ |
|---|
| 624 | int minutes_away; |
|---|
| 625 | LinphoneOnlineStatus presence_mode; |
|---|
| 626 | LinphoneOnlineStatus prev_mode; |
|---|
| 627 | char *alt_contact; |
|---|
| 628 | void *data; |
|---|
| 629 | ms_mutex_t lock; |
|---|
| 630 | char *play_file; |
|---|
| 631 | char *rec_file; |
|---|
| 632 | time_t prevtime; |
|---|
| 633 | int dw_audio_bw; |
|---|
| 634 | int up_audio_bw; |
|---|
| 635 | int dw_video_bw; |
|---|
| 636 | int up_video_bw; |
|---|
| 637 | int audio_bw; |
|---|
| 638 | int automatic_action; |
|---|
| 639 | gstate_t gstate_power; |
|---|
| 640 | gstate_t gstate_reg; |
|---|
| 641 | gstate_t gstate_call; |
|---|
| 642 | LinphoneWaitingCallback wait_cb; |
|---|
| 643 | void *wait_ctx; |
|---|
| 644 | bool_t use_files; |
|---|
| 645 | bool_t apply_nat_settings; |
|---|
| 646 | bool_t ready; |
|---|
| 647 | bool_t bl_refresh; |
|---|
| 648 | #ifdef VINCENT_MAURY_RSVP |
|---|
| 649 | /* QoS parameters*/ |
|---|
| 650 | int rsvp_enable; |
|---|
| 651 | int rpc_enable; |
|---|
| 652 | #endif |
|---|
| 653 | } LinphoneCore; |
|---|
| 654 | |
|---|
| 655 | |
|---|
| 656 | |
|---|
| 657 | /* THE main API */ |
|---|
| 658 | |
|---|
| 659 | void linphone_core_enable_logs(FILE *file); |
|---|
| 660 | void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc); |
|---|
| 661 | void linphone_core_disable_logs(void); |
|---|
| 662 | /*sets the user-agent string in sip messages, must be set before linphone_core_new() or linphone_core_init() */ |
|---|
| 663 | void linphone_core_set_user_agent(const char *ua_name, const char *version); |
|---|
| 664 | const char *linphone_core_get_version(void); |
|---|
| 665 | |
|---|
| 666 | LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable, |
|---|
| 667 | const char *config_path, const char *factory_config, void* userdata); |
|---|
| 668 | |
|---|
| 669 | /* function to be periodically called in a main loop */ |
|---|
| 670 | void linphone_core_iterate(LinphoneCore *lc); |
|---|
| 671 | |
|---|
| 672 | int linphone_core_invite(LinphoneCore *lc, const char *url); |
|---|
| 673 | |
|---|
| 674 | int linphone_core_refer(LinphoneCore *lc, const char *url); |
|---|
| 675 | |
|---|
| 676 | bool_t linphone_core_inc_invite_pending(LinphoneCore*lc); |
|---|
| 677 | |
|---|
| 678 | bool_t linphone_core_in_call(const LinphoneCore *lc); |
|---|
| 679 | |
|---|
| 680 | int linphone_core_accept_call(LinphoneCore *lc, const char *url); |
|---|
| 681 | |
|---|
| 682 | int linphone_core_terminate_call(LinphoneCore *lc, const char *url); |
|---|
| 683 | |
|---|
| 684 | void linphone_core_send_dtmf(LinphoneCore *lc,char dtmf); |
|---|
| 685 | |
|---|
| 686 | int linphone_core_set_primary_contact(LinphoneCore *lc, const char *contact); |
|---|
| 687 | |
|---|
| 688 | const char *linphone_core_get_primary_contact(LinphoneCore *lc); |
|---|
| 689 | |
|---|
| 690 | void linphone_core_set_guess_hostname(LinphoneCore *lc, bool_t val); |
|---|
| 691 | bool_t linphone_core_get_guess_hostname(LinphoneCore *lc); |
|---|
| 692 | |
|---|
| 693 | bool_t linphone_core_ipv6_enabled(LinphoneCore *lc); |
|---|
| 694 | void linphone_core_enable_ipv6(LinphoneCore *lc, bool_t val); |
|---|
| 695 | |
|---|
| 696 | LinphoneAddress *linphone_core_get_primary_contact_parsed(LinphoneCore *lc); |
|---|
| 697 | |
|---|
| 698 | /*0= no bandwidth limit*/ |
|---|
| 699 | void linphone_core_set_download_bandwidth(LinphoneCore *lc, int bw); |
|---|
| 700 | void linphone_core_set_upload_bandwidth(LinphoneCore *lc, int bw); |
|---|
| 701 | |
|---|
| 702 | int linphone_core_get_download_bandwidth(const LinphoneCore *lc); |
|---|
| 703 | int linphone_core_get_upload_bandwidth(const LinphoneCore *lc); |
|---|
| 704 | |
|---|
| 705 | |
|---|
| 706 | #ifdef VINCENT_MAURY_RSVP |
|---|
| 707 | /* QoS functions */ |
|---|
| 708 | int linphone_core_set_rpc_mode(LinphoneCore *lc, int on); /* on = 1 (RPC_ENABLE = 1) */ |
|---|
| 709 | int linphone_core_set_rsvp_mode(LinphoneCore *lc, int on); /* on = 1 (RSVP_ENABLE = 1) */ |
|---|
| 710 | int linphone_core_change_qos(LinphoneCore *lc, int answer); /* answer = 1 for yes, 0 for no */ |
|---|
| 711 | #endif |
|---|
| 712 | |
|---|
| 713 | /* returns a MSList of PayloadType */ |
|---|
| 714 | const MSList *linphone_core_get_audio_codecs(const LinphoneCore *lc); |
|---|
| 715 | |
|---|
| 716 | int linphone_core_set_audio_codecs(LinphoneCore *lc, MSList *codecs); |
|---|
| 717 | /* returns a MSList of PayloadType */ |
|---|
| 718 | const MSList *linphone_core_get_video_codecs(const LinphoneCore *lc); |
|---|
| 719 | |
|---|
| 720 | int linphone_core_set_video_codecs(LinphoneCore *lc, MSList *codecs); |
|---|
| 721 | |
|---|
| 722 | bool_t linphone_core_check_payload_type_usability(LinphoneCore *lc, PayloadType *pt); |
|---|
| 723 | |
|---|
| 724 | int linphone_core_add_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *config); |
|---|
| 725 | |
|---|
| 726 | void linphone_core_remove_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *config); |
|---|
| 727 | |
|---|
| 728 | const MSList *linphone_core_get_proxy_config_list(const LinphoneCore *lc); |
|---|
| 729 | |
|---|
| 730 | void linphone_core_set_default_proxy(LinphoneCore *lc, LinphoneProxyConfig *config); |
|---|
| 731 | |
|---|
| 732 | void linphone_core_set_default_proxy_index(LinphoneCore *lc, int index); |
|---|
| 733 | |
|---|
| 734 | int linphone_core_get_default_proxy(LinphoneCore *lc, LinphoneProxyConfig **config); |
|---|
| 735 | |
|---|
| 736 | void linphone_core_add_auth_info(LinphoneCore *lc, LinphoneAuthInfo *info); |
|---|
| 737 | |
|---|
| 738 | void linphone_core_remove_auth_info(LinphoneCore *lc, LinphoneAuthInfo *info); |
|---|
| 739 | |
|---|
| 740 | const MSList *linphone_core_get_auth_info_list(const LinphoneCore *lc); |
|---|
| 741 | |
|---|
| 742 | LinphoneAuthInfo *linphone_core_find_auth_info(LinphoneCore *lc, const char *realm, const char *username); |
|---|
| 743 | |
|---|
| 744 | void linphone_core_abort_authentication(LinphoneCore *lc, LinphoneAuthInfo *info); |
|---|
| 745 | |
|---|
| 746 | void linphone_core_clear_all_auth_info(LinphoneCore *lc); |
|---|
| 747 | |
|---|
| 748 | int linphone_core_get_audio_jittcomp(LinphoneCore *lc); |
|---|
| 749 | |
|---|
| 750 | void linphone_core_set_audio_jittcomp(LinphoneCore *lc, int value); |
|---|
| 751 | |
|---|
| 752 | int linphone_core_get_audio_port(const LinphoneCore *lc); |
|---|
| 753 | |
|---|
| 754 | int linphone_core_get_video_port(const LinphoneCore *lc); |
|---|
| 755 | |
|---|
| 756 | int linphone_core_get_nortp_timeout(const LinphoneCore *lc); |
|---|
| 757 | |
|---|
| 758 | void linphone_core_set_audio_port(LinphoneCore *lc, int port); |
|---|
| 759 | |
|---|
| 760 | void linphone_core_set_video_port(LinphoneCore *lc, int port); |
|---|
| 761 | |
|---|
| 762 | void linphone_core_set_nortp_timeout(LinphoneCore *lc, int port); |
|---|
| 763 | |
|---|
| 764 | void linphone_core_set_use_info_for_dtmf(LinphoneCore *lc, bool_t use_info); |
|---|
| 765 | |
|---|
| 766 | bool_t linphone_core_get_use_info_for_dtmf(LinphoneCore *lc); |
|---|
| 767 | |
|---|
| 768 | void linphone_core_set_use_rfc2833_for_dtmf(LinphoneCore *lc,bool_t use_rfc2833); |
|---|
| 769 | |
|---|
| 770 | bool_t linphone_core_get_use_rfc2833_for_dtmf(LinphoneCore *lc); |
|---|
| 771 | |
|---|
| 772 | int linphone_core_get_sip_port(LinphoneCore *lc); |
|---|
| 773 | |
|---|
| 774 | void linphone_core_set_sip_port(LinphoneCore *lc,int port); |
|---|
| 775 | |
|---|
| 776 | void linphone_core_set_inc_timeout(LinphoneCore *lc, int seconds); |
|---|
| 777 | |
|---|
| 778 | int linphone_core_get_inc_timeout(LinphoneCore *lc); |
|---|
| 779 | |
|---|
| 780 | void linphone_core_set_stun_server(LinphoneCore *lc, const char *server); |
|---|
| 781 | |
|---|
| 782 | const char * linphone_core_get_stun_server(const LinphoneCore *lc); |
|---|
| 783 | |
|---|
| 784 | void linphone_core_set_nat_address(LinphoneCore *lc, const char *addr); |
|---|
| 785 | |
|---|
| 786 | const char *linphone_core_get_nat_address(const LinphoneCore *lc); |
|---|
| 787 | |
|---|
| 788 | void linphone_core_set_firewall_policy(LinphoneCore *lc, LinphoneFirewallPolicy pol); |
|---|
| 789 | |
|---|
| 790 | LinphoneFirewallPolicy linphone_core_get_firewall_policy(const LinphoneCore *lc); |
|---|
| 791 | |
|---|
| 792 | const char * linphone_core_get_relay_addr(const LinphoneCore *lc); |
|---|
| 793 | |
|---|
| 794 | int linphone_core_set_relay_addr(LinphoneCore *lc, const char *addr); |
|---|
| 795 | |
|---|
| 796 | /* sound functions */ |
|---|
| 797 | /* returns a null terminated static array of string describing the sound devices */ |
|---|
| 798 | const char** linphone_core_get_sound_devices(LinphoneCore *lc); |
|---|
| 799 | bool_t linphone_core_sound_device_can_capture(LinphoneCore *lc, const char *device); |
|---|
| 800 | bool_t linphone_core_sound_device_can_playback(LinphoneCore *lc, const char *device); |
|---|
| 801 | int linphone_core_get_ring_level(LinphoneCore *lc); |
|---|
| 802 | int linphone_core_get_play_level(LinphoneCore *lc); |
|---|
| 803 | int linphone_core_get_rec_level(LinphoneCore *lc); |
|---|
| 804 | void linphone_core_set_ring_level(LinphoneCore *lc, int level); |
|---|
| 805 | void linphone_core_set_play_level(LinphoneCore *lc, int level); |
|---|
| 806 | void linphone_core_set_rec_level(LinphoneCore *lc, int level); |
|---|
| 807 | const char * linphone_core_get_ringer_device(LinphoneCore *lc); |
|---|
| 808 | const char * linphone_core_get_playback_device(LinphoneCore *lc); |
|---|
| 809 | const char * linphone_core_get_capture_device(LinphoneCore *lc); |
|---|
| 810 | int linphone_core_set_ringer_device(LinphoneCore *lc, const char * devid); |
|---|
| 811 | int linphone_core_set_playback_device(LinphoneCore *lc, const char * devid); |
|---|
| 812 | int linphone_core_set_capture_device(LinphoneCore *lc, const char * devid); |
|---|
| 813 | char linphone_core_get_sound_source(LinphoneCore *lc); |
|---|
| 814 | void linphone_core_set_sound_source(LinphoneCore *lc, char source); |
|---|
| 815 | void linphone_core_set_ring(LinphoneCore *lc, const char *path); |
|---|
| 816 | const char *linphone_core_get_ring(const LinphoneCore *lc); |
|---|
| 817 | void linphone_core_set_ringback(LinphoneCore *lc, const char *path); |
|---|
| 818 | const char * linphone_core_get_ringback(const LinphoneCore *lc); |
|---|
| 819 | int linphone_core_preview_ring(LinphoneCore *lc, const char *ring,LinphoneCoreCbFunc func,void * userdata); |
|---|
| 820 | void linphone_core_enable_echo_cancellation(LinphoneCore *lc, bool_t val); |
|---|
| 821 | bool_t linphone_core_echo_cancellation_enabled(LinphoneCore *lc); |
|---|
| 822 | |
|---|
| 823 | void linphone_core_enable_echo_limiter(LinphoneCore *lc, bool_t val); |
|---|
| 824 | bool_t linphone_core_echo_limiter_enabled(const LinphoneCore *lc); |
|---|
| 825 | |
|---|
| 826 | void linphone_core_enable_agc(LinphoneCore *lc, bool_t val); |
|---|
| 827 | bool_t linphone_core_agc_enabled(const LinphoneCore *lc); |
|---|
| 828 | |
|---|
| 829 | void linphone_core_mute_mic(LinphoneCore *lc, bool_t muted); |
|---|
| 830 | |
|---|
| 831 | void linphone_core_set_presence_info(LinphoneCore *lc,int minutes_away,const char *contact,LinphoneOnlineStatus os); |
|---|
| 832 | |
|---|
| 833 | LinphoneOnlineStatus linphone_core_get_presence_info(const LinphoneCore *lc); |
|---|
| 834 | |
|---|
| 835 | void linphone_core_interpret_friend_uri(LinphoneCore *lc, const char *uri, char **result); |
|---|
| 836 | void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *fr); |
|---|
| 837 | void linphone_core_remove_friend(LinphoneCore *lc, LinphoneFriend *fr); |
|---|
| 838 | void linphone_core_reject_subscriber(LinphoneCore *lc, LinphoneFriend *lf); |
|---|
| 839 | /* a list of LinphoneFriend */ |
|---|
| 840 | const MSList * linphone_core_get_friend_list(const LinphoneCore *lc); |
|---|
| 841 | /* notify all friends that have subscribed */ |
|---|
| 842 | void linphone_core_notify_all_friends(LinphoneCore *lc, LinphoneOnlineStatus os); |
|---|
| 843 | LinphoneFriend *linphone_core_get_friend_by_uri(const LinphoneCore *lc, const char *uri); |
|---|
| 844 | LinphoneFriend *linphone_core_get_friend_by_ref_key(const LinphoneCore *lc, const char *key); |
|---|
| 845 | |
|---|
| 846 | /* returns a list of LinphoneCallLog */ |
|---|
| 847 | const MSList * linphone_core_get_call_logs(LinphoneCore *lc); |
|---|
| 848 | void linphone_core_clear_call_logs(LinphoneCore *lc); |
|---|
| 849 | |
|---|
| 850 | /* video support */ |
|---|
| 851 | void linphone_core_enable_video(LinphoneCore *lc, bool_t vcap_enabled, bool_t display_enabled); |
|---|
| 852 | bool_t linphone_core_video_enabled(LinphoneCore *lc); |
|---|
| 853 | |
|---|
| 854 | typedef struct MSVideoSizeDef{ |
|---|
| 855 | MSVideoSize vsize; |
|---|
| 856 | const char *name; |
|---|
| 857 | }MSVideoSizeDef; |
|---|
| 858 | /* returns a zero terminated table of MSVideoSizeDef*/ |
|---|
| 859 | const MSVideoSizeDef *linphone_core_get_supported_video_sizes(LinphoneCore *lc); |
|---|
| 860 | void linphone_core_set_preferred_video_size(LinphoneCore *lc, MSVideoSize vsize); |
|---|
| 861 | MSVideoSize linphone_core_get_preferred_video_size(LinphoneCore *lc); |
|---|
| 862 | void linphone_core_set_preferred_video_size_by_name(LinphoneCore *lc, const char *name); |
|---|
| 863 | |
|---|
| 864 | void linphone_core_enable_video_preview(LinphoneCore *lc, bool_t val); |
|---|
| 865 | bool_t linphone_core_video_preview_enabled(const LinphoneCore *lc); |
|---|
| 866 | |
|---|
| 867 | void linphone_core_enable_self_view(LinphoneCore *lc, bool_t val); |
|---|
| 868 | bool_t linphone_core_self_view_enabled(const LinphoneCore *lc); |
|---|
| 869 | |
|---|
| 870 | |
|---|
| 871 | /* returns a null terminated static array of string describing the webcams */ |
|---|
| 872 | const char** linphone_core_get_video_devices(const LinphoneCore *lc); |
|---|
| 873 | int linphone_core_set_video_device(LinphoneCore *lc, const char *id); |
|---|
| 874 | const char *linphone_core_get_video_device(const LinphoneCore *lc); |
|---|
| 875 | |
|---|
| 876 | /*function to be used for eventually setting window decorations (icons, title...)*/ |
|---|
| 877 | unsigned long linphone_core_get_native_video_window_id(const LinphoneCore *lc); |
|---|
| 878 | |
|---|
| 879 | |
|---|
| 880 | /*play/record support: use files instead of soundcard*/ |
|---|
| 881 | void linphone_core_use_files(LinphoneCore *lc, bool_t yesno); |
|---|
| 882 | void linphone_core_set_play_file(LinphoneCore *lc, const char *file); |
|---|
| 883 | void linphone_core_set_record_file(LinphoneCore *lc, const char *file); |
|---|
| 884 | |
|---|
| 885 | gstate_t linphone_core_get_state(const LinphoneCore *lc, gstate_group_t group); |
|---|
| 886 | int linphone_core_get_current_call_duration(const LinphoneCore *lc); |
|---|
| 887 | const LinphoneAddress *linphone_core_get_remote_uri(LinphoneCore *lc); |
|---|
| 888 | |
|---|
| 889 | int linphone_core_get_mtu(const LinphoneCore *lc); |
|---|
| 890 | void linphone_core_set_mtu(LinphoneCore *lc, int mtu); |
|---|
| 891 | |
|---|
| 892 | bool_t linphone_core_is_in_main_thread(LinphoneCore *lc); |
|---|
| 893 | |
|---|
| 894 | void *linphone_core_get_user_data(LinphoneCore *lc); |
|---|
| 895 | |
|---|
| 896 | /* returns LpConfig object to read/write to the config file: usefull if you wish to extend |
|---|
| 897 | the config file with your own sections */ |
|---|
| 898 | struct _LpConfig *linphone_core_get_config(LinphoneCore *lc); |
|---|
| 899 | |
|---|
| 900 | /* attempts to wake up another linphone engine already running. |
|---|
| 901 | The "show" callback is called for the other linphone, causing gui to show up. |
|---|
| 902 | call_addr is an optional sip-uri to call immediately after waking up. |
|---|
| 903 | The method returns 0 if an already running linphone was found*/ |
|---|
| 904 | |
|---|
| 905 | int linphone_core_wake_up_possible_already_running_instance( |
|---|
| 906 | const char * config_file, const char * call_addr); |
|---|
| 907 | |
|---|
| 908 | /*set a callback for some blocking operations, it takes you informed of the progress of the operation*/ |
|---|
| 909 | void linphone_core_set_waiting_callback(LinphoneCore *lc, LinphoneWaitingCallback cb, void *user_context); |
|---|
| 910 | |
|---|
| 911 | /*returns the list of registered SipSetup (linphonecore plugins) */ |
|---|
| 912 | const MSList * linphone_core_get_sip_setups(LinphoneCore *lc); |
|---|
| 913 | |
|---|
| 914 | void linphone_core_destroy(LinphoneCore *lc); |
|---|
| 915 | |
|---|
| 916 | /*for advanced users:*/ |
|---|
| 917 | void linphone_core_set_audio_transports(LinphoneCore *lc, RtpTransport *rtp, RtpTransport *rtcp); |
|---|
| 918 | |
|---|
| 919 | /* end of lecacy api */ |
|---|
| 920 | |
|---|
| 921 | /*internal use only */ |
|---|
| 922 | #define linphone_core_lock(lc) ms_mutex_lock(&(lc)->lock) |
|---|
| 923 | #define linphone_core_unlock(lc) ms_mutex_unlock((&lc)->lock) |
|---|
| 924 | void linphone_core_start_media_streams(LinphoneCore *lc, struct _LinphoneCall *call); |
|---|
| 925 | void linphone_core_stop_media_streams(LinphoneCore *lc); |
|---|
| 926 | const char * linphone_core_get_identity(LinphoneCore *lc); |
|---|
| 927 | const char * linphone_core_get_route(LinphoneCore *lc); |
|---|
| 928 | bool_t linphone_core_interpret_url(LinphoneCore *lc, const char *url, LinphoneAddress **real_parsed_url, char **route); |
|---|
| 929 | void linphone_core_start_waiting(LinphoneCore *lc, const char *purpose); |
|---|
| 930 | void linphone_core_update_progress(LinphoneCore *lc, const char *purpose, float progresses); |
|---|
| 931 | void linphone_core_stop_waiting(LinphoneCore *lc); |
|---|
| 932 | |
|---|
| 933 | |
|---|
| 934 | #ifdef __cplusplus |
|---|
| 935 | } |
|---|
| 936 | #endif |
|---|
| 937 | |
|---|
| 938 | #endif |
|---|