Benny Prijono | 268ca61 | 2006-02-07 12:34:11 +0000 | [diff] [blame] | 1 | /* $Id$ */ |
| 2 | /* |
| 3 | * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org> |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (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 __PJSUA_H__ |
| 20 | #define __PJSUA_H__ |
| 21 | |
| 22 | /* Include all PJSIP core headers. */ |
| 23 | #include <pjsip.h> |
| 24 | |
| 25 | /* Include all PJMEDIA headers. */ |
| 26 | #include <pjmedia.h> |
| 27 | |
Benny Prijono | 1f9afba | 2006-02-10 15:57:32 +0000 | [diff] [blame] | 28 | /* Include all PJMEDIA-CODEC headers. */ |
| 29 | #include <pjmedia-codec.h> |
| 30 | |
Benny Prijono | 268ca61 | 2006-02-07 12:34:11 +0000 | [diff] [blame] | 31 | /* Include all PJSIP-UA headers */ |
| 32 | #include <pjsip_ua.h> |
| 33 | |
Benny Prijono | 834aee3 | 2006-02-19 01:38:06 +0000 | [diff] [blame] | 34 | /* Include all PJSIP-SIMPLE headers */ |
| 35 | #include <pjsip_simple.h> |
| 36 | |
Benny Prijono | 268ca61 | 2006-02-07 12:34:11 +0000 | [diff] [blame] | 37 | /* Include all PJLIB-UTIL headers. */ |
| 38 | #include <pjlib-util.h> |
| 39 | |
| 40 | /* Include all PJLIB headers. */ |
| 41 | #include <pjlib.h> |
| 42 | |
| 43 | |
Benny Prijono | 1a01ad3 | 2006-02-07 21:13:28 +0000 | [diff] [blame] | 44 | PJ_BEGIN_DECL |
| 45 | |
Benny Prijono | 632ce71 | 2006-02-09 14:01:40 +0000 | [diff] [blame] | 46 | |
Benny Prijono | f319507 | 2006-02-14 21:15:30 +0000 | [diff] [blame] | 47 | /** |
| 48 | * Max buddies in buddy list. |
| 49 | */ |
Benny Prijono | a91a003 | 2006-02-26 21:23:45 +0000 | [diff] [blame] | 50 | #ifndef PJSUA_MAX_BUDDIES |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 51 | # define PJSUA_MAX_BUDDIES 256 |
Benny Prijono | a91a003 | 2006-02-26 21:23:45 +0000 | [diff] [blame] | 52 | #endif |
| 53 | |
Benny Prijono | f319507 | 2006-02-14 21:15:30 +0000 | [diff] [blame] | 54 | |
Benny Prijono | f04ffdd | 2006-02-21 00:11:18 +0000 | [diff] [blame] | 55 | /** |
| 56 | * Max simultaneous calls. |
| 57 | */ |
Benny Prijono | a91a003 | 2006-02-26 21:23:45 +0000 | [diff] [blame] | 58 | #ifndef PJSUA_MAX_CALLS |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 59 | # define PJSUA_MAX_CALLS 32 |
| 60 | #endif |
| 61 | |
| 62 | |
| 63 | /** |
| 64 | * Max ports in the conference bridge. |
| 65 | */ |
| 66 | #ifndef PJSUA_MAX_CONF_PORTS |
| 67 | # define PJSUA_MAX_CONF_PORTS 254 |
Benny Prijono | a91a003 | 2006-02-26 21:23:45 +0000 | [diff] [blame] | 68 | #endif |
| 69 | |
| 70 | |
| 71 | /** |
Benny Prijono | a91a003 | 2006-02-26 21:23:45 +0000 | [diff] [blame] | 72 | * Maximum accounts. |
| 73 | */ |
| 74 | #ifndef PJSUA_MAX_ACC |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 75 | # define PJSUA_MAX_ACC 8 |
Benny Prijono | a91a003 | 2006-02-26 21:23:45 +0000 | [diff] [blame] | 76 | #endif |
| 77 | |
| 78 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 79 | /** |
| 80 | * Maximum proxies in account. |
| 81 | */ |
| 82 | #ifndef PJSUA_ACC_MAX_PROXIES |
| 83 | # define PJSUA_ACC_MAX_PROXIES 8 |
| 84 | #endif |
| 85 | |
| 86 | /** |
| 87 | * Default registration interval. |
| 88 | */ |
| 89 | #ifndef PJSUA_REG_INTERVAL |
| 90 | # define PJSUA_REG_INTERVAL 55 |
| 91 | #endif |
| 92 | |
| 93 | |
| 94 | /** Account identification */ |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 95 | typedef int pjsua_acc_id; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 96 | |
| 97 | /** Call identification */ |
| 98 | typedef int pjsua_call_id; |
| 99 | |
| 100 | /** SIP transport identification */ |
| 101 | typedef int pjsua_transport_id; |
| 102 | |
| 103 | /** Buddy identification */ |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 104 | typedef int pjsua_buddy_id; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 105 | |
| 106 | /** File player identification */ |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 107 | typedef int pjsua_player_id; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 108 | |
| 109 | /** File recorder identification */ |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 110 | typedef int pjsua_recorder_id; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 111 | |
| 112 | /** Conference port identification */ |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 113 | typedef int pjsua_conf_port_id; |
| 114 | |
| 115 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 116 | /** Constant to identify invalid ID for all sorts of IDs. */ |
| 117 | #define PJSUA_INVALID_ID (-1) |
| 118 | |
| 119 | |
| 120 | |
Benny Prijono | a91a003 | 2006-02-26 21:23:45 +0000 | [diff] [blame] | 121 | /** |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 122 | * Account configuration. |
| 123 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 124 | typedef struct pjsua_acc_config |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 125 | { |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 126 | /** |
| 127 | * The full SIP URL for the account. The value can take name address or |
| 128 | * URL format, and will look something like "sip:account@serviceprovider". |
| 129 | * |
| 130 | * This field is mandatory. |
| 131 | */ |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 132 | pj_str_t id; |
| 133 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 134 | /** |
| 135 | * This is the URL to be put in the request URI for the registration, |
| 136 | * and will look something like "sip:serviceprovider". |
| 137 | * |
| 138 | * This field should be specified if registration is desired. If the |
| 139 | * value is empty, no account registration will be performed. |
| 140 | */ |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 141 | pj_str_t reg_uri; |
| 142 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 143 | /** |
| 144 | * Optional URI to be put as Contact for this account. It is recommended |
| 145 | * that this field is left empty, so that the value will be calculated |
| 146 | * automatically based on the transport address. |
| 147 | */ |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 148 | pj_str_t contact; |
| 149 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 150 | /** |
| 151 | * Number of proxies in the proxy array below. |
| 152 | */ |
| 153 | unsigned proxy_cnt; |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 154 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 155 | /** |
| 156 | * Optional URI of the proxies to be visited for all outgoing requests |
| 157 | * that are using this account (REGISTER, INVITE, etc). Application need |
| 158 | * to specify these proxies if the service provider requires that requests |
| 159 | * destined towards its network should go through certain proxies first |
| 160 | * (for example, border controllers). |
| 161 | * |
| 162 | * These proxies will be put in the route set for this account, with |
| 163 | * maintaining the orders (the first proxy in the array will be visited |
| 164 | * first). |
| 165 | */ |
| 166 | pj_str_t proxy[PJSUA_ACC_MAX_PROXIES]; |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 167 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 168 | /** |
| 169 | * Optional interval for registration, in seconds. If the value is zero, |
| 170 | * default interval will be used (PJSUA_REG_INTERVAL, 55 seconds). |
| 171 | */ |
| 172 | unsigned reg_timeout; |
| 173 | |
| 174 | /** |
| 175 | * Number of credentials in the credential array. |
| 176 | */ |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 177 | unsigned cred_count; |
| 178 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 179 | /** |
| 180 | * Array of credentials. If registration is desired, normally there should |
| 181 | * be at least one credential specified, to successfully authenticate |
| 182 | * against the service provider. More credentials can be specified, for |
| 183 | * example when the requests are expected to be challenged by the |
| 184 | * proxies in the route set. |
| 185 | */ |
| 186 | pjsip_cred_info cred_info[PJSUA_ACC_MAX_PROXIES]; |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 187 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 188 | } pjsua_acc_config; |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 189 | |
| 190 | |
| 191 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 192 | * Call this function to initialize account config with default values. |
| 193 | * |
| 194 | * @param cfg The account config to be initialized. |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 195 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 196 | PJ_INLINE(void) pjsua_acc_config_default(pjsua_acc_config *cfg) |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 197 | { |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 198 | pj_memset(cfg, 0, sizeof(*cfg)); |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 199 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 200 | cfg->reg_timeout = PJSUA_REG_INTERVAL; |
| 201 | } |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 202 | |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 203 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 204 | |
| 205 | /** |
| 206 | * Account info. Application can query account info by calling |
| 207 | * #pjsua_acc_get_info(). |
| 208 | */ |
| 209 | typedef struct pjsua_acc_info |
| 210 | { |
| 211 | /** |
| 212 | * The account ID. |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 213 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 214 | pjsua_acc_id id; |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 215 | |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 216 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 217 | * Flag to indicate whether this is the default account. |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 218 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 219 | pj_bool_t is_default; |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 220 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 221 | /** |
| 222 | * Account URI |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 223 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 224 | pj_str_t acc_uri; |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 225 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 226 | /** |
| 227 | * Flag to tell whether this account has registration setting |
| 228 | * (reg_uri is not empty). |
| 229 | */ |
| 230 | pj_bool_t has_registration; |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 231 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 232 | /** |
| 233 | * An up to date expiration interval for account registration session. |
| 234 | */ |
| 235 | int expires; |
Benny Prijono | b9b32ab | 2006-06-01 12:28:44 +0000 | [diff] [blame] | 236 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 237 | /** |
| 238 | * Last registration status code. If status code is zero, the account |
| 239 | * is currently not registered. Any other value indicates the SIP |
| 240 | * status code of the registration. |
| 241 | */ |
| 242 | pjsip_status_code status; |
Benny Prijono | b9b32ab | 2006-06-01 12:28:44 +0000 | [diff] [blame] | 243 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 244 | /** |
| 245 | * String describing the registration status. |
| 246 | */ |
| 247 | pj_str_t status_text; |
| 248 | |
| 249 | /** |
| 250 | * Presence online status for this account. |
| 251 | */ |
| 252 | pj_bool_t online_status; |
| 253 | |
| 254 | /** |
| 255 | * Buffer that is used internally to store the status text. |
| 256 | */ |
| 257 | char buf_[PJ_ERR_MSG_SIZE]; |
| 258 | |
| 259 | } pjsua_acc_info; |
| 260 | |
| 261 | |
| 262 | |
| 263 | /** |
| 264 | * STUN configuration. |
| 265 | */ |
| 266 | typedef struct pjsua_stun_config |
| 267 | { |
| 268 | /** |
| 269 | * The first STUN server IP address or hostname. |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 270 | */ |
| 271 | pj_str_t stun_srv1; |
| 272 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 273 | /** |
| 274 | * Port number of the first STUN server. |
| 275 | * If zero, default STUN port will be used. |
| 276 | */ |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 277 | unsigned stun_port1; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 278 | |
| 279 | /** |
| 280 | * Optional second STUN server IP address or hostname, for which the |
| 281 | * result of the mapping request will be compared to. If the value |
| 282 | * is empty, only one STUN server will be used. |
| 283 | */ |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 284 | pj_str_t stun_srv2; |
| 285 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 286 | /** |
| 287 | * Port number of the second STUN server. |
| 288 | * If zero, default STUN port will be used. |
| 289 | */ |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 290 | unsigned stun_port2; |
| 291 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 292 | } pjsua_stun_config; |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 293 | |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 294 | |
| 295 | |
| 296 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 297 | * Call this function to initialize STUN config with default values. |
| 298 | * |
| 299 | * @param cfg The STUN config to be initialized. |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 300 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 301 | PJ_INLINE(void) pjsua_stun_config_default(pjsua_stun_config *cfg) |
| 302 | { |
| 303 | pj_memset(cfg, 0, sizeof(*cfg)); |
| 304 | } |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 305 | |
| 306 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 307 | /** |
| 308 | * Transport configuration for creating UDP transports for both SIP |
| 309 | * and media. |
| 310 | */ |
| 311 | typedef struct pjsua_transport_config |
| 312 | { |
| 313 | /** |
| 314 | * UDP port number to bind locally. This setting MUST be specified |
| 315 | * even when default port is desired. If the value is zero, the |
| 316 | * transport will be bound to any available port, and application |
| 317 | * can query the port by querying the transport info. |
| 318 | */ |
| 319 | unsigned port; |
| 320 | |
| 321 | /** |
| 322 | * Optional address where the socket should be bound. |
| 323 | */ |
| 324 | pj_in_addr ip_addr; |
| 325 | |
| 326 | /** |
| 327 | * Flag to indicate whether STUN should be used. |
| 328 | */ |
| 329 | pj_bool_t use_stun; |
| 330 | |
| 331 | /** |
| 332 | * STUN configuration, must be specified when STUN is used. |
| 333 | */ |
| 334 | pjsua_stun_config stun_config; |
| 335 | |
| 336 | } pjsua_transport_config; |
| 337 | |
| 338 | |
| 339 | /** |
| 340 | * Call this function to initialize UDP config with default values. |
| 341 | * |
| 342 | * @param cfg The UDP config to be initialized. |
| 343 | */ |
| 344 | PJ_INLINE(void) pjsua_transport_config_default(pjsua_transport_config *cfg) |
| 345 | { |
| 346 | pj_memset(cfg, 0, sizeof(*cfg)); |
| 347 | } |
| 348 | |
| 349 | |
| 350 | /** |
| 351 | * Normalize STUN config. |
| 352 | */ |
| 353 | PJ_INLINE(void) pjsua_normalize_stun_config( pjsua_stun_config *cfg ) |
| 354 | { |
| 355 | if (cfg->stun_srv1.slen) { |
| 356 | |
| 357 | if (cfg->stun_port1 == 0) |
| 358 | cfg->stun_port1 = 3478; |
| 359 | |
| 360 | if (cfg->stun_srv2.slen == 0) { |
| 361 | cfg->stun_srv2 = cfg->stun_srv1; |
| 362 | cfg->stun_port2 = cfg->stun_port1; |
| 363 | } else { |
| 364 | if (cfg->stun_port2 == 0) |
| 365 | cfg->stun_port2 = 3478; |
| 366 | } |
| 367 | |
| 368 | } else { |
| 369 | cfg->stun_port1 = 0; |
| 370 | cfg->stun_srv2.slen = 0; |
| 371 | cfg->stun_port2 = 0; |
| 372 | } |
| 373 | } |
| 374 | |
| 375 | |
| 376 | /** |
| 377 | * Duplicate transport config. |
| 378 | */ |
| 379 | PJ_INLINE(void) pjsua_transport_config_dup(pj_pool_t *pool, |
| 380 | pjsua_transport_config *dst, |
| 381 | const pjsua_transport_config *src) |
| 382 | { |
| 383 | pj_memcpy(dst, src, sizeof(*src)); |
| 384 | |
| 385 | if (src->stun_config.stun_srv1.slen) { |
| 386 | pj_strdup_with_null(pool, &dst->stun_config.stun_srv1, |
| 387 | &src->stun_config.stun_srv1); |
| 388 | } |
| 389 | |
| 390 | if (src->stun_config.stun_srv2.slen) { |
| 391 | pj_strdup_with_null(pool, &dst->stun_config.stun_srv2, |
| 392 | &src->stun_config.stun_srv2); |
| 393 | } |
| 394 | |
| 395 | pjsua_normalize_stun_config(&dst->stun_config); |
| 396 | } |
| 397 | |
| 398 | |
| 399 | |
| 400 | /** |
| 401 | * Transport info. |
| 402 | */ |
| 403 | typedef struct pjsua_transport_info |
| 404 | { |
| 405 | /** |
| 406 | * PJSUA transport identification. |
| 407 | */ |
| 408 | pjsua_transport_id id; |
| 409 | |
| 410 | /** |
| 411 | * Transport type. |
| 412 | */ |
| 413 | pjsip_transport_type_e type; |
| 414 | |
| 415 | /** |
| 416 | * Transport type name. |
| 417 | */ |
| 418 | pj_str_t type_name; |
| 419 | |
| 420 | /** |
| 421 | * Transport string info/description. |
| 422 | */ |
| 423 | pj_str_t info; |
| 424 | |
| 425 | /** |
| 426 | * Transport flag (see ##pjsip_transport_flags_e). |
| 427 | */ |
| 428 | unsigned flag; |
| 429 | |
| 430 | /** |
| 431 | * Local address length. |
| 432 | */ |
| 433 | unsigned addr_len; |
| 434 | |
| 435 | /** |
| 436 | * Local/bound address. |
| 437 | */ |
| 438 | pj_sockaddr local_addr; |
| 439 | |
| 440 | /** |
| 441 | * Published address (or transport address name). |
| 442 | */ |
| 443 | pjsip_host_port local_name; |
| 444 | |
| 445 | /** |
| 446 | * Current number of objects currently referencing this transport. |
| 447 | */ |
| 448 | unsigned usage_count; |
| 449 | |
| 450 | |
| 451 | } pjsua_transport_info; |
| 452 | |
| 453 | |
| 454 | /** |
| 455 | * Media configuration. |
| 456 | */ |
| 457 | typedef struct pjsua_media_config |
| 458 | { |
| 459 | /** |
| 460 | * Clock rate to be applied to the conference bridge. |
| 461 | * If value is zero, default clock rate will be used (16KHz). |
| 462 | */ |
| 463 | unsigned clock_rate; |
| 464 | |
| 465 | /** |
| 466 | * Specify maximum number of media ports to be created in the |
| 467 | * conference bridge. Since all media terminate in the bridge |
| 468 | * (calls, file player, file recorder, etc), the value must be |
| 469 | * large enough to support all of them. However, the larger |
| 470 | * the value, the more computations are performed. |
| 471 | */ |
| 472 | unsigned max_media_ports; |
| 473 | |
| 474 | /** |
| 475 | * Specify whether the media manager should manage its own |
| 476 | * ioqueue for the RTP/RTCP sockets. If yes, ioqueue will be created |
| 477 | * and at least one worker thread will be created too. If no, |
| 478 | * the RTP/RTCP sockets will share the same ioqueue as SIP sockets, |
| 479 | * and no worker thread is needed. |
| 480 | * |
| 481 | * Normally application would say yes here, unless it wants to |
| 482 | * run everything from a single thread. |
| 483 | */ |
| 484 | pj_bool_t has_ioqueue; |
| 485 | |
| 486 | /** |
| 487 | * Specify the number of worker threads to handle incoming RTP |
| 488 | * packets. A value of one is recommended for most applications. |
| 489 | */ |
| 490 | unsigned thread_cnt; |
| 491 | |
| 492 | |
| 493 | } pjsua_media_config; |
| 494 | |
| 495 | |
| 496 | /** |
| 497 | * Use this function to initialize media config. |
| 498 | * |
| 499 | * @param cfg The media config to be initialized. |
| 500 | */ |
| 501 | PJ_INLINE(void) pjsua_media_config_default(pjsua_media_config *cfg) |
| 502 | { |
| 503 | pj_memset(cfg, 0, sizeof(*cfg)); |
| 504 | |
| 505 | cfg->clock_rate = 16000; |
| 506 | cfg->max_media_ports = 32; |
| 507 | cfg->has_ioqueue = PJ_TRUE; |
| 508 | cfg->thread_cnt = 1; |
| 509 | } |
| 510 | |
| 511 | |
| 512 | |
| 513 | /** |
| 514 | * Logging configuration. |
| 515 | */ |
| 516 | typedef struct pjsua_logging_config |
| 517 | { |
| 518 | /** |
| 519 | * Log incoming and outgoing SIP message? Yes! |
| 520 | */ |
| 521 | pj_bool_t msg_logging; |
| 522 | |
| 523 | /** |
| 524 | * Input verbosity level. Value 5 is reasonable. |
| 525 | */ |
| 526 | unsigned level; |
| 527 | |
| 528 | /** |
| 529 | * Verbosity level for console. Value 4 is reasonable. |
| 530 | */ |
| 531 | unsigned console_level; |
| 532 | |
| 533 | /** |
| 534 | * Log decoration. |
| 535 | */ |
| 536 | unsigned decor; |
| 537 | |
| 538 | /** |
| 539 | * Optional log filename. |
| 540 | */ |
| 541 | pj_str_t log_filename; |
| 542 | |
| 543 | /** |
| 544 | * Optional callback function to be called to write log to |
| 545 | * application specific device. This function will be called for |
| 546 | * log messages on input verbosity level. |
| 547 | */ |
| 548 | void (*cb)(int level, const char *data, pj_size_t len); |
| 549 | |
| 550 | |
| 551 | } pjsua_logging_config; |
| 552 | |
| 553 | |
| 554 | /** |
| 555 | * Use this function to initialize logging config. |
| 556 | * |
| 557 | * @param cfg The logging config to be initialized. |
| 558 | */ |
| 559 | PJ_INLINE(void) pjsua_logging_config_default(pjsua_logging_config *cfg) |
| 560 | { |
| 561 | pj_memset(cfg, 0, sizeof(*cfg)); |
| 562 | |
| 563 | cfg->msg_logging = PJ_TRUE; |
| 564 | cfg->level = 5; |
| 565 | cfg->console_level = 4; |
| 566 | cfg->decor = PJ_LOG_HAS_SENDER | PJ_LOG_HAS_TIME | |
| 567 | PJ_LOG_HAS_MICRO_SEC | PJ_LOG_HAS_NEWLINE; |
| 568 | } |
| 569 | |
| 570 | /** |
| 571 | * Use this function to duplicate logging config. |
| 572 | * |
| 573 | * @param pool Pool to use. |
| 574 | * @param dst Destination config. |
| 575 | * @param src Source config. |
| 576 | */ |
| 577 | PJ_INLINE(void) pjsua_logging_config_dup(pj_pool_t *pool, |
| 578 | pjsua_logging_config *dst, |
| 579 | const pjsua_logging_config *src) |
| 580 | { |
| 581 | pj_memcpy(dst, src, sizeof(*src)); |
| 582 | pj_strdup_with_null(pool, &dst->log_filename, &src->log_filename); |
| 583 | } |
| 584 | |
| 585 | |
| 586 | /** |
| 587 | * Buddy configuration. |
| 588 | */ |
| 589 | typedef struct pjsua_buddy_config |
| 590 | { |
| 591 | /** |
| 592 | * Buddy URL or name address. |
| 593 | */ |
| 594 | pj_str_t uri; |
| 595 | |
| 596 | /** |
| 597 | * Specify whether presence subscription should start immediately. |
| 598 | */ |
| 599 | pj_bool_t subscribe; |
| 600 | |
| 601 | } pjsua_buddy_config; |
| 602 | |
| 603 | |
| 604 | /** |
| 605 | * Buddy's online status. |
| 606 | */ |
| 607 | typedef enum pjsua_buddy_status |
| 608 | { |
| 609 | /** |
| 610 | * Online status is unknown (possibly because no presence subscription |
| 611 | * has been established). |
| 612 | */ |
| 613 | PJSUA_BUDDY_STATUS_UNKNOWN, |
| 614 | |
| 615 | /** |
| 616 | * Buddy is known to be offline. |
| 617 | */ |
| 618 | PJSUA_BUDDY_STATUS_ONLINE, |
| 619 | |
| 620 | /** |
| 621 | * Buddy is offline. |
| 622 | */ |
| 623 | PJSUA_BUDDY_STATUS_OFFLINE, |
| 624 | |
| 625 | } pjsua_buddy_status; |
| 626 | |
| 627 | |
| 628 | |
| 629 | /** |
| 630 | * Buddy info. |
| 631 | */ |
| 632 | typedef struct pjsua_buddy_info |
| 633 | { |
| 634 | /** |
| 635 | * The buddy ID. |
| 636 | */ |
| 637 | pjsua_buddy_id id; |
| 638 | |
| 639 | /** |
| 640 | * The full URI of the buddy, as specified in the configuration. |
| 641 | */ |
| 642 | pj_str_t uri; |
| 643 | |
| 644 | /** |
| 645 | * Buddy's Contact, only available when presence subscription has |
| 646 | * been established to the buddy. |
| 647 | */ |
| 648 | pj_str_t contact; |
| 649 | |
| 650 | /** |
| 651 | * Buddy's online status. |
| 652 | */ |
| 653 | pjsua_buddy_status status; |
| 654 | |
| 655 | /** |
| 656 | * Text to describe buddy's online status. |
| 657 | */ |
| 658 | pj_str_t status_text; |
| 659 | |
| 660 | /** |
| 661 | * Flag to indicate that we should monitor the presence information for |
| 662 | * this buddy (normally yes, unless explicitly disabled). |
| 663 | */ |
| 664 | pj_bool_t monitor_pres; |
| 665 | |
| 666 | /** |
| 667 | * Internal buffer. |
| 668 | */ |
| 669 | char buf_[256]; |
| 670 | |
| 671 | } pjsua_buddy_info; |
| 672 | |
| 673 | |
| 674 | /** |
| 675 | * Codec config. |
| 676 | */ |
| 677 | typedef struct pjsua_codec_info |
| 678 | { |
| 679 | /** |
| 680 | * Codec unique identification. |
| 681 | */ |
| 682 | pj_str_t codec_id; |
| 683 | |
| 684 | /** |
| 685 | * Codec priority (integer 0-255). |
| 686 | */ |
| 687 | pj_uint8_t priority; |
| 688 | |
| 689 | /** |
| 690 | * Internal buffer. |
| 691 | */ |
| 692 | char buf_[32]; |
| 693 | |
| 694 | } pjsua_codec_info; |
| 695 | |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 696 | |
| 697 | /** |
| 698 | * Application callbacks. |
| 699 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 700 | typedef struct pjsua_callback |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 701 | { |
| 702 | /** |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 703 | * Notify application when invite state has changed. |
| 704 | * Application may then query the call info to get the |
| 705 | * detail call states. |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 706 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 707 | void (*on_call_state)(pjsua_call_id call_id, pjsip_event *e); |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 708 | |
| 709 | /** |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 710 | * Notify application on incoming call. |
| 711 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 712 | void (*on_incoming_call)(pjsua_acc_id acc_id, pjsua_call_id call_id, |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 713 | pjsip_rx_data *rdata); |
| 714 | |
| 715 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 716 | * Notify application when media state in the call has changed. |
| 717 | * Normal application would need to implement this callback, e.g. |
| 718 | * to connect the call's media to sound device. |
| 719 | */ |
| 720 | void (*on_call_media_state)(pjsua_call_id call_id); |
| 721 | |
| 722 | /** |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 723 | * Notify application on call being transfered. |
| 724 | * Application can decide to accept/reject transfer request |
| 725 | * by setting the code (default is 200). When this callback |
| 726 | * is not defined, the default behavior is to accept the |
| 727 | * transfer. |
| 728 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 729 | void (*on_call_transfered)(pjsua_call_id call_id, |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 730 | const pj_str_t *dst, |
| 731 | pjsip_status_code *code); |
| 732 | |
| 733 | /** |
| 734 | * Notify application when registration status has changed. |
| 735 | * Application may then query the account info to get the |
| 736 | * registration details. |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 737 | */ |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 738 | void (*on_reg_state)(pjsua_acc_id acc_id); |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 739 | |
| 740 | /** |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 741 | * Notify application when the buddy state has changed. |
| 742 | * Application may then query the buddy into to get the details. |
| 743 | */ |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 744 | void (*on_buddy_state)(pjsua_buddy_id buddy_id); |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 745 | |
| 746 | /** |
| 747 | * Notify application on incoming pager (i.e. MESSAGE request). |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 748 | * Argument call_id will be -1 if MESSAGE request is not related to an |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 749 | * existing call. |
| 750 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 751 | void (*on_pager)(pjsua_call_id call_id, const pj_str_t *from, |
| 752 | const pj_str_t *to, const pj_str_t *contact, |
| 753 | const pj_str_t *mime_type, const pj_str_t *body); |
| 754 | |
| 755 | /** |
| 756 | * Notify application about the delivery status of outgoing pager |
| 757 | * request. |
| 758 | * |
| 759 | * @param call_id Containts the ID of the call where the IM was |
| 760 | * sent, or PJSUA_INVALID_ID if the IM was sent |
| 761 | * outside call context. |
| 762 | * @param to Destination URI. |
| 763 | * @param body Message body. |
| 764 | * @param user_data Arbitrary data that was specified when sending |
| 765 | * IM message. |
| 766 | * @param status Delivery status. |
| 767 | * @param reason Delivery status reason. |
| 768 | */ |
| 769 | void (*on_pager_status)(pjsua_call_id call_id, |
| 770 | const pj_str_t *to, |
| 771 | const pj_str_t *body, |
| 772 | void *user_data, |
| 773 | pjsip_status_code status, |
| 774 | const pj_str_t *reason); |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 775 | |
| 776 | /** |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 777 | * Notify application about typing indication. |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 778 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 779 | void (*on_typing)(pjsua_call_id call_id, const pj_str_t *from, |
| 780 | const pj_str_t *to, const pj_str_t *contact, |
| 781 | pj_bool_t is_typing); |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 782 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 783 | } pjsua_callback; |
| 784 | |
| 785 | |
| 786 | |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 787 | |
| 788 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 789 | * PJSUA settings. |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 790 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 791 | typedef struct pjsua_config |
| 792 | { |
| 793 | |
| 794 | /** |
| 795 | * Maximum calls to support (default: 4) |
| 796 | */ |
| 797 | unsigned max_calls; |
| 798 | |
| 799 | /** |
| 800 | * Number of worker threads. Normally application will want to have at |
| 801 | * least one worker thread, unless when it wants to poll the library |
| 802 | * periodically, which in this case the worker thread can be set to |
| 803 | * zero. |
| 804 | */ |
| 805 | unsigned thread_cnt; |
| 806 | |
| 807 | /** |
| 808 | * Number of outbound proxies in the array. |
| 809 | */ |
| 810 | unsigned outbound_proxy_cnt; |
| 811 | |
| 812 | /** |
| 813 | * Specify the URL of outbound proxies to visit for all outgoing requests. |
| 814 | * The outbound proxies will be used for all accounts, and it will |
| 815 | * be used to build the route set for outgoing requests. The final |
| 816 | * route set for outgoing requests will consists of the outbound proxies |
| 817 | * and the proxy configured in the account. |
| 818 | */ |
| 819 | pj_str_t outbound_proxy[4]; |
| 820 | |
| 821 | /** |
| 822 | * Number of credentials in the credential array. |
| 823 | */ |
| 824 | unsigned cred_count; |
| 825 | |
| 826 | /** |
| 827 | * Array of credentials. These credentials will be used by all accounts, |
| 828 | * and can be used to authenticate against outbound proxies. |
| 829 | */ |
| 830 | pjsip_cred_info cred_info[PJSUA_ACC_MAX_PROXIES]; |
| 831 | |
| 832 | /** |
| 833 | * Application callback. |
| 834 | */ |
| 835 | pjsua_callback cb; |
| 836 | |
| 837 | } pjsua_config; |
| 838 | |
| 839 | |
| 840 | /** |
| 841 | * Use this function to initialize pjsua config. |
| 842 | * |
| 843 | * @param cfg pjsua config to be initialized. |
| 844 | */ |
| 845 | PJ_INLINE(void) pjsua_config_default(pjsua_config *cfg) |
| 846 | { |
| 847 | pj_memset(cfg, 0, sizeof(*cfg)); |
| 848 | |
| 849 | cfg->max_calls = 4; |
| 850 | cfg->thread_cnt = 1; |
| 851 | } |
| 852 | |
| 853 | |
| 854 | /** |
| 855 | * Duplicate credential. |
| 856 | */ |
| 857 | PJ_INLINE(void) pjsip_cred_dup( pj_pool_t *pool, |
| 858 | pjsip_cred_info *dst, |
| 859 | const pjsip_cred_info *src) |
| 860 | { |
| 861 | pj_strdup_with_null(pool, &dst->realm, &src->realm); |
| 862 | pj_strdup_with_null(pool, &dst->scheme, &src->scheme); |
| 863 | pj_strdup_with_null(pool, &dst->username, &src->username); |
| 864 | pj_strdup_with_null(pool, &dst->data, &src->data); |
| 865 | |
| 866 | } |
| 867 | |
| 868 | |
| 869 | /** |
| 870 | * Duplicate pjsua_config. |
| 871 | */ |
| 872 | PJ_INLINE(void) pjsua_config_dup(pj_pool_t *pool, |
| 873 | pjsua_config *dst, |
| 874 | const pjsua_config *src) |
| 875 | { |
| 876 | unsigned i; |
| 877 | |
| 878 | pj_memcpy(dst, src, sizeof(*src)); |
| 879 | |
| 880 | for (i=0; i<src->outbound_proxy_cnt; ++i) { |
| 881 | pj_strdup_with_null(pool, &dst->outbound_proxy[i], |
| 882 | &src->outbound_proxy[i]); |
| 883 | } |
| 884 | |
| 885 | for (i=0; i<src->cred_count; ++i) { |
| 886 | pjsip_cred_dup(pool, &dst->cred_info[i], &src->cred_info[i]); |
| 887 | } |
| 888 | } |
| 889 | |
| 890 | |
| 891 | /** |
| 892 | * Call media status. |
| 893 | */ |
| 894 | typedef enum pjsua_call_media_status |
| 895 | { |
| 896 | PJSUA_CALL_MEDIA_NONE, |
| 897 | PJSUA_CALL_MEDIA_ACTIVE, |
| 898 | PJSUA_CALL_MEDIA_LOCAL_HOLD, |
| 899 | PJSUA_CALL_MEDIA_REMOTE_HOLD, |
| 900 | } pjsua_call_media_status; |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 901 | |
| 902 | |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 903 | /** |
| 904 | * Call info. |
| 905 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 906 | typedef struct pjsua_call_info |
Benny Prijono | 268ca61 | 2006-02-07 12:34:11 +0000 | [diff] [blame] | 907 | { |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 908 | /** Call identification. */ |
| 909 | pjsua_call_id id; |
| 910 | |
| 911 | /** Initial call role (UAC == caller) */ |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 912 | pjsip_role_e role; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 913 | |
| 914 | /** Local URI */ |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 915 | pj_str_t local_info; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 916 | |
| 917 | /** Local Contact */ |
| 918 | pj_str_t local_contact; |
| 919 | |
| 920 | /** Remote URI */ |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 921 | pj_str_t remote_info; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 922 | |
| 923 | /** Remote contact */ |
| 924 | pj_str_t remote_contact; |
| 925 | |
| 926 | /** Dialog Call-ID string. */ |
| 927 | pj_str_t call_id; |
| 928 | |
| 929 | /** Call state */ |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 930 | pjsip_inv_state state; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 931 | |
| 932 | /** Text describing the state */ |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 933 | pj_str_t state_text; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 934 | |
| 935 | /** Last status code heard, which can be used as cause code */ |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 936 | pjsip_status_code last_status; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 937 | |
| 938 | /** The reason phrase describing the status. */ |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 939 | pj_str_t last_status_text; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 940 | |
| 941 | /** Call media status. */ |
| 942 | pjsua_call_media_status media_status; |
| 943 | |
| 944 | /** Media direction */ |
| 945 | pjmedia_dir media_dir; |
| 946 | |
| 947 | /** The conference port number for the call */ |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 948 | pjsua_conf_port_id conf_slot; |
Benny Prijono | 268ca61 | 2006-02-07 12:34:11 +0000 | [diff] [blame] | 949 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 950 | /** Up-to-date call connected duration (zero when call is not |
| 951 | * established) |
| 952 | */ |
| 953 | pj_time_val connect_duration; |
| 954 | |
| 955 | /** Total call duration, including set-up time */ |
| 956 | pj_time_val total_duration; |
| 957 | |
| 958 | /** Internal */ |
| 959 | struct { |
| 960 | char local_info[128]; |
| 961 | char local_contact[128]; |
| 962 | char remote_info[128]; |
| 963 | char remote_contact[128]; |
| 964 | char call_id[128]; |
| 965 | char last_status_text[128]; |
| 966 | } buf_; |
| 967 | |
| 968 | } pjsua_call_info; |
Benny Prijono | 9519658 | 2006-02-09 00:13:40 +0000 | [diff] [blame] | 969 | |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 970 | |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 971 | |
| 972 | |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 973 | /** |
| 974 | * Conference port info. |
| 975 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 976 | typedef struct pjsua_conf_port_info |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 977 | { |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 978 | /** Conference port number. */ |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 979 | pjsua_conf_port_id slot_id; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 980 | |
| 981 | /** Port name. */ |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 982 | pj_str_t name; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 983 | |
| 984 | /** Clock rate. */ |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 985 | unsigned clock_rate; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 986 | |
| 987 | /** Number of channels. */ |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 988 | unsigned channel_count; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 989 | |
| 990 | /** Samples per frame */ |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 991 | unsigned samples_per_frame; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 992 | |
| 993 | /** Bits per sample */ |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 994 | unsigned bits_per_sample; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 995 | |
| 996 | /** Number of listeners in the array. */ |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 997 | unsigned listener_cnt; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 998 | |
| 999 | /** Array of listeners (in other words, ports where this port is |
| 1000 | * transmitting to. |
| 1001 | */ |
| 1002 | pjsua_conf_port_id listeners[PJSUA_MAX_CONF_PORTS]; |
| 1003 | |
| 1004 | } pjsua_conf_port_info; |
Benny Prijono | 9519658 | 2006-02-09 00:13:40 +0000 | [diff] [blame] | 1005 | |
| 1006 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1007 | /** |
| 1008 | * This structure holds information about custom media transport to |
| 1009 | * be registered to pjsua. |
| 1010 | */ |
| 1011 | typedef struct pjsua_media_transport |
| 1012 | { |
| 1013 | /** |
| 1014 | * Media socket information containing the address information |
| 1015 | * of the RTP and RTCP socket. |
| 1016 | */ |
| 1017 | pjmedia_sock_info skinfo; |
| 1018 | |
| 1019 | /** |
| 1020 | * The media transport instance. |
| 1021 | */ |
| 1022 | pjmedia_transport *transport; |
| 1023 | |
| 1024 | } pjsua_media_transport; |
| 1025 | |
| 1026 | |
| 1027 | /** |
| 1028 | * This structure describes additional information to be sent with |
| 1029 | * outgoing SIP message. |
| 1030 | */ |
| 1031 | typedef struct pjsua_msg_data |
| 1032 | { |
| 1033 | /** |
| 1034 | * Additional message headers as linked list. |
| 1035 | */ |
| 1036 | pjsip_hdr hdr_list; |
| 1037 | |
| 1038 | /** |
| 1039 | * MIME type of optional message body. |
| 1040 | */ |
| 1041 | pj_str_t content_type; |
| 1042 | |
| 1043 | /** |
| 1044 | * Optional message body. |
| 1045 | */ |
| 1046 | pj_str_t msg_body; |
| 1047 | |
| 1048 | } pjsua_msg_data; |
| 1049 | |
| 1050 | |
| 1051 | /** |
| 1052 | * Initialize message data. |
| 1053 | * |
| 1054 | * @param msg_data Message data to be initialized. |
| 1055 | */ |
| 1056 | PJ_INLINE(void) pjsua_msg_data_init(pjsua_msg_data *msg_data) |
| 1057 | { |
| 1058 | pj_memset(msg_data, 0, sizeof(*msg_data)); |
| 1059 | pj_list_init(&msg_data->hdr_list); |
| 1060 | } |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 1061 | |
Benny Prijono | 268ca61 | 2006-02-07 12:34:11 +0000 | [diff] [blame] | 1062 | |
| 1063 | /***************************************************************************** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1064 | * PJSUA Core API |
Benny Prijono | 268ca61 | 2006-02-07 12:34:11 +0000 | [diff] [blame] | 1065 | */ |
| 1066 | |
Benny Prijono | 268ca61 | 2006-02-07 12:34:11 +0000 | [diff] [blame] | 1067 | |
| 1068 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1069 | * Instantiate pjsua application. Application must call this function before |
| 1070 | * calling any other functions, to make sure that the underlying libraries |
| 1071 | * are properly initialized. Once this function has returned success, |
| 1072 | * application must call pjsua_destroy() before quitting. |
| 1073 | * |
| 1074 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 1075 | */ |
| 1076 | PJ_DECL(pj_status_t) pjsua_create(void); |
| 1077 | |
| 1078 | |
| 1079 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1080 | * Initialize pjsua with the specified settings. All the settings are |
| 1081 | * optional, and the default values will be used when the config is not |
| 1082 | * specified. |
Benny Prijono | ccf9562 | 2006-02-07 18:48:01 +0000 | [diff] [blame] | 1083 | * |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1084 | * @param ua_cfg User agent configuration. |
| 1085 | * @param log_cfg Optional logging configuration. |
| 1086 | * @param media_cfg Optional media configuration. |
Benny Prijono | ccf9562 | 2006-02-07 18:48:01 +0000 | [diff] [blame] | 1087 | * |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1088 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | 268ca61 | 2006-02-07 12:34:11 +0000 | [diff] [blame] | 1089 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1090 | PJ_DECL(pj_status_t) pjsua_init(const pjsua_config *ua_cfg, |
| 1091 | const pjsua_logging_config *log_cfg, |
| 1092 | const pjsua_media_config *media_cfg); |
Benny Prijono | 268ca61 | 2006-02-07 12:34:11 +0000 | [diff] [blame] | 1093 | |
| 1094 | |
| 1095 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1096 | * Application is recommended to call this function after all initialization |
| 1097 | * is done, so that the library can do additional checking set up |
| 1098 | * additional |
Benny Prijono | ccf9562 | 2006-02-07 18:48:01 +0000 | [diff] [blame] | 1099 | * |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1100 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | ccf9562 | 2006-02-07 18:48:01 +0000 | [diff] [blame] | 1101 | */ |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 1102 | PJ_DECL(pj_status_t) pjsua_start(void); |
Benny Prijono | ccf9562 | 2006-02-07 18:48:01 +0000 | [diff] [blame] | 1103 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1104 | |
Benny Prijono | ccf9562 | 2006-02-07 18:48:01 +0000 | [diff] [blame] | 1105 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1106 | * Destroy pjsua. This function must be called once PJSUA is created. To |
| 1107 | * make it easier for application, application may call this function |
| 1108 | * several times with no danger. |
| 1109 | * |
| 1110 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | 268ca61 | 2006-02-07 12:34:11 +0000 | [diff] [blame] | 1111 | */ |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 1112 | PJ_DECL(pj_status_t) pjsua_destroy(void); |
Benny Prijono | a91a003 | 2006-02-26 21:23:45 +0000 | [diff] [blame] | 1113 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1114 | |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1115 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1116 | * Poll pjsua for events, and if necessary block the caller thread for |
| 1117 | * the specified maximum interval (in miliseconds). |
| 1118 | * |
| 1119 | * @param msec_timeout Maximum time to wait, in miliseconds. |
| 1120 | * |
| 1121 | * @return The number of events that have been handled during the |
| 1122 | * poll. Negative value indicates error, and application |
| 1123 | * can retrieve the error as (err = -return_value). |
Benny Prijono | b9b32ab | 2006-06-01 12:28:44 +0000 | [diff] [blame] | 1124 | */ |
| 1125 | PJ_DECL(int) pjsua_handle_events(unsigned msec_timeout); |
| 1126 | |
| 1127 | |
| 1128 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1129 | * Create memory pool. |
| 1130 | * |
| 1131 | * @param name Optional pool name. |
| 1132 | * @param size Initial size of the pool. |
| 1133 | * @param increment Increment size. |
| 1134 | * |
| 1135 | * @return The pool, or NULL when there's no memory. |
| 1136 | */ |
| 1137 | PJ_DECL(pj_pool_t*) pjsua_pool_create(const char *name, pj_size_t init_size, |
| 1138 | pj_size_t increment); |
| 1139 | |
| 1140 | |
| 1141 | /** |
| 1142 | * Application can call this function at any time (after pjsua_create(), of |
| 1143 | * course) to change logging settings. |
| 1144 | * |
| 1145 | * @param c Logging configuration. |
| 1146 | * |
| 1147 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 1148 | */ |
| 1149 | PJ_DECL(pj_status_t) pjsua_reconfigure_logging(const pjsua_logging_config *c); |
| 1150 | |
| 1151 | |
| 1152 | /** |
| 1153 | * Internal function to get SIP endpoint instance of pjsua, which is |
| 1154 | * needed for example to register module, create transports, etc. |
| 1155 | * Probably is only valid after #pjsua_init() is called. |
| 1156 | * |
| 1157 | * @return SIP endpoint instance. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1158 | */ |
| 1159 | PJ_DECL(pjsip_endpoint*) pjsua_get_pjsip_endpt(void); |
| 1160 | |
| 1161 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1162 | * Internal function to get media endpoint instance. |
| 1163 | * Only valid after #pjsua_init() is called. |
| 1164 | * |
| 1165 | * @return Media endpoint instance. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1166 | */ |
| 1167 | PJ_DECL(pjmedia_endpt*) pjsua_get_pjmedia_endpt(void); |
| 1168 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1169 | |
| 1170 | /***************************************************************************** |
| 1171 | * PJSUA SIP Transport API. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1172 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1173 | |
| 1174 | /** |
| 1175 | * Create SIP transport. |
| 1176 | * |
| 1177 | * @param type Transport type. |
| 1178 | * @param cfg Transport configuration. |
| 1179 | * @param p_id Optional pointer to receive transport ID. |
| 1180 | * |
| 1181 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 1182 | */ |
| 1183 | PJ_DECL(pj_status_t) pjsua_transport_create(pjsip_transport_type_e type, |
| 1184 | const pjsua_transport_config *cfg, |
| 1185 | pjsua_transport_id *p_id); |
| 1186 | |
| 1187 | /** |
| 1188 | * Register transport that has been created by application. |
| 1189 | * |
| 1190 | * @param tp Transport instance. |
| 1191 | * @param p_id Optional pointer to receive transport ID. |
| 1192 | * |
| 1193 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 1194 | */ |
| 1195 | PJ_DECL(pj_status_t) pjsua_transport_register(pjsip_transport *tp, |
| 1196 | pjsua_transport_id *p_id); |
| 1197 | |
| 1198 | |
| 1199 | /** |
| 1200 | * Enumerate all transports currently created in the system. |
| 1201 | * |
| 1202 | * @param id Array to receive transport ids. |
| 1203 | * @param count In input, specifies the maximum number of elements. |
| 1204 | * On return, it contains the actual number of elements. |
| 1205 | * |
| 1206 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 1207 | */ |
| 1208 | PJ_DECL(pj_status_t) pjsua_enum_transports( pjsua_transport_id id[], |
| 1209 | unsigned *count ); |
| 1210 | |
| 1211 | |
| 1212 | /** |
| 1213 | * Get information about transports. |
| 1214 | * |
| 1215 | * @param id Transport ID. |
| 1216 | * @param info Pointer to receive transport info. |
| 1217 | * |
| 1218 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 1219 | */ |
| 1220 | PJ_DECL(pj_status_t) pjsua_transport_get_info(pjsua_transport_id id, |
| 1221 | pjsua_transport_info *info); |
| 1222 | |
| 1223 | |
| 1224 | /** |
| 1225 | * Disable a transport or re-enable it. By default transport is always |
| 1226 | * enabled after it is created. Disabling a transport does not necessarily |
| 1227 | * close the socket, it will only discard incoming messages and prevent |
| 1228 | * the transport from being used to send outgoing messages. |
| 1229 | * |
| 1230 | * @param id Transport ID. |
| 1231 | * @param enabled Non-zero to enable, zero to disable. |
| 1232 | * |
| 1233 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 1234 | */ |
| 1235 | PJ_DECL(pj_status_t) pjsua_transport_set_enable(pjsua_transport_id id, |
| 1236 | pj_bool_t enabled); |
| 1237 | |
| 1238 | |
| 1239 | /** |
| 1240 | * Close the transport. If transport is forcefully closed, it will be |
| 1241 | * immediately closed, and any pending transactions that are using the |
| 1242 | * transport may not terminate properly. Otherwise, the system will wait |
| 1243 | * until all transactions are closed while preventing new users from |
| 1244 | * using the transport, and will close the transport when it is safe to |
| 1245 | * do so. |
| 1246 | * |
| 1247 | * @param id Transport ID. |
| 1248 | * @param force Non-zero to immediately close the transport. This |
| 1249 | * is not recommended! |
| 1250 | * |
| 1251 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 1252 | */ |
| 1253 | PJ_DECL(pj_status_t) pjsua_transport_close( pjsua_transport_id id, |
| 1254 | pj_bool_t force ); |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1255 | |
Benny Prijono | a91a003 | 2006-02-26 21:23:45 +0000 | [diff] [blame] | 1256 | |
| 1257 | /***************************************************************************** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1258 | * PJSUA Media Transport. |
| 1259 | */ |
| 1260 | |
| 1261 | /** |
| 1262 | * Create UDP media transports for all the calls. This function creates |
| 1263 | * one UDP media transport for each call. |
| 1264 | * |
| 1265 | * @param cfg Media transport configuration. The "port" field in the |
| 1266 | * configuration is used as the start port to bind the |
| 1267 | * sockets. |
| 1268 | * |
| 1269 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 1270 | */ |
| 1271 | PJ_DECL(pj_status_t) |
| 1272 | pjsua_media_transports_create(const pjsua_transport_config *cfg); |
| 1273 | |
| 1274 | |
| 1275 | /** |
| 1276 | * Register custom media transports to be used by calls. There must |
| 1277 | * enough media transports for all calls. |
| 1278 | * |
| 1279 | * @param tp The media transport array. |
| 1280 | * @param count Number of elements in the array. This number MUST |
| 1281 | * match the number of maximum calls configured when |
| 1282 | * pjsua is created. |
| 1283 | * @param auto_delete Flag to indicate whether the transports should be |
| 1284 | * destroyed when pjsua is shutdown. |
| 1285 | * |
| 1286 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 1287 | */ |
| 1288 | PJ_DECL(pj_status_t) |
| 1289 | pjsua_media_transports_attach( pjsua_media_transport tp[], |
| 1290 | unsigned count, |
| 1291 | pj_bool_t auto_delete); |
| 1292 | |
| 1293 | |
| 1294 | |
| 1295 | /***************************************************************************** |
| 1296 | * PJSUA Call API. |
Benny Prijono | a91a003 | 2006-02-26 21:23:45 +0000 | [diff] [blame] | 1297 | */ |
| 1298 | |
| 1299 | /** |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1300 | * Get maximum number of calls configured in pjsua. |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1301 | * |
| 1302 | * @return Maximum number of calls configured. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1303 | */ |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 1304 | PJ_DECL(unsigned) pjsua_call_get_max_count(void); |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1305 | |
| 1306 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1307 | * Get number of currently active calls. |
| 1308 | * |
| 1309 | * @return Number of currently active calls. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1310 | */ |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 1311 | PJ_DECL(unsigned) pjsua_call_get_count(void); |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1312 | |
| 1313 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1314 | * Enumerate all active calls. |
| 1315 | * |
| 1316 | * @param ids Array of account IDs to be initialized. |
| 1317 | * @param count In input, specifies the maximum number of elements. |
| 1318 | * On return, it contains the actual number of elements. |
| 1319 | * |
| 1320 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 1321 | */ |
| 1322 | PJ_DECL(pj_status_t) pjsua_enum_calls(pjsua_call_id ids[], |
| 1323 | unsigned *count); |
| 1324 | |
| 1325 | |
| 1326 | /** |
| 1327 | * Make outgoing call to the specified URI using the specified account. |
| 1328 | * |
| 1329 | * @param acc_id The account to be used. |
| 1330 | * @param target URI to be put in the request URI. |
| 1331 | * @param dst_uri URI to be put in the To header (normally is the same |
| 1332 | * as the target URI). |
| 1333 | * @param options Options (must be zero at the moment). |
| 1334 | * @param user_data Arbitrary user data to be attached to the call, and |
| 1335 | * can be retrieved later. |
| 1336 | * @param msg_data Optional headers etc to be added to outgoing INVITE |
| 1337 | * request, or NULL if no custom header is desired. |
| 1338 | * @param p_call_id Pointer to receive call identification. |
| 1339 | * |
| 1340 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 1341 | */ |
| 1342 | PJ_DECL(pj_status_t) pjsua_call_make_call(pjsua_acc_id acc_id, |
| 1343 | const pj_str_t *dst_uri, |
| 1344 | unsigned options, |
| 1345 | void *user_data, |
| 1346 | const pjsua_msg_data *msg_data, |
| 1347 | pjsua_call_id *p_call_id); |
| 1348 | |
| 1349 | |
| 1350 | /** |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1351 | * Check if the specified call has active INVITE session and the INVITE |
| 1352 | * session has not been disconnected. |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1353 | * |
| 1354 | * @param call_id Call identification. |
| 1355 | * |
| 1356 | * @return Non-zero if call is active. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1357 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1358 | PJ_DECL(pj_bool_t) pjsua_call_is_active(pjsua_call_id call_id); |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1359 | |
| 1360 | |
| 1361 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1362 | * Check if call has an active media session. |
| 1363 | * |
| 1364 | * @param call_id Call identification. |
| 1365 | * |
| 1366 | * @return Non-zero if yes. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1367 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1368 | PJ_DECL(pj_bool_t) pjsua_call_has_media(pjsua_call_id call_id); |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1369 | |
| 1370 | |
| 1371 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1372 | * Get the conference port identification associated with the call. |
| 1373 | * |
| 1374 | * @param call_id Call identification. |
| 1375 | * |
| 1376 | * @return Conference port ID, or PJSUA_INVALID_ID when the |
| 1377 | * media has not been established or is not active. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1378 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1379 | PJ_DECL(pjsua_conf_port_id) pjsua_call_get_conf_port(pjsua_call_id call_id); |
| 1380 | |
| 1381 | /** |
| 1382 | * Obtain detail information about the specified call. |
| 1383 | * |
| 1384 | * @param call_id Call identification. |
| 1385 | * @param info Call info to be initialized. |
| 1386 | * |
| 1387 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 1388 | */ |
| 1389 | PJ_DECL(pj_status_t) pjsua_call_get_info(pjsua_call_id call_id, |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1390 | pjsua_call_info *info); |
| 1391 | |
| 1392 | |
| 1393 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1394 | * Attach application specific data to the call. |
| 1395 | * |
| 1396 | * @param call_id Call identification. |
| 1397 | * @param user_data Arbitrary data to be attached to the call. |
| 1398 | * |
| 1399 | * @return The user data. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1400 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1401 | PJ_DECL(pj_status_t) pjsua_call_set_user_data(pjsua_call_id call_id, |
| 1402 | void *user_data); |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1403 | |
| 1404 | |
| 1405 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1406 | * Get user data attached to the call. |
| 1407 | * |
| 1408 | * @param call_id Call identification. |
| 1409 | * |
| 1410 | * @return The user data. |
Benny Prijono | 268ca61 | 2006-02-07 12:34:11 +0000 | [diff] [blame] | 1411 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1412 | PJ_DECL(void*) pjsua_call_get_user_data(pjsua_call_id call_id); |
Benny Prijono | 84126ab | 2006-02-09 09:30:09 +0000 | [diff] [blame] | 1413 | |
| 1414 | |
| 1415 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1416 | * Send response to incoming INVITE request. |
| 1417 | * |
| 1418 | * @param call_id Incoming call identification. |
| 1419 | * @param code Status code, (100-699). |
| 1420 | * @param reason Optional reason phrase. If NULL, default text |
| 1421 | * will be used. |
| 1422 | * @param msg_data Optional list of headers etc to be added to outgoing |
| 1423 | * response message. |
| 1424 | * |
| 1425 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | a91a003 | 2006-02-26 21:23:45 +0000 | [diff] [blame] | 1426 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1427 | PJ_DECL(pj_status_t) pjsua_call_answer(pjsua_call_id call_id, |
| 1428 | unsigned code, |
| 1429 | const pj_str_t *reason, |
| 1430 | const pjsua_msg_data *msg_data); |
Benny Prijono | a91a003 | 2006-02-26 21:23:45 +0000 | [diff] [blame] | 1431 | |
| 1432 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1433 | * Hangup call by using method that is appropriate according to the |
| 1434 | * call state. |
| 1435 | * |
| 1436 | * @param call_id Call identification. |
| 1437 | * @param code Optional status code to be sent when we're rejecting |
| 1438 | * incoming call. If the value is zero, "603/Decline" |
| 1439 | * will be sent. |
| 1440 | * @param reason Optional reason phrase to be sent when we're rejecting |
| 1441 | * incoming call. If NULL, default text will be used. |
| 1442 | * @param msg_data Optional list of headers etc to be added to outgoing |
| 1443 | * request/response message. |
| 1444 | * |
| 1445 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | 26ff906 | 2006-02-21 23:47:00 +0000 | [diff] [blame] | 1446 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1447 | PJ_DECL(pj_status_t) pjsua_call_hangup(pjsua_call_id call_id, |
| 1448 | unsigned code, |
| 1449 | const pj_str_t *reason, |
| 1450 | const pjsua_msg_data *msg_data); |
Benny Prijono | 26ff906 | 2006-02-21 23:47:00 +0000 | [diff] [blame] | 1451 | |
| 1452 | |
| 1453 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1454 | * Put the specified call on hold. |
| 1455 | * |
| 1456 | * @param call_id Call identification. |
| 1457 | * @param msg_data Optional message components to be sent with |
| 1458 | * the request. |
| 1459 | * |
| 1460 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | 26ff906 | 2006-02-21 23:47:00 +0000 | [diff] [blame] | 1461 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1462 | PJ_DECL(pj_status_t) pjsua_call_set_hold(pjsua_call_id call_id, |
| 1463 | const pjsua_msg_data *msg_data); |
Benny Prijono | 26ff906 | 2006-02-21 23:47:00 +0000 | [diff] [blame] | 1464 | |
| 1465 | |
| 1466 | /** |
| 1467 | * Send re-INVITE (to release hold). |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1468 | * |
| 1469 | * @param call_id Call identification. |
| 1470 | * @param unhold If this argument is non-zero and the call is locally |
| 1471 | * held, this will release the local hold. |
| 1472 | * @param msg_data Optional message components to be sent with |
| 1473 | * the request. |
| 1474 | * |
| 1475 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | 26ff906 | 2006-02-21 23:47:00 +0000 | [diff] [blame] | 1476 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1477 | PJ_DECL(pj_status_t) pjsua_call_reinvite(pjsua_call_id call_id, |
| 1478 | pj_bool_t unhold, |
| 1479 | const pjsua_msg_data *msg_data); |
Benny Prijono | 26ff906 | 2006-02-21 23:47:00 +0000 | [diff] [blame] | 1480 | |
| 1481 | |
| 1482 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1483 | * Initiate call transfer to the specified address. |
| 1484 | * |
| 1485 | * @param call_id Call identification. |
| 1486 | * @param dest Address of new target to be contacted. |
| 1487 | * @param msg_data Optional message components to be sent with |
| 1488 | * the request. |
| 1489 | * |
| 1490 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | 26ff906 | 2006-02-21 23:47:00 +0000 | [diff] [blame] | 1491 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1492 | PJ_DECL(pj_status_t) pjsua_call_xfer(pjsua_call_id call_id, |
| 1493 | const pj_str_t *dest, |
| 1494 | const pjsua_msg_data *msg_data); |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1495 | |
| 1496 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1497 | * Send DTMF digits to remote using RFC 2833 payload formats. |
| 1498 | * |
| 1499 | * @param call_id Call identification. |
| 1500 | * @param digits DTMF digits to be sent. |
| 1501 | * |
| 1502 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1503 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1504 | PJ_DECL(pj_status_t) pjsua_call_dial_dtmf(pjsua_call_id call_id, |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1505 | const pj_str_t *digits); |
Benny Prijono | 26ff906 | 2006-02-21 23:47:00 +0000 | [diff] [blame] | 1506 | |
Benny Prijono | 26ff906 | 2006-02-21 23:47:00 +0000 | [diff] [blame] | 1507 | /** |
Benny Prijono | b080837 | 2006-03-02 21:18:58 +0000 | [diff] [blame] | 1508 | * Send instant messaging inside INVITE session. |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1509 | * |
| 1510 | * @param call_id Call identification. |
| 1511 | * @param mime_type Optional MIME type. If NULL, then "text/plain" is |
| 1512 | * assumed. |
| 1513 | * @param content The message content. |
| 1514 | * @param msg_data Optional list of headers etc to be included in outgoing |
| 1515 | * request. The body descriptor in the msg_data is |
| 1516 | * ignored. |
| 1517 | * @param user_data Optional user data, which will be given back when |
| 1518 | * the IM callback is called. |
| 1519 | * |
| 1520 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | b080837 | 2006-03-02 21:18:58 +0000 | [diff] [blame] | 1521 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1522 | PJ_DECL(pj_status_t) pjsua_call_send_im( pjsua_call_id call_id, |
| 1523 | const pj_str_t *mime_type, |
| 1524 | const pj_str_t *content, |
| 1525 | const pjsua_msg_data *msg_data, |
| 1526 | void *user_data); |
Benny Prijono | b080837 | 2006-03-02 21:18:58 +0000 | [diff] [blame] | 1527 | |
| 1528 | |
| 1529 | /** |
| 1530 | * Send IM typing indication inside INVITE session. |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1531 | * |
| 1532 | * @param call_id Call identification. |
| 1533 | * @param is_typing Non-zero to indicate to remote that local person is |
| 1534 | * currently typing an IM. |
| 1535 | * @param msg_data Optional list of headers etc to be included in outgoing |
| 1536 | * request. |
| 1537 | * |
| 1538 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | b080837 | 2006-03-02 21:18:58 +0000 | [diff] [blame] | 1539 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1540 | PJ_DECL(pj_status_t) pjsua_call_send_typing_ind(pjsua_call_id call_id, |
| 1541 | pj_bool_t is_typing, |
| 1542 | const pjsua_msg_data*msg_data); |
Benny Prijono | b080837 | 2006-03-02 21:18:58 +0000 | [diff] [blame] | 1543 | |
| 1544 | /** |
Benny Prijono | 834aee3 | 2006-02-19 01:38:06 +0000 | [diff] [blame] | 1545 | * Terminate all calls. |
| 1546 | */ |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 1547 | PJ_DECL(void) pjsua_call_hangup_all(void); |
Benny Prijono | 834aee3 | 2006-02-19 01:38:06 +0000 | [diff] [blame] | 1548 | |
| 1549 | |
Benny Prijono | b9b32ab | 2006-06-01 12:28:44 +0000 | [diff] [blame] | 1550 | /** |
| 1551 | * Dump call and media statistics to string. |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1552 | * |
| 1553 | * @param call_id Call identification. |
| 1554 | * @param with_media Non-zero to include media information too. |
| 1555 | * @param buffer Buffer where the statistics are to be written to. |
| 1556 | * @param maxlen Maximum length of buffer. |
| 1557 | * @param indent Spaces for left indentation. |
| 1558 | * |
| 1559 | * @return PJ_SUCCESS on success. |
Benny Prijono | b9b32ab | 2006-06-01 12:28:44 +0000 | [diff] [blame] | 1560 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1561 | PJ_DECL(pj_status_t) pjsua_call_dump(pjsua_call_id call_id, |
| 1562 | pj_bool_t with_media, |
| 1563 | char *buffer, |
| 1564 | unsigned maxlen, |
| 1565 | const char *indent); |
Benny Prijono | b9b32ab | 2006-06-01 12:28:44 +0000 | [diff] [blame] | 1566 | |
| 1567 | |
Benny Prijono | 268ca61 | 2006-02-07 12:34:11 +0000 | [diff] [blame] | 1568 | /***************************************************************************** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1569 | * PJSUA Account and Client Registration API. |
Benny Prijono | ccf9562 | 2006-02-07 18:48:01 +0000 | [diff] [blame] | 1570 | */ |
| 1571 | |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1572 | |
| 1573 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1574 | * Get number of current accounts. |
| 1575 | * |
| 1576 | * @return Current number of accounts. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1577 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1578 | PJ_DECL(unsigned) pjsua_acc_get_count(void); |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1579 | |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 1580 | |
| 1581 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1582 | * Check if the specified account ID is valid. |
| 1583 | * |
| 1584 | * @param acc_id Account ID to check. |
| 1585 | * |
| 1586 | * @return Non-zero if account ID is valid. |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 1587 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1588 | PJ_DECL(pj_bool_t) pjsua_acc_is_valid(pjsua_acc_id acc_id); |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 1589 | |
| 1590 | |
| 1591 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1592 | * Add a new account to pjsua. PJSUA must have been initialized (with |
| 1593 | * #pjsua_init()) before calling this function. |
| 1594 | * |
| 1595 | * @param cfg Account configuration. |
| 1596 | * @param is_default If non-zero, this account will be set as the default |
| 1597 | * account. The default account will be used when sending |
| 1598 | * outgoing requests (e.g. making call) when no account is |
| 1599 | * specified, and when receiving incoming requests when the |
| 1600 | * request does not match any accounts. It is recommended |
| 1601 | * that default account is set to local/LAN account. |
| 1602 | * @param p_acc_id Pointer to receive account ID of the new account. |
| 1603 | * |
| 1604 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1605 | */ |
| 1606 | PJ_DECL(pj_status_t) pjsua_acc_add(const pjsua_acc_config *cfg, |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1607 | pj_bool_t is_default, |
| 1608 | pjsua_acc_id *p_acc_id); |
| 1609 | |
| 1610 | |
| 1611 | /** |
| 1612 | * Add a local account. A local account is used to identify local endpoint |
| 1613 | * instead of a specific user, and for this reason, a transport ID is needed |
| 1614 | * to obtain the local address information. |
| 1615 | * |
| 1616 | * @param tid Transport ID to generate account address. |
| 1617 | * @param is_default If non-zero, this account will be set as the default |
| 1618 | * account. The default account will be used when sending |
| 1619 | * outgoing requests (e.g. making call) when no account is |
| 1620 | * specified, and when receiving incoming requests when the |
| 1621 | * request does not match any accounts. It is recommended |
| 1622 | * that default account is set to local/LAN account. |
| 1623 | * @param p_acc_id Pointer to receive account ID of the new account. |
| 1624 | * |
| 1625 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 1626 | */ |
| 1627 | PJ_DECL(pj_status_t) pjsua_acc_add_local(pjsua_transport_id tid, |
| 1628 | pj_bool_t is_default, |
| 1629 | pjsua_acc_id *p_acc_id); |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 1630 | |
| 1631 | /** |
| 1632 | * Delete account. |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1633 | * |
| 1634 | * @param acc_id Id of the account to be deleted. |
| 1635 | * |
| 1636 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 1637 | */ |
| 1638 | PJ_DECL(pj_status_t) pjsua_acc_del(pjsua_acc_id acc_id); |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1639 | |
| 1640 | |
| 1641 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1642 | * Modify account information. |
| 1643 | * |
| 1644 | * @param acc_id Id of the account to be modified. |
| 1645 | * @param cfg New account configuration. |
| 1646 | * |
| 1647 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 1648 | */ |
| 1649 | PJ_DECL(pj_status_t) pjsua_acc_modify(pjsua_acc_id acc_id, |
| 1650 | const pjsua_acc_config *cfg); |
| 1651 | |
| 1652 | |
| 1653 | /** |
| 1654 | * Modify account's presence status to be advertised to remote/presence |
| 1655 | * subscribers. |
| 1656 | * |
| 1657 | * @param acc_id The account ID. |
| 1658 | * @param is_online True of false. |
| 1659 | * |
| 1660 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1661 | */ |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 1662 | PJ_DECL(pj_status_t) pjsua_acc_set_online_status(pjsua_acc_id acc_id, |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1663 | pj_bool_t is_online); |
| 1664 | |
| 1665 | |
Benny Prijono | ccf9562 | 2006-02-07 18:48:01 +0000 | [diff] [blame] | 1666 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1667 | * Update registration or perform unregistration. |
| 1668 | * |
| 1669 | * @param acc_id The account ID. |
| 1670 | * @param renew If renew argument is zero, this will start |
| 1671 | * unregistration process. |
| 1672 | * |
| 1673 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | ccf9562 | 2006-02-07 18:48:01 +0000 | [diff] [blame] | 1674 | */ |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 1675 | PJ_DECL(pj_status_t) pjsua_acc_set_registration(pjsua_acc_id acc_id, |
| 1676 | pj_bool_t renew); |
Benny Prijono | ccf9562 | 2006-02-07 18:48:01 +0000 | [diff] [blame] | 1677 | |
| 1678 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1679 | /** |
| 1680 | * Get account information. |
| 1681 | * |
| 1682 | * @param acc_id Account identification. |
| 1683 | * @param info Pointer to receive account information. |
| 1684 | * |
| 1685 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 1686 | */ |
| 1687 | PJ_DECL(pj_status_t) pjsua_acc_get_info(pjsua_acc_id acc_id, |
| 1688 | pjsua_acc_info *info); |
| 1689 | |
| 1690 | |
| 1691 | /** |
| 1692 | * Enum accounts all account ids. |
| 1693 | * |
| 1694 | * @param ids Array of account IDs to be initialized. |
| 1695 | * @param count In input, specifies the maximum number of elements. |
| 1696 | * On return, it contains the actual number of elements. |
| 1697 | * |
| 1698 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 1699 | */ |
| 1700 | PJ_DECL(pj_status_t) pjsua_enum_accs(pjsua_acc_id ids[], |
| 1701 | unsigned *count ); |
| 1702 | |
| 1703 | |
| 1704 | /** |
| 1705 | * Enum accounts info. |
| 1706 | * |
| 1707 | * @param info Array of account infos to be initialized. |
| 1708 | * @param count In input, specifies the maximum number of elements. |
| 1709 | * On return, it contains the actual number of elements. |
| 1710 | * |
| 1711 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 1712 | */ |
| 1713 | PJ_DECL(pj_status_t) pjsua_acc_enum_info( pjsua_acc_info info[], |
| 1714 | unsigned *count ); |
| 1715 | |
| 1716 | |
| 1717 | /** |
| 1718 | * This is an internal function to find the most appropriate account to |
| 1719 | * used to reach to the specified URL. |
| 1720 | * |
| 1721 | * @param url The remote URL to reach. |
| 1722 | * |
| 1723 | * @return Account id. |
| 1724 | */ |
| 1725 | PJ_DECL(pjsua_acc_id) pjsua_acc_find_for_outgoing(const pj_str_t *url); |
| 1726 | |
| 1727 | |
| 1728 | /** |
| 1729 | * This is an internal function to find the most appropriate account to be |
| 1730 | * used to handle incoming calls. |
| 1731 | * |
| 1732 | * @param rdata The incoming request message. |
| 1733 | * |
| 1734 | * @return Account id. |
| 1735 | */ |
| 1736 | PJ_DECL(pjsua_acc_id) pjsua_acc_find_for_incoming(pjsip_rx_data *rdata); |
| 1737 | |
Benny Prijono | 834aee3 | 2006-02-19 01:38:06 +0000 | [diff] [blame] | 1738 | |
| 1739 | |
| 1740 | /***************************************************************************** |
| 1741 | * PJSUA Presence (pjsua_pres.c) |
| 1742 | */ |
| 1743 | |
| 1744 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1745 | * Get total number of buddies. |
| 1746 | * |
| 1747 | * @return Number of buddies. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1748 | */ |
| 1749 | PJ_DECL(unsigned) pjsua_get_buddy_count(void); |
| 1750 | |
| 1751 | |
| 1752 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1753 | * Check if buddy ID is valid. |
| 1754 | * |
| 1755 | * @param buddy_id Buddy ID to check. |
| 1756 | * |
| 1757 | * @return Non-zero if buddy ID is valid. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1758 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1759 | PJ_DECL(pj_bool_t) pjsua_buddy_is_valid(pjsua_buddy_id buddy_id); |
| 1760 | |
| 1761 | |
| 1762 | /** |
| 1763 | * Enum buddy IDs. |
| 1764 | * |
| 1765 | * @param ids Array of ids to be initialized. |
| 1766 | * @param count On input, specifies max elements in the array. |
| 1767 | * On return, it contains actual number of elements |
| 1768 | * that have been initialized. |
| 1769 | * |
| 1770 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 1771 | */ |
| 1772 | PJ_DECL(pj_status_t) pjsua_enum_buddies(pjsua_buddy_id ids[], |
| 1773 | unsigned *count); |
| 1774 | |
| 1775 | /** |
| 1776 | * Get detailed buddy info. |
| 1777 | * |
| 1778 | * @param buddy_id The buddy identification. |
| 1779 | * @param info Pointer to receive information about buddy. |
| 1780 | * |
| 1781 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 1782 | */ |
| 1783 | PJ_DECL(pj_status_t) pjsua_buddy_get_info(pjsua_buddy_id buddy_id, |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1784 | pjsua_buddy_info *info); |
| 1785 | |
| 1786 | /** |
| 1787 | * Add new buddy. |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1788 | * |
| 1789 | * @param cfg Buddy configuration. |
| 1790 | * @param p_buddy_id Pointer to receive buddy ID. |
| 1791 | * |
| 1792 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1793 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1794 | PJ_DECL(pj_status_t) pjsua_buddy_add(const pjsua_buddy_config *cfg, |
| 1795 | pjsua_buddy_id *p_buddy_id); |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 1796 | |
| 1797 | |
| 1798 | /** |
| 1799 | * Delete buddy. |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1800 | * |
| 1801 | * @param buddy_id Buddy identification. |
| 1802 | * |
| 1803 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 1804 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1805 | PJ_DECL(pj_status_t) pjsua_buddy_del(pjsua_buddy_id buddy_id); |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1806 | |
| 1807 | |
| 1808 | /** |
| 1809 | * Enable/disable buddy's presence monitoring. |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1810 | * |
| 1811 | * @param buddy_id Buddy identification. |
| 1812 | * @param subscribe Specify non-zero to activate presence subscription to |
| 1813 | * the specified buddy. |
| 1814 | * |
| 1815 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1816 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1817 | PJ_DECL(pj_status_t) pjsua_buddy_subscribe_pres(pjsua_buddy_id buddy_id, |
| 1818 | pj_bool_t subscribe); |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1819 | |
| 1820 | |
| 1821 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1822 | * Dump presence subscriptions to log file. |
| 1823 | * |
| 1824 | * @param verbose Yes or no. |
Benny Prijono | 834aee3 | 2006-02-19 01:38:06 +0000 | [diff] [blame] | 1825 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1826 | PJ_DECL(void) pjsua_pres_dump(pj_bool_t verbose); |
Benny Prijono | 834aee3 | 2006-02-19 01:38:06 +0000 | [diff] [blame] | 1827 | |
| 1828 | |
Benny Prijono | ccf9562 | 2006-02-07 18:48:01 +0000 | [diff] [blame] | 1829 | /***************************************************************************** |
Benny Prijono | b080837 | 2006-03-02 21:18:58 +0000 | [diff] [blame] | 1830 | * PJSUA Instant Messaging (pjsua_im.c) |
| 1831 | */ |
| 1832 | |
| 1833 | /** |
| 1834 | * The MESSAGE method (defined in pjsua_im.c) |
| 1835 | */ |
| 1836 | extern const pjsip_method pjsip_message_method; |
| 1837 | |
| 1838 | |
Benny Prijono | b080837 | 2006-03-02 21:18:58 +0000 | [diff] [blame] | 1839 | |
| 1840 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1841 | * Send instant messaging outside dialog, using the specified account for |
| 1842 | * route set and authentication. |
| 1843 | * |
| 1844 | * @param acc_id Account ID to be used to send the request. |
| 1845 | * @param to Remote URI. |
| 1846 | * @param mime_type Optional MIME type. If NULL, then "text/plain" is |
| 1847 | * assumed. |
| 1848 | * @param content The message content. |
| 1849 | * @param msg_data Optional list of headers etc to be included in outgoing |
| 1850 | * request. The body descriptor in the msg_data is |
| 1851 | * ignored. |
| 1852 | * @param user_data Optional user data, which will be given back when |
| 1853 | * the IM callback is called. |
| 1854 | * |
| 1855 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | b080837 | 2006-03-02 21:18:58 +0000 | [diff] [blame] | 1856 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1857 | PJ_DECL(pj_status_t) pjsua_im_send(pjsua_acc_id acc_id, |
| 1858 | const pj_str_t *to, |
| 1859 | const pj_str_t *mime_type, |
| 1860 | const pj_str_t *content, |
| 1861 | const pjsua_msg_data *msg_data, |
| 1862 | void *user_data); |
Benny Prijono | b080837 | 2006-03-02 21:18:58 +0000 | [diff] [blame] | 1863 | |
| 1864 | |
| 1865 | /** |
| 1866 | * Send typing indication outside dialog. |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1867 | * |
| 1868 | * @param acc_id Account ID to be used to send the request. |
| 1869 | * @param to Remote URI. |
| 1870 | * @param is_typing If non-zero, it tells remote person that local person |
| 1871 | * is currently composing an IM. |
| 1872 | * @param msg_data Optional list of headers etc to be added to outgoing |
| 1873 | * request. |
| 1874 | * |
| 1875 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | b080837 | 2006-03-02 21:18:58 +0000 | [diff] [blame] | 1876 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1877 | PJ_DECL(pj_status_t) pjsua_im_typing(pjsua_acc_id acc_id, |
| 1878 | const pj_str_t *to, |
| 1879 | pj_bool_t is_typing, |
| 1880 | const pjsua_msg_data *msg_data); |
Benny Prijono | b080837 | 2006-03-02 21:18:58 +0000 | [diff] [blame] | 1881 | |
| 1882 | |
Benny Prijono | f319507 | 2006-02-14 21:15:30 +0000 | [diff] [blame] | 1883 | |
| 1884 | /***************************************************************************** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1885 | * Conference bridge manipulation. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1886 | */ |
| 1887 | |
| 1888 | /** |
| 1889 | * Get maxinum number of conference ports. |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1890 | * |
| 1891 | * @return Maximum number of ports in the conference bridge. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1892 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1893 | PJ_DECL(unsigned) pjsua_conf_get_max_ports(void); |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1894 | |
| 1895 | |
| 1896 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1897 | * Get current number of active ports in the bridge. |
| 1898 | * |
| 1899 | * @return The number. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1900 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1901 | PJ_DECL(unsigned) pjsua_conf_get_active_ports(void); |
| 1902 | |
| 1903 | |
| 1904 | /** |
| 1905 | * Enumerate all conference ports. |
| 1906 | * |
| 1907 | * @param id Array of conference port ID to be initialized. |
| 1908 | * @param count On input, specifies max elements in the array. |
| 1909 | * On return, it contains actual number of elements |
| 1910 | * that have been initialized. |
| 1911 | * |
| 1912 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 1913 | */ |
| 1914 | PJ_DECL(pj_status_t) pjsua_enum_conf_ports(pjsua_conf_port_id id[], |
| 1915 | unsigned *count); |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 1916 | |
| 1917 | |
| 1918 | /** |
| 1919 | * Get information about the specified conference port |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1920 | * |
| 1921 | * @param id Port identification. |
| 1922 | * @param info Pointer to store the port info. |
| 1923 | * |
| 1924 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 1925 | */ |
| 1926 | PJ_DECL(pj_status_t) pjsua_conf_get_port_info( pjsua_conf_port_id id, |
| 1927 | pjsua_conf_port_info *info); |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1928 | |
| 1929 | |
| 1930 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1931 | * Establish unidirectional media flow from souce to sink. One source |
| 1932 | * may transmit to multiple destinations/sink. And if multiple |
| 1933 | * sources are transmitting to the same sink, the media will be mixed |
| 1934 | * together. Source and sink may refer to the same ID, effectively |
| 1935 | * looping the media. |
| 1936 | * |
| 1937 | * If bidirectional media flow is desired, application needs to call |
| 1938 | * this function twice, with the second one having the arguments |
| 1939 | * reversed. |
| 1940 | * |
| 1941 | * @param source Port ID of the source media/transmitter. |
| 1942 | * @param sink Port ID of the destination media/received. |
| 1943 | * |
| 1944 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1945 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1946 | PJ_DECL(pj_status_t) pjsua_conf_connect(pjsua_conf_port_id source, |
| 1947 | pjsua_conf_port_id sink); |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1948 | |
| 1949 | |
| 1950 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1951 | * Disconnect media flow from the source to destination port. |
| 1952 | * |
| 1953 | * @param source Port ID of the source media/transmitter. |
| 1954 | * @param sink Port ID of the destination media/received. |
| 1955 | * |
| 1956 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1957 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1958 | PJ_DECL(pj_status_t) pjsua_conf_disconnect(pjsua_conf_port_id source, |
| 1959 | pjsua_conf_port_id sink); |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1960 | |
| 1961 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1962 | /***************************************************************************** |
| 1963 | * File player. |
| 1964 | */ |
| 1965 | |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1966 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1967 | * Create a file player, and automatically connect this player to |
| 1968 | * the conference bridge. |
| 1969 | * |
| 1970 | * @param filename The filename to be played. Currently only |
| 1971 | * WAV files are supported. |
| 1972 | * @param options Options (currently zero). |
| 1973 | * @param user_data Arbitrary user data to be associated with the player. |
| 1974 | * @param p_id Pointer to receive player ID. |
| 1975 | * |
| 1976 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1977 | */ |
| 1978 | PJ_DECL(pj_status_t) pjsua_player_create(const pj_str_t *filename, |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1979 | unsigned options, |
| 1980 | void *user_data, |
| 1981 | pjsua_player_id *p_id); |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1982 | |
| 1983 | |
| 1984 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1985 | * Get conference port ID associated with player. |
| 1986 | * |
| 1987 | * @param id The file player ID. |
| 1988 | * |
| 1989 | * @return Conference port ID associated with this player. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1990 | */ |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 1991 | PJ_DECL(pjsua_conf_port_id) pjsua_player_get_conf_port(pjsua_player_id id); |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 1992 | |
| 1993 | |
| 1994 | /** |
| 1995 | * Set playback position. |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1996 | * |
| 1997 | * @param id The file player ID. |
| 1998 | * @param samples The playback position, in samples. Application can |
| 1999 | * specify zero to re-start the playback. |
| 2000 | * |
| 2001 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 2002 | */ |
| 2003 | PJ_DECL(pj_status_t) pjsua_player_set_pos(pjsua_player_id id, |
| 2004 | pj_uint32_t samples); |
| 2005 | |
| 2006 | |
| 2007 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 2008 | * Close the file, remove the player from the bridge, and free |
| 2009 | * resources associated with the file player. |
| 2010 | * |
| 2011 | * @param id The file player ID. |
| 2012 | * |
| 2013 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 2014 | */ |
| 2015 | PJ_DECL(pj_status_t) pjsua_player_destroy(pjsua_player_id id); |
| 2016 | |
| 2017 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 2018 | /***************************************************************************** |
| 2019 | * File recorder. |
| 2020 | */ |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 2021 | |
| 2022 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 2023 | * Create a file recorder, and automatically connect this recorder to |
| 2024 | * the conference bridge. |
| 2025 | * |
| 2026 | * @param filename Output file name. |
| 2027 | * @param file_format Specify the file format (currently only WAV is |
| 2028 | * supported, so the value MUST be zero). |
| 2029 | * @param encoding Specify the encoding to be applied to the file. |
| 2030 | * Currently only 16bit raw PCM is supported, so |
| 2031 | * the value must be NULL. |
| 2032 | * @param max_size Maximum file size. Specify -1 to remove size |
| 2033 | * limitation. |
| 2034 | * @param options Optional options. |
| 2035 | * @param user_data Arbitrary user data which will be given in the |
| 2036 | * callback once the recording complete. |
| 2037 | * @param p_id Pointer to receive the recorder instance. |
| 2038 | * |
| 2039 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 2040 | */ |
| 2041 | PJ_DECL(pj_status_t) pjsua_recorder_create(const pj_str_t *filename, |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 2042 | unsigned file_format, |
| 2043 | const pj_str_t *encoding, |
| 2044 | pj_ssize_t max_size, |
| 2045 | unsigned options, |
| 2046 | void *user_data, |
| 2047 | pjsua_recorder_id *p_id); |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 2048 | |
| 2049 | |
| 2050 | /** |
| 2051 | * Get conference port associated with recorder. |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 2052 | * |
| 2053 | * @param id The recorder ID. |
| 2054 | * |
| 2055 | * @return Conference port ID associated with this recorder. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 2056 | */ |
Benny Prijono | 8b1889b | 2006-06-06 18:40:40 +0000 | [diff] [blame] | 2057 | PJ_DECL(pjsua_conf_port_id) pjsua_recorder_get_conf_port(pjsua_recorder_id id); |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 2058 | |
| 2059 | |
| 2060 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 2061 | * Destroy recorder (this will complete recording). |
| 2062 | * |
| 2063 | * @param id The recorder ID. |
| 2064 | * |
| 2065 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 2066 | */ |
| 2067 | PJ_DECL(pj_status_t) pjsua_recorder_destroy(pjsua_recorder_id id); |
| 2068 | |
| 2069 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 2070 | /***************************************************************************** |
| 2071 | * Sound devices. |
| 2072 | */ |
| 2073 | |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 2074 | /** |
| 2075 | * Enum sound devices. |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 2076 | * |
| 2077 | * @param info Array of info to be initialized. |
| 2078 | * @param count On input, specifies max elements in the array. |
| 2079 | * On return, it contains actual number of elements |
| 2080 | * that have been initialized. |
| 2081 | * |
| 2082 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 2083 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 2084 | PJ_DECL(pj_status_t) pjsua_enum_snd_devs(pjmedia_snd_dev_info info[], |
| 2085 | unsigned *count); |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 2086 | |
| 2087 | |
| 2088 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 2089 | * Select or change sound device. Application may call this function at |
| 2090 | * any time to replace current sound device. |
| 2091 | * |
| 2092 | * @param capture_dev Device ID of the capture device. |
| 2093 | * @param playback_dev Device ID of the playback device. |
| 2094 | * |
| 2095 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 2096 | */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 2097 | PJ_DECL(pj_status_t) pjsua_set_snd_dev(int capture_dev, |
| 2098 | int playback_dev); |
| 2099 | |
| 2100 | |
| 2101 | /** |
| 2102 | * Set pjsua to use null sound device. The null sound device only provides |
| 2103 | * the timing needed by the conference bridge, and will not interract with |
| 2104 | * any hardware. |
| 2105 | * |
| 2106 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 2107 | */ |
| 2108 | PJ_DECL(pj_status_t) pjsua_set_null_snd_dev(void); |
| 2109 | |
| 2110 | |
| 2111 | /***************************************************************************** |
| 2112 | * Codecs. |
| 2113 | */ |
| 2114 | |
| 2115 | /** |
| 2116 | * Enum all supported codecs in the system. |
| 2117 | * |
| 2118 | * @param id Array of ID to be initialized. |
| 2119 | * @param count On input, specifies max elements in the array. |
| 2120 | * On return, it contains actual number of elements |
| 2121 | * that have been initialized. |
| 2122 | * |
| 2123 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 2124 | */ |
| 2125 | PJ_DECL(pj_status_t) pjsua_enum_codecs( pjsua_codec_info id[], |
| 2126 | unsigned *count ); |
| 2127 | |
| 2128 | |
| 2129 | /** |
| 2130 | * Change codec priority. |
| 2131 | * |
| 2132 | * @param id Codec ID. |
| 2133 | * @param priority Codec priority, 0-255, where zero means to disable |
| 2134 | * the codec. |
| 2135 | * |
| 2136 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 2137 | */ |
| 2138 | PJ_DECL(pj_status_t) pjsua_codec_set_priority( const pj_str_t *id, |
| 2139 | pj_uint8_t priority ); |
| 2140 | |
| 2141 | |
| 2142 | /** |
| 2143 | * Get codec parameters. |
| 2144 | * |
| 2145 | * @param id Codec ID. |
| 2146 | * @param param Structure to receive codec parameters. |
| 2147 | * |
| 2148 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 2149 | */ |
| 2150 | PJ_DECL(pj_status_t) pjsua_codec_get_param( const pj_str_t *id, |
| 2151 | pjmedia_codec_param *param ); |
| 2152 | |
| 2153 | |
| 2154 | /** |
| 2155 | * Set codec parameters. |
| 2156 | * |
| 2157 | * @param id Codec ID. |
| 2158 | * @param param Codec parameter to set. |
| 2159 | * |
| 2160 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 2161 | */ |
| 2162 | PJ_DECL(pj_status_t) pjsua_codec_set_param( const pj_str_t *id, |
| 2163 | const pjmedia_codec_param *param); |
| 2164 | |
| 2165 | |
| 2166 | |
Benny Prijono | 9fc735d | 2006-05-28 14:58:12 +0000 | [diff] [blame] | 2167 | |
| 2168 | |
| 2169 | /***************************************************************************** |
Benny Prijono | f319507 | 2006-02-14 21:15:30 +0000 | [diff] [blame] | 2170 | * Utilities. |
| 2171 | * |
| 2172 | */ |
| 2173 | |
Benny Prijono | f319507 | 2006-02-14 21:15:30 +0000 | [diff] [blame] | 2174 | /* |
| 2175 | * Verify that valid SIP url is given. |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 2176 | * |
| 2177 | * @param c_url The URL, as NULL terminated string. |
| 2178 | * |
| 2179 | * @return PJ_SUCCESS on success, or the appropriate error code. |
Benny Prijono | f319507 | 2006-02-14 21:15:30 +0000 | [diff] [blame] | 2180 | */ |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 2181 | PJ_DECL(pj_status_t) pjsua_verify_sip_url(const char *c_url); |
Benny Prijono | f319507 | 2006-02-14 21:15:30 +0000 | [diff] [blame] | 2182 | |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 2183 | |
| 2184 | /** |
| 2185 | * Display error message for the specified error code. |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 2186 | * |
| 2187 | * @param sender The log sender field. |
| 2188 | * @param title Message title for the error. |
| 2189 | * @param status Status code. |
Benny Prijono | dc39fe8 | 2006-05-26 12:17:46 +0000 | [diff] [blame] | 2190 | */ |
| 2191 | PJ_DECL(void) pjsua_perror(const char *sender, const char *title, |
| 2192 | pj_status_t status); |
| 2193 | |
| 2194 | |
Benny Prijono | f319507 | 2006-02-14 21:15:30 +0000 | [diff] [blame] | 2195 | |
Benny Prijono | 268ca61 | 2006-02-07 12:34:11 +0000 | [diff] [blame] | 2196 | |
Benny Prijono | 1a01ad3 | 2006-02-07 21:13:28 +0000 | [diff] [blame] | 2197 | PJ_END_DECL |
| 2198 | |
Benny Prijono | f319507 | 2006-02-14 21:15:30 +0000 | [diff] [blame] | 2199 | |
Benny Prijono | 268ca61 | 2006-02-07 12:34:11 +0000 | [diff] [blame] | 2200 | #endif /* __PJSUA_H__ */ |