Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1 | /* $Id$ */ |
| 2 | /* |
Benny Prijono | a771a51 | 2007-02-19 01:13:53 +0000 | [diff] [blame] | 3 | * Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org> |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 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_INTERNAL_H__ |
| 20 | #define __PJSUA_INTERNAL_H__ |
| 21 | |
| 22 | /** |
| 23 | * This is the private header used by pjsua library implementation. |
| 24 | * Applications should not include this file. |
| 25 | */ |
| 26 | |
| 27 | PJ_BEGIN_DECL |
| 28 | |
| 29 | /** |
| 30 | * Structure to be attached to invite dialog. |
| 31 | * Given a dialog "dlg", application can retrieve this structure |
| 32 | * by accessing dlg->mod_data[pjsua.mod.id]. |
| 33 | */ |
| 34 | typedef struct pjsua_call |
| 35 | { |
| 36 | unsigned index; /**< Index in pjsua array. */ |
| 37 | pjsip_inv_session *inv; /**< The invite session. */ |
| 38 | void *user_data; /**< User/application data. */ |
| 39 | pjsip_status_code last_code; /**< Last status code seen. */ |
| 40 | pj_str_t last_text; /**< Last status text seen. */ |
| 41 | pj_time_val start_time;/**< First INVITE sent/received. */ |
| 42 | pj_time_val res_time; /**< First response sent/received. */ |
| 43 | pj_time_val conn_time; /**< Connected/confirmed time. */ |
| 44 | pj_time_val dis_time; /**< Disconnect time. */ |
| 45 | pjsua_acc_id acc_id; /**< Account index being used. */ |
| 46 | pjsua_call_media_status media_st;/**< Media state. */ |
| 47 | pjmedia_dir media_dir; /**< Media direction. */ |
| 48 | pjmedia_session *session; /**< The media session. */ |
Benny Prijono | 8147f40 | 2007-11-21 14:50:07 +0000 | [diff] [blame] | 49 | pj_uint32_t ssrc; /**< RTP SSRC */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 50 | int conf_slot; /**< Slot # in conference bridge. */ |
| 51 | pjsip_evsub *xfer_sub; /**< Xfer server subscription, if this |
| 52 | call was triggered by xfer. */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 53 | pjmedia_transport *med_tp; /**< Media transport. */ |
| 54 | pj_timer_entry refresh_tm;/**< Timer to send re-INVITE. */ |
| 55 | pj_timer_entry hangup_tm; /**< Timer to hangup call. */ |
Benny Prijono | 91a6a17 | 2007-10-31 08:59:29 +0000 | [diff] [blame] | 56 | pj_stun_nat_type rem_nat_type; /**< NAT type of remote endpoint. */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 57 | |
| 58 | char last_text_buf_[128]; /**< Buffer for last_text. */ |
| 59 | |
| 60 | } pjsua_call; |
| 61 | |
| 62 | |
| 63 | /** |
| 64 | * Server presence subscription list head. |
| 65 | */ |
| 66 | typedef struct pjsua_srv_pres |
| 67 | { |
| 68 | PJ_DECL_LIST_MEMBER(struct pjsua_srv_pres); |
| 69 | pjsip_evsub *sub; |
| 70 | char *remote; |
| 71 | } pjsua_srv_pres; |
| 72 | |
| 73 | |
| 74 | /** |
| 75 | * Account |
| 76 | */ |
| 77 | typedef struct pjsua_acc |
| 78 | { |
| 79 | pjsua_acc_config cfg; /**< Account configuration. */ |
| 80 | pj_bool_t valid; /**< Is this account valid? */ |
| 81 | |
| 82 | int index; /**< Index in accounts array. */ |
Benny Prijono | c570f2d | 2006-07-18 00:33:02 +0000 | [diff] [blame] | 83 | pj_str_t display; /**< Display name, if any. */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 84 | pj_str_t user_part; /**< User part of local URI. */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 85 | |
Benny Prijono | b4a17c9 | 2006-07-10 14:40:21 +0000 | [diff] [blame] | 86 | pj_str_t srv_domain; /**< Host part of reg server. */ |
| 87 | int srv_port; /**< Port number of reg server. */ |
| 88 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 89 | pjsip_regc *regc; /**< Client registration session. */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 90 | pj_status_t reg_last_err; /**< Last registration error. */ |
| 91 | int reg_last_code; /**< Last status last register. */ |
| 92 | |
Benny Prijono | bddef2c | 2007-10-31 13:28:08 +0000 | [diff] [blame] | 93 | pj_timer_entry ka_timer; /**< Keep-alive timer for UDP. */ |
| 94 | pjsip_transport *ka_transport; /**< Transport for keep-alive. */ |
| 95 | pj_sockaddr ka_target; /**< Destination address for K-A */ |
| 96 | unsigned ka_target_len; /**< Length of ka_target. */ |
| 97 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 98 | pjsip_route_hdr route_set; /**< Complete route set inc. outbnd.*/ |
| 99 | |
| 100 | unsigned cred_cnt; /**< Number of credentials. */ |
| 101 | pjsip_cred_info cred[PJSUA_ACC_MAX_PROXIES]; /**< Complete creds. */ |
| 102 | |
| 103 | pj_bool_t online_status; /**< Our online status. */ |
Benny Prijono | 4461c7d | 2007-08-25 13:36:15 +0000 | [diff] [blame] | 104 | pjrpid_element rpid; /**< RPID element information. */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 105 | pjsua_srv_pres pres_srv_list; /**< Server subscription list. */ |
Benny Prijono | 3a5e1ab | 2006-08-15 20:26:34 +0000 | [diff] [blame] | 106 | pjsip_publishc *publish_sess; /**< Client publication session. */ |
| 107 | pj_bool_t publish_state; /**< Last published online status */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 108 | |
| 109 | } pjsua_acc; |
| 110 | |
| 111 | |
| 112 | /** |
| 113 | *Transport. |
| 114 | */ |
Benny Prijono | 62c5c5b | 2007-01-13 23:22:40 +0000 | [diff] [blame] | 115 | typedef struct pjsua_transport_data |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 116 | { |
Benny Prijono | e93e287 | 2006-06-28 16:46:49 +0000 | [diff] [blame] | 117 | int index; |
| 118 | pjsip_transport_type_e type; |
| 119 | pjsip_host_port local_name; |
| 120 | |
| 121 | union { |
| 122 | pjsip_transport *tp; |
| 123 | pjsip_tpfactory *factory; |
| 124 | void *ptr; |
| 125 | } data; |
| 126 | |
Benny Prijono | 62c5c5b | 2007-01-13 23:22:40 +0000 | [diff] [blame] | 127 | } pjsua_transport_data; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 128 | |
| 129 | |
| 130 | /** |
| 131 | * Buddy data. |
| 132 | */ |
| 133 | typedef struct pjsua_buddy |
| 134 | { |
| 135 | unsigned index; /**< Buddy index. */ |
| 136 | pj_str_t uri; /**< Buddy URI. */ |
| 137 | pj_str_t contact; /**< Contact learned from subscrp. */ |
| 138 | pj_str_t name; /**< Buddy name. */ |
| 139 | pj_str_t display; /**< Buddy display name. */ |
| 140 | pj_str_t host; /**< Buddy host. */ |
| 141 | unsigned port; /**< Buddy port. */ |
| 142 | pj_bool_t monitor; /**< Should we monitor? */ |
Benny Prijono | f9c40c3 | 2007-06-28 07:20:26 +0000 | [diff] [blame] | 143 | pjsip_dialog *dlg; /**< The underlying dialog. */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 144 | pjsip_evsub *sub; /**< Buddy presence subscription */ |
| 145 | pjsip_pres_status status; /**< Buddy presence status. */ |
| 146 | |
| 147 | } pjsua_buddy; |
| 148 | |
| 149 | |
| 150 | /** |
| 151 | * File player/recorder data. |
| 152 | */ |
| 153 | typedef struct pjsua_file_data |
| 154 | { |
Benny Prijono | a66c331 | 2007-01-21 23:12:40 +0000 | [diff] [blame] | 155 | pj_bool_t type; /* 0=player, 1=playlist */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 156 | pjmedia_port *port; |
Benny Prijono | d5696da | 2007-07-17 16:25:45 +0000 | [diff] [blame] | 157 | pj_pool_t *pool; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 158 | unsigned slot; |
| 159 | } pjsua_file_data; |
| 160 | |
| 161 | |
| 162 | /** |
| 163 | * Additional parameters for conference bridge. |
| 164 | */ |
| 165 | typedef struct pjsua_conf_setting |
| 166 | { |
| 167 | unsigned channel_count; |
| 168 | unsigned samples_per_frame; |
| 169 | unsigned bits_per_sample; |
| 170 | } pjsua_conf_setting; |
| 171 | |
| 172 | |
| 173 | /** |
| 174 | * Global pjsua application data. |
| 175 | */ |
| 176 | struct pjsua_data |
| 177 | { |
| 178 | |
| 179 | /* Control: */ |
| 180 | pj_caching_pool cp; /**< Global pool factory. */ |
| 181 | pj_pool_t *pool; /**< pjsua's private pool. */ |
| 182 | pj_mutex_t *mutex; /**< Mutex protection for this data */ |
| 183 | |
| 184 | /* Logging: */ |
| 185 | pjsua_logging_config log_cfg; /**< Current logging config. */ |
| 186 | pj_oshandle_t log_file; /**<Output log file handle */ |
| 187 | |
| 188 | /* SIP: */ |
| 189 | pjsip_endpoint *endpt; /**< Global endpoint. */ |
| 190 | pjsip_module mod; /**< pjsua's PJSIP module. */ |
Benny Prijono | 62c5c5b | 2007-01-13 23:22:40 +0000 | [diff] [blame] | 191 | pjsua_transport_data tpdata[8]; /**< Array of transports. */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 192 | |
| 193 | /* Threading: */ |
| 194 | pj_bool_t thread_quit_flag; /**< Thread quit flag. */ |
| 195 | pj_thread_t *thread[4]; /**< Array of threads. */ |
| 196 | |
Benny Prijono | c97608e | 2007-03-23 16:34:20 +0000 | [diff] [blame] | 197 | /* STUN and resolver */ |
| 198 | pj_stun_config stun_cfg; /**< Global STUN settings. */ |
| 199 | pj_sockaddr stun_srv; /**< Resolved STUN server address */ |
| 200 | pj_status_t stun_status; /**< STUN server status. */ |
| 201 | pj_dns_resolver *resolver; /**< DNS resolver. */ |
| 202 | |
Benny Prijono | 6ba8c54 | 2007-10-16 01:34:14 +0000 | [diff] [blame] | 203 | /* Detected NAT type */ |
| 204 | pj_stun_nat_type nat_type; /**< NAT type. */ |
| 205 | pj_status_t nat_status; /**< Detection status. */ |
| 206 | pj_bool_t nat_in_progress; /**< Detection in progress */ |
| 207 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 208 | /* Account: */ |
| 209 | unsigned acc_cnt; /**< Number of accounts. */ |
| 210 | pjsua_acc_id default_acc; /**< Default account ID */ |
| 211 | pjsua_acc acc[PJSUA_MAX_ACC]; /**< Account array. */ |
Benny Prijono | 093d302 | 2006-09-24 00:07:11 +0000 | [diff] [blame] | 212 | pjsua_acc_id acc_ids[PJSUA_MAX_ACC]; /**< Acc sorted by prio*/ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 213 | |
| 214 | /* Calls: */ |
| 215 | pjsua_config ua_cfg; /**< UA config. */ |
| 216 | unsigned call_cnt; /**< Call counter. */ |
| 217 | pjsua_call calls[PJSUA_MAX_CALLS];/**< Calls array. */ |
Benny Prijono | 5773cd6 | 2008-01-19 13:01:42 +0000 | [diff] [blame] | 218 | pjsua_call_id next_call_id; /**< Next call id to use*/ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 219 | |
| 220 | /* Buddy; */ |
| 221 | unsigned buddy_cnt; /**< Buddy count. */ |
| 222 | pjsua_buddy buddy[PJSUA_MAX_BUDDIES]; /**< Buddy array. */ |
| 223 | |
Benny Prijono | 7a5f510 | 2007-05-29 00:33:09 +0000 | [diff] [blame] | 224 | /* Presence: */ |
| 225 | pj_timer_entry pres_timer;/**< Presence refresh timer. */ |
| 226 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 227 | /* Media: */ |
| 228 | pjsua_media_config media_cfg; /**< Media config. */ |
| 229 | pjmedia_endpt *med_endpt; /**< Media endpoint. */ |
| 230 | pjsua_conf_setting mconf_cfg; /**< Additionan conf. bridge. param */ |
| 231 | pjmedia_conf *mconf; /**< Conference bridge. */ |
| 232 | int cap_dev; /**< Capture device ID. */ |
| 233 | int play_dev; /**< Playback device ID. */ |
Benny Prijono | e909eac | 2006-07-27 22:04:56 +0000 | [diff] [blame] | 234 | pj_bool_t no_snd; /**< No sound (app will manage it) */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 235 | pjmedia_snd_port *snd_port; /**< Sound port. */ |
| 236 | pjmedia_master_port *null_snd; /**< Master port for null sound. */ |
| 237 | pjmedia_port *null_port; /**< Null port. */ |
| 238 | |
| 239 | |
| 240 | /* File players: */ |
| 241 | unsigned player_cnt;/**< Number of file players. */ |
Benny Prijono | cba59d9 | 2007-02-16 09:22:56 +0000 | [diff] [blame] | 242 | pjsua_file_data player[PJSUA_MAX_PLAYERS];/**< Array of players.*/ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 243 | |
| 244 | /* File recorders: */ |
| 245 | unsigned rec_cnt; /**< Number of file recorders. */ |
Benny Prijono | cba59d9 | 2007-02-16 09:22:56 +0000 | [diff] [blame] | 246 | pjsua_file_data recorder[PJSUA_MAX_RECORDERS];/**< Array of recs.*/ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 247 | }; |
| 248 | |
| 249 | |
| 250 | extern struct pjsua_data pjsua_var; |
| 251 | |
Benny Prijono | 44e88ea | 2007-10-30 15:42:35 +0000 | [diff] [blame] | 252 | /** |
| 253 | * Get the instance of pjsua |
| 254 | */ |
| 255 | PJ_DECL(struct pjsua_data*) pjsua_get_var(void); |
| 256 | |
| 257 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 258 | |
| 259 | /** |
| 260 | * IM callback data. |
| 261 | */ |
| 262 | typedef struct pjsua_im_data |
| 263 | { |
| 264 | pjsua_acc_id acc_id; |
| 265 | pjsua_call_id call_id; |
| 266 | pj_str_t to; |
| 267 | pj_str_t body; |
| 268 | void *user_data; |
| 269 | } pjsua_im_data; |
| 270 | |
| 271 | |
| 272 | /** |
| 273 | * Duplicate IM data. |
| 274 | */ |
| 275 | PJ_INLINE(pjsua_im_data*) pjsua_im_data_dup(pj_pool_t *pool, |
| 276 | const pjsua_im_data *src) |
| 277 | { |
| 278 | pjsua_im_data *dst; |
| 279 | |
Benny Prijono | 07113c9 | 2006-11-21 08:38:00 +0000 | [diff] [blame] | 280 | dst = (pjsua_im_data*) pj_pool_alloc(pool, sizeof(*dst)); |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 281 | dst->acc_id = src->acc_id; |
| 282 | dst->call_id = src->call_id; |
| 283 | pj_strdup_with_null(pool, &dst->to, &src->to); |
| 284 | dst->user_data = src->user_data; |
| 285 | pj_strdup_with_null(pool, &dst->body, &src->body); |
| 286 | |
| 287 | return dst; |
| 288 | } |
| 289 | |
| 290 | |
Benny Prijono | 148c9dd | 2006-09-19 13:37:53 +0000 | [diff] [blame] | 291 | #if 1 |
| 292 | #define PJSUA_LOCK() pj_mutex_lock(pjsua_var.mutex) |
| 293 | #define PJSUA_TRY_LOCK() pj_mutex_trylock(pjsua_var.mutex) |
| 294 | #define PJSUA_UNLOCK() pj_mutex_unlock(pjsua_var.mutex) |
Benny Prijono | 3a5e1ab | 2006-08-15 20:26:34 +0000 | [diff] [blame] | 295 | #else |
| 296 | #define PJSUA_LOCK() |
Benny Prijono | 148c9dd | 2006-09-19 13:37:53 +0000 | [diff] [blame] | 297 | #define PJSUA_TRY_LOCK() PJ_SUCCESS |
Benny Prijono | 3a5e1ab | 2006-08-15 20:26:34 +0000 | [diff] [blame] | 298 | #define PJSUA_UNLOCK() |
| 299 | #endif |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 300 | |
| 301 | |
Benny Prijono | c97608e | 2007-03-23 16:34:20 +0000 | [diff] [blame] | 302 | /** |
| 303 | * Resolve STUN server. |
| 304 | */ |
| 305 | pj_status_t pjsua_resolve_stun_server(pj_bool_t wait); |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 306 | |
| 307 | /** |
| 308 | * Handle incoming invite request. |
| 309 | */ |
| 310 | pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata); |
| 311 | |
Benny Prijono | c97608e | 2007-03-23 16:34:20 +0000 | [diff] [blame] | 312 | /* |
| 313 | * Media channel. |
| 314 | */ |
| 315 | pj_status_t pjsua_media_channel_init(pjsua_call_id call_id, |
| 316 | pjsip_role_e role); |
| 317 | pj_status_t pjsua_media_channel_create_sdp(pjsua_call_id call_id, |
| 318 | pj_pool_t *pool, |
| 319 | pjmedia_sdp_session **p_sdp); |
| 320 | pj_status_t pjsua_media_channel_update(pjsua_call_id call_id, |
Benny Prijono | dbce2cf | 2007-03-28 16:24:00 +0000 | [diff] [blame] | 321 | const pjmedia_sdp_session *local_sdp, |
| 322 | const pjmedia_sdp_session *remote_sdp); |
Benny Prijono | c97608e | 2007-03-23 16:34:20 +0000 | [diff] [blame] | 323 | pj_status_t pjsua_media_channel_deinit(pjsua_call_id call_id); |
| 324 | |
| 325 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 326 | /** |
| 327 | * Init presence. |
| 328 | */ |
| 329 | pj_status_t pjsua_pres_init(); |
| 330 | |
| 331 | /* |
| 332 | * Start presence subsystem. |
| 333 | */ |
| 334 | pj_status_t pjsua_pres_start(void); |
| 335 | |
| 336 | /** |
| 337 | * Refresh presence subscriptions |
| 338 | */ |
| 339 | void pjsua_pres_refresh(void); |
| 340 | |
| 341 | /* |
Benny Prijono | 4461c7d | 2007-08-25 13:36:15 +0000 | [diff] [blame] | 342 | * Update server subscription (e.g. when our online status has changed) |
| 343 | */ |
| 344 | void pjsua_pres_update_acc(int acc_id, pj_bool_t force); |
| 345 | |
| 346 | /* |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 347 | * Shutdown presence. |
| 348 | */ |
| 349 | void pjsua_pres_shutdown(void); |
| 350 | |
| 351 | /** |
Benny Prijono | 3a5e1ab | 2006-08-15 20:26:34 +0000 | [diff] [blame] | 352 | * Init presence for aoocunt. |
| 353 | */ |
| 354 | pj_status_t pjsua_pres_init_acc(int acc_id); |
| 355 | |
| 356 | /** |
Benny Prijono | 8b6834f | 2007-02-24 13:29:22 +0000 | [diff] [blame] | 357 | * Send PUBLISH |
| 358 | */ |
| 359 | pj_status_t pjsua_pres_init_publish_acc(int acc_id); |
| 360 | |
| 361 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 362 | * Terminate server subscription for the account |
| 363 | */ |
| 364 | void pjsua_pres_delete_acc(int acc_id); |
| 365 | |
| 366 | /** |
| 367 | * Init IM module handler to handle incoming MESSAGE outside dialog. |
| 368 | */ |
| 369 | pj_status_t pjsua_im_init(void); |
| 370 | |
| 371 | /** |
| 372 | * Init call subsystem. |
| 373 | */ |
| 374 | pj_status_t pjsua_call_subsys_init(const pjsua_config *cfg); |
| 375 | |
| 376 | /** |
| 377 | * Start call subsystem. |
| 378 | */ |
| 379 | pj_status_t pjsua_call_subsys_start(void); |
| 380 | |
| 381 | /** |
| 382 | * Init media subsystems. |
| 383 | */ |
| 384 | pj_status_t pjsua_media_subsys_init(const pjsua_media_config *cfg); |
| 385 | |
| 386 | /** |
| 387 | * Start pjsua media subsystem. |
| 388 | */ |
| 389 | pj_status_t pjsua_media_subsys_start(void); |
| 390 | |
| 391 | /** |
| 392 | * Destroy pjsua media subsystem. |
| 393 | */ |
| 394 | pj_status_t pjsua_media_subsys_destroy(void); |
| 395 | |
| 396 | /** |
| 397 | * Private: check if we can accept the message. |
| 398 | * If not, then p_accept header will be filled with a valid |
| 399 | * Accept header. |
| 400 | */ |
| 401 | pj_bool_t pjsua_im_accept_pager(pjsip_rx_data *rdata, |
| 402 | pjsip_accept_hdr **p_accept_hdr); |
| 403 | |
| 404 | /** |
| 405 | * Private: process pager message. |
| 406 | * This may trigger pjsua_ui_on_pager() or pjsua_ui_on_typing(). |
| 407 | */ |
| 408 | void pjsua_im_process_pager(int call_id, const pj_str_t *from, |
| 409 | const pj_str_t *to, pjsip_rx_data *rdata); |
| 410 | |
| 411 | |
| 412 | /** |
| 413 | * Create Accept header for MESSAGE. |
| 414 | */ |
| 415 | pjsip_accept_hdr* pjsua_im_create_accept(pj_pool_t *pool); |
| 416 | |
| 417 | /* |
| 418 | * Add additional headers etc in msg_data specified by application |
| 419 | * when sending requests. |
| 420 | */ |
| 421 | void pjsua_process_msg_data(pjsip_tx_data *tdata, |
| 422 | const pjsua_msg_data *msg_data); |
| 423 | |
| 424 | |
| 425 | /* |
| 426 | * Add route_set to outgoing requests |
| 427 | */ |
| 428 | void pjsua_set_msg_route_set( pjsip_tx_data *tdata, |
| 429 | const pjsip_route_hdr *route_set ); |
| 430 | |
| 431 | |
| 432 | /* |
| 433 | * Simple version of MIME type parsing (it doesn't support parameters) |
| 434 | */ |
| 435 | void pjsua_parse_media_type( pj_pool_t *pool, |
| 436 | const pj_str_t *mime, |
| 437 | pjsip_media_type *media_type); |
| 438 | |
| 439 | |
Benny Prijono | 62c5c5b | 2007-01-13 23:22:40 +0000 | [diff] [blame] | 440 | /* |
| 441 | * Internal function to init transport selector from transport id. |
| 442 | */ |
| 443 | void pjsua_init_tpselector(pjsua_transport_id tp_id, |
| 444 | pjsip_tpselector *sel); |
| 445 | |
| 446 | |
Benny Prijono | 627cbb4 | 2007-09-25 20:48:49 +0000 | [diff] [blame] | 447 | pj_status_t acquire_call(const char *title, |
| 448 | pjsua_call_id call_id, |
| 449 | pjsua_call **p_call, |
| 450 | pjsip_dialog **p_dlg); |
| 451 | const char *good_number(char *buf, pj_int32_t val); |
| 452 | void print_call(const char *title, |
| 453 | int call_id, |
| 454 | char *buf, pj_size_t size); |
| 455 | |
Benny Prijono | 62c5c5b | 2007-01-13 23:22:40 +0000 | [diff] [blame] | 456 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 457 | PJ_END_DECL |
| 458 | |
| 459 | #endif /* __PJSUA_INTERNAL_H__ */ |
| 460 | |