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