Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 1 | /* $Id$ */ |
| 2 | /* |
Benny Prijono | 844653c | 2008-12-23 17:27:53 +0000 | [diff] [blame] | 3 | * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com) |
Benny Prijono | 32177c0 | 2008-06-20 22:44:47 +0000 | [diff] [blame] | 4 | * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | */ |
| 20 | #ifndef __PJSUA_INTERNAL_H__ |
| 21 | #define __PJSUA_INTERNAL_H__ |
| 22 | |
| 23 | /** |
| 24 | * This is the private header used by pjsua library implementation. |
| 25 | * Applications should not include this file. |
| 26 | */ |
| 27 | |
| 28 | PJ_BEGIN_DECL |
| 29 | |
| 30 | /** |
Benny Prijono | 224b4e2 | 2008-06-19 14:10:28 +0000 | [diff] [blame] | 31 | * Media transport state. |
| 32 | */ |
| 33 | typedef enum pjsua_med_tp_st |
| 34 | { |
| 35 | /** Not initialized */ |
| 36 | PJSUA_MED_TP_IDLE, |
| 37 | |
| 38 | /** Initialized (media_create() has been called) */ |
| 39 | PJSUA_MED_TP_INIT, |
| 40 | |
| 41 | /** Running (media_start() has been called) */ |
Nanang Izzuddin | b6c239c | 2011-05-10 05:42:28 +0000 | [diff] [blame] | 42 | PJSUA_MED_TP_RUNNING, |
| 43 | |
| 44 | /** Disabled (transport is initialized, but media is being disabled) */ |
| 45 | PJSUA_MED_TP_DISABLED |
Benny Prijono | 224b4e2 | 2008-06-19 14:10:28 +0000 | [diff] [blame] | 46 | |
| 47 | } pjsua_med_tp_st; |
| 48 | |
Benny Prijono | 0bc99a9 | 2011-03-17 04:34:43 +0000 | [diff] [blame] | 49 | /** Forward decl of pjsua call */ |
| 50 | typedef struct pjsua_call pjsua_call; |
| 51 | |
Nanang Izzuddin | 62053a6 | 2011-07-12 11:08:32 +0000 | [diff] [blame] | 52 | |
Benny Prijono | 0bc99a9 | 2011-03-17 04:34:43 +0000 | [diff] [blame] | 53 | /** |
| 54 | * Call's media stream. |
| 55 | */ |
| 56 | typedef struct pjsua_call_media |
| 57 | { |
| 58 | pjsua_call *call; /**< Parent call. */ |
| 59 | pjmedia_type type; /**< Media type. */ |
| 60 | unsigned idx; /**< This media index in parent call. */ |
| 61 | pjsua_call_media_status state; /**< Media state. */ |
| 62 | pjmedia_dir dir; /**< Media direction. */ |
| 63 | |
| 64 | /** The stream */ |
Benny Prijono | 9b61ff5 | 2011-03-18 09:55:48 +0000 | [diff] [blame] | 65 | struct { |
Benny Prijono | 0bc99a9 | 2011-03-17 04:34:43 +0000 | [diff] [blame] | 66 | /** Audio stream */ |
| 67 | struct { |
Nanang Izzuddin | bf26db1 | 2011-03-18 07:54:50 +0000 | [diff] [blame] | 68 | pjmedia_stream *stream; /**< The audio stream. */ |
Benny Prijono | 0bc99a9 | 2011-03-17 04:34:43 +0000 | [diff] [blame] | 69 | int conf_slot; /**< Slot # in conference bridge. */ |
| 70 | } a; |
| 71 | |
| 72 | /** Video stream */ |
| 73 | struct { |
Nanang Izzuddin | bf26db1 | 2011-03-18 07:54:50 +0000 | [diff] [blame] | 74 | pjmedia_vid_stream *stream; /**< The video stream. */ |
Nanang Izzuddin | 62053a6 | 2011-07-12 11:08:32 +0000 | [diff] [blame] | 75 | pjsua_vid_win_id cap_win_id;/**< The video capture window */ |
| 76 | pjsua_vid_win_id rdr_win_id;/**< The video render window */ |
Nanang Izzuddin | b4d4dad | 2011-07-13 08:51:10 +0000 | [diff] [blame] | 77 | pjmedia_vid_dev_index cap_dev; /**< The video capture device */ |
| 78 | pjmedia_vid_dev_index rdr_dev; /**< The video-in render device */ |
Benny Prijono | 0bc99a9 | 2011-03-17 04:34:43 +0000 | [diff] [blame] | 79 | } v; |
| 80 | |
| 81 | } strm; |
| 82 | |
| 83 | pj_uint32_t ssrc; /**< RTP SSRC */ |
| 84 | pj_uint32_t rtp_tx_ts; /**< Initial RTP timestamp for sender. */ |
| 85 | pj_uint16_t rtp_tx_seq;/**< Initial RTP sequence for sender. */ |
| 86 | pj_uint8_t rtp_tx_seq_ts_set; |
| 87 | /**< Bitmask flags if initial RTP sequence |
| 88 | and/or timestamp for sender are set. |
| 89 | bit 0/LSB : sequence flag |
| 90 | bit 1 : timestamp flag */ |
| 91 | |
| 92 | pjmedia_transport *tp; /**< Current media transport (can be 0) */ |
| 93 | pj_status_t tp_ready; /**< Media transport status. */ |
| 94 | pjmedia_transport *tp_orig; /**< Original media transport */ |
| 95 | pj_bool_t tp_auto_del; /**< May delete media transport */ |
| 96 | pjsua_med_tp_st tp_st; /**< Media transport state */ |
| 97 | pj_sockaddr rtp_addr; /**< Current RTP source address |
| 98 | (used to update ICE default |
| 99 | address) */ |
| 100 | pjmedia_srtp_use rem_srtp_use; /**< Remote's SRTP usage policy. */ |
Benny Prijono | ee0ba18 | 2011-07-15 06:18:29 +0000 | [diff] [blame^] | 101 | |
| 102 | pjmedia_event_subscription esub;/**< To subscribe to media events. */ |
Benny Prijono | 0bc99a9 | 2011-03-17 04:34:43 +0000 | [diff] [blame] | 103 | } pjsua_call_media; |
| 104 | |
| 105 | /** |
| 106 | * Maximum number of SDP "m=" lines to be supported. |
| 107 | */ |
| 108 | #define PJSUA_MAX_CALL_MEDIA PJMEDIA_MAX_SDP_MEDIA |
| 109 | |
Benny Prijono | 224b4e2 | 2008-06-19 14:10:28 +0000 | [diff] [blame] | 110 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 111 | * Structure to be attached to invite dialog. |
| 112 | * Given a dialog "dlg", application can retrieve this structure |
| 113 | * by accessing dlg->mod_data[pjsua.mod.id]. |
| 114 | */ |
Benny Prijono | 0bc99a9 | 2011-03-17 04:34:43 +0000 | [diff] [blame] | 115 | struct pjsua_call |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 116 | { |
| 117 | unsigned index; /**< Index in pjsua array. */ |
| 118 | pjsip_inv_session *inv; /**< The invite session. */ |
| 119 | void *user_data; /**< User/application data. */ |
| 120 | pjsip_status_code last_code; /**< Last status code seen. */ |
| 121 | pj_str_t last_text; /**< Last status text seen. */ |
| 122 | pj_time_val start_time;/**< First INVITE sent/received. */ |
| 123 | pj_time_val res_time; /**< First response sent/received. */ |
| 124 | pj_time_val conn_time; /**< Connected/confirmed time. */ |
| 125 | pj_time_val dis_time; /**< Disconnect time. */ |
| 126 | pjsua_acc_id acc_id; /**< Account index being used. */ |
Benny Prijono | db844a4 | 2008-02-02 17:07:18 +0000 | [diff] [blame] | 127 | int secure_level;/**< Signaling security level. */ |
Benny Prijono | dd63b99 | 2010-10-01 02:03:42 +0000 | [diff] [blame] | 128 | pjsua_call_hold_type call_hold_type; /**< How to do call hold. */ |
Nanang Izzuddin | 99d6952 | 2008-08-04 15:01:38 +0000 | [diff] [blame] | 129 | pj_bool_t local_hold;/**< Flag for call-hold by local. */ |
Benny Prijono | 0bc99a9 | 2011-03-17 04:34:43 +0000 | [diff] [blame] | 130 | |
| 131 | unsigned med_cnt; /**< Number of media in SDP. */ |
| 132 | pjsua_call_media media[PJSUA_MAX_CALL_MEDIA]; /**< Array of media */ |
Nanang Izzuddin | bf26db1 | 2011-03-18 07:54:50 +0000 | [diff] [blame] | 133 | int audio_idx; /**< First active audio media. */ |
Benny Prijono | 0bc99a9 | 2011-03-17 04:34:43 +0000 | [diff] [blame] | 134 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 135 | pjsip_evsub *xfer_sub; /**< Xfer server subscription, if this |
| 136 | call was triggered by xfer. */ |
Benny Prijono | 91a6a17 | 2007-10-31 08:59:29 +0000 | [diff] [blame] | 137 | pj_stun_nat_type rem_nat_type; /**< NAT type of remote endpoint. */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 138 | |
| 139 | char last_text_buf_[128]; /**< Buffer for last_text. */ |
| 140 | |
Nanang Izzuddin | 93bacd0 | 2010-06-15 09:56:39 +0000 | [diff] [blame] | 141 | struct { |
| 142 | pj_timer_entry reinv_timer;/**< Reinvite retry timer. */ |
Benny Prijono | 1e60155 | 2010-10-20 05:31:08 +0000 | [diff] [blame] | 143 | pj_uint32_t sdp_ver; /**< SDP version of the bad answer */ |
| 144 | int retry_cnt; /**< Retry count. */ |
Nanang Izzuddin | ec91900 | 2010-11-25 09:27:06 +0000 | [diff] [blame] | 145 | pj_bool_t pending; /**< Pending until CONFIRMED state */ |
Nanang Izzuddin | 93bacd0 | 2010-06-15 09:56:39 +0000 | [diff] [blame] | 146 | } lock_codec; /**< Data for codec locking when answer |
| 147 | contains multiple codecs. */ |
| 148 | |
Benny Prijono | 0bc99a9 | 2011-03-17 04:34:43 +0000 | [diff] [blame] | 149 | }; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 150 | |
| 151 | |
| 152 | /** |
| 153 | * Server presence subscription list head. |
| 154 | */ |
Benny Prijono | 63fba01 | 2008-07-17 14:19:10 +0000 | [diff] [blame] | 155 | struct pjsua_srv_pres |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 156 | { |
| 157 | PJ_DECL_LIST_MEMBER(struct pjsua_srv_pres); |
Benny Prijono | 63fba01 | 2008-07-17 14:19:10 +0000 | [diff] [blame] | 158 | pjsip_evsub *sub; /**< The evsub. */ |
| 159 | char *remote; /**< Remote URI. */ |
| 160 | int acc_id; /**< Account ID. */ |
| 161 | pjsip_dialog *dlg; /**< Dialog. */ |
| 162 | int expires; /**< "expires" value in the request. */ |
| 163 | }; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 164 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 165 | /** |
| 166 | * Account |
| 167 | */ |
| 168 | typedef struct pjsua_acc |
| 169 | { |
Benny Prijono | c91ed8d | 2008-07-13 12:24:55 +0000 | [diff] [blame] | 170 | pj_pool_t *pool; /**< Pool for this account. */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 171 | pjsua_acc_config cfg; /**< Account configuration. */ |
| 172 | pj_bool_t valid; /**< Is this account valid? */ |
| 173 | |
| 174 | int index; /**< Index in accounts array. */ |
Benny Prijono | c570f2d | 2006-07-18 00:33:02 +0000 | [diff] [blame] | 175 | pj_str_t display; /**< Display name, if any. */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 176 | pj_str_t user_part; /**< User part of local URI. */ |
Nanang Izzuddin | 5af37ff | 2009-08-05 18:41:23 +0000 | [diff] [blame] | 177 | pj_str_t contact; /**< Our Contact header. */ |
Benny Prijono | b54719f | 2010-11-16 03:07:46 +0000 | [diff] [blame] | 178 | pj_str_t reg_contact; /**< Contact header for REGISTER. |
| 179 | It may be different than acc |
| 180 | contact if outbound is used */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 181 | |
Benny Prijono | b4a17c9 | 2006-07-10 14:40:21 +0000 | [diff] [blame] | 182 | pj_str_t srv_domain; /**< Host part of reg server. */ |
| 183 | int srv_port; /**< Port number of reg server. */ |
| 184 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 185 | pjsip_regc *regc; /**< Client registration session. */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 186 | pj_status_t reg_last_err; /**< Last registration error. */ |
| 187 | int reg_last_code; /**< Last status last register. */ |
| 188 | |
Nanang Izzuddin | 36dd5b6 | 2010-03-30 11:13:59 +0000 | [diff] [blame] | 189 | struct { |
| 190 | pj_bool_t active; /**< Flag of reregister status. */ |
| 191 | pj_timer_entry timer; /**< Timer for reregistration. */ |
| 192 | void *reg_tp; /**< Transport for registration. */ |
| 193 | unsigned attempt_cnt; /**< Attempt counter. */ |
| 194 | } auto_rereg; /**< Reregister/reconnect data. */ |
| 195 | |
Benny Prijono | bddef2c | 2007-10-31 13:28:08 +0000 | [diff] [blame] | 196 | pj_timer_entry ka_timer; /**< Keep-alive timer for UDP. */ |
| 197 | pjsip_transport *ka_transport; /**< Transport for keep-alive. */ |
| 198 | pj_sockaddr ka_target; /**< Destination address for K-A */ |
| 199 | unsigned ka_target_len; /**< Length of ka_target. */ |
| 200 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 201 | pjsip_route_hdr route_set; /**< Complete route set inc. outbnd.*/ |
Nanang Izzuddin | c3ea16a | 2010-04-20 14:36:38 +0000 | [diff] [blame] | 202 | pj_uint32_t global_route_crc; /** CRC of global route setting. */ |
| 203 | pj_uint32_t local_route_crc; /** CRC of account route setting.*/ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 204 | |
Benny Prijono | b54719f | 2010-11-16 03:07:46 +0000 | [diff] [blame] | 205 | unsigned rfc5626_status;/**< SIP outbound status: |
| 206 | 0: not used |
| 207 | 1: requested |
| 208 | 2: acknowledged by servers */ |
| 209 | pj_str_t rfc5626_instprm;/**< SIP outbound instance param. */ |
| 210 | pj_str_t rfc5626_regprm;/**< SIP outbound reg param. */ |
| 211 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 212 | unsigned cred_cnt; /**< Number of credentials. */ |
| 213 | pjsip_cred_info cred[PJSUA_ACC_MAX_PROXIES]; /**< Complete creds. */ |
| 214 | |
| 215 | pj_bool_t online_status; /**< Our online status. */ |
Benny Prijono | 4461c7d | 2007-08-25 13:36:15 +0000 | [diff] [blame] | 216 | pjrpid_element rpid; /**< RPID element information. */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 217 | pjsua_srv_pres pres_srv_list; /**< Server subscription list. */ |
Benny Prijono | 3a5e1ab | 2006-08-15 20:26:34 +0000 | [diff] [blame] | 218 | pjsip_publishc *publish_sess; /**< Client publication session. */ |
| 219 | pj_bool_t publish_state; /**< Last published online status */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 220 | |
Benny Prijono | 4dd961b | 2009-10-26 11:21:37 +0000 | [diff] [blame] | 221 | pjsip_evsub *mwi_sub; /**< MWI client subscription */ |
| 222 | pjsip_dialog *mwi_dlg; /**< Dialog for MWI sub. */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 223 | } pjsua_acc; |
| 224 | |
| 225 | |
| 226 | /** |
| 227 | *Transport. |
| 228 | */ |
Benny Prijono | 62c5c5b | 2007-01-13 23:22:40 +0000 | [diff] [blame] | 229 | typedef struct pjsua_transport_data |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 230 | { |
Benny Prijono | e93e287 | 2006-06-28 16:46:49 +0000 | [diff] [blame] | 231 | int index; |
| 232 | pjsip_transport_type_e type; |
| 233 | pjsip_host_port local_name; |
| 234 | |
| 235 | union { |
| 236 | pjsip_transport *tp; |
| 237 | pjsip_tpfactory *factory; |
| 238 | void *ptr; |
| 239 | } data; |
| 240 | |
Benny Prijono | 62c5c5b | 2007-01-13 23:22:40 +0000 | [diff] [blame] | 241 | } pjsua_transport_data; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 242 | |
| 243 | |
Benny Prijono | 63fba01 | 2008-07-17 14:19:10 +0000 | [diff] [blame] | 244 | /** Maximum length of subscription termination reason. */ |
| 245 | #define PJSUA_BUDDY_SUB_TERM_REASON_LEN 32 |
| 246 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 247 | /** |
| 248 | * Buddy data. |
| 249 | */ |
| 250 | typedef struct pjsua_buddy |
| 251 | { |
Benny Prijono | c91ed8d | 2008-07-13 12:24:55 +0000 | [diff] [blame] | 252 | pj_pool_t *pool; /**< Pool for this buddy. */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 253 | unsigned index; /**< Buddy index. */ |
Benny Prijono | 705e784 | 2008-07-21 18:12:51 +0000 | [diff] [blame] | 254 | void *user_data; /**< Application data. */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 255 | pj_str_t uri; /**< Buddy URI. */ |
| 256 | pj_str_t contact; /**< Contact learned from subscrp. */ |
| 257 | pj_str_t name; /**< Buddy name. */ |
| 258 | pj_str_t display; /**< Buddy display name. */ |
| 259 | pj_str_t host; /**< Buddy host. */ |
| 260 | unsigned port; /**< Buddy port. */ |
| 261 | pj_bool_t monitor; /**< Should we monitor? */ |
Benny Prijono | f9c40c3 | 2007-06-28 07:20:26 +0000 | [diff] [blame] | 262 | pjsip_dialog *dlg; /**< The underlying dialog. */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 263 | pjsip_evsub *sub; /**< Buddy presence subscription */ |
Benny Prijono | 73bb723 | 2009-10-20 13:56:26 +0000 | [diff] [blame] | 264 | unsigned term_code; /**< Subscription termination code */ |
Benny Prijono | 63fba01 | 2008-07-17 14:19:10 +0000 | [diff] [blame] | 265 | pj_str_t term_reason;/**< Subscription termination reason */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 266 | pjsip_pres_status status; /**< Buddy presence status. */ |
Benny Prijono | 73bb723 | 2009-10-20 13:56:26 +0000 | [diff] [blame] | 267 | pj_timer_entry timer; /**< Resubscription timer */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 268 | } pjsua_buddy; |
| 269 | |
| 270 | |
| 271 | /** |
| 272 | * File player/recorder data. |
| 273 | */ |
| 274 | typedef struct pjsua_file_data |
| 275 | { |
Benny Prijono | a66c331 | 2007-01-21 23:12:40 +0000 | [diff] [blame] | 276 | pj_bool_t type; /* 0=player, 1=playlist */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 277 | pjmedia_port *port; |
Benny Prijono | d5696da | 2007-07-17 16:25:45 +0000 | [diff] [blame] | 278 | pj_pool_t *pool; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 279 | unsigned slot; |
| 280 | } pjsua_file_data; |
| 281 | |
| 282 | |
| 283 | /** |
| 284 | * Additional parameters for conference bridge. |
| 285 | */ |
| 286 | typedef struct pjsua_conf_setting |
| 287 | { |
| 288 | unsigned channel_count; |
| 289 | unsigned samples_per_frame; |
| 290 | unsigned bits_per_sample; |
| 291 | } pjsua_conf_setting; |
| 292 | |
Benny Prijono | bb995fd | 2009-08-12 11:03:23 +0000 | [diff] [blame] | 293 | typedef struct pjsua_stun_resolve |
| 294 | { |
| 295 | PJ_DECL_LIST_MEMBER(struct pjsua_stun_resolve); |
| 296 | |
| 297 | pj_pool_t *pool; /**< Pool */ |
| 298 | unsigned count; /**< # of entries */ |
| 299 | pj_str_t *srv; /**< Array of entries */ |
| 300 | unsigned idx; /**< Current index */ |
| 301 | void *token; /**< App token */ |
| 302 | pj_stun_resolve_cb cb; /**< App callback */ |
| 303 | pj_bool_t blocking; /**< Blocking? */ |
| 304 | pj_status_t status; /**< Session status */ |
| 305 | pj_sockaddr addr; /**< Result */ |
| 306 | pj_stun_sock *stun_sock; /**< Testing STUN sock */ |
| 307 | } pjsua_stun_resolve; |
| 308 | |
Benny Prijono | 9f468d1 | 2011-07-07 07:46:33 +0000 | [diff] [blame] | 309 | typedef enum pjsua_vid_win_type |
| 310 | { |
| 311 | PJSUA_WND_TYPE_NONE, |
| 312 | PJSUA_WND_TYPE_PREVIEW, |
| 313 | PJSUA_WND_TYPE_STREAM |
| 314 | } pjsua_vid_win_type; |
| 315 | |
| 316 | typedef struct pjsua_vid_win |
| 317 | { |
| 318 | pjsua_vid_win_type type; /**< Type. */ |
| 319 | pj_pool_t *pool; /**< Own pool. */ |
Nanang Izzuddin | 62053a6 | 2011-07-12 11:08:32 +0000 | [diff] [blame] | 320 | unsigned ref_cnt; /**< Reference counter. */ |
Benny Prijono | 9f468d1 | 2011-07-07 07:46:33 +0000 | [diff] [blame] | 321 | pjmedia_vid_port *vp_cap; /**< Capture vidport. */ |
| 322 | pjmedia_vid_port *vp_rend; /**< Renderer vidport */ |
Nanang Izzuddin | 62053a6 | 2011-07-12 11:08:32 +0000 | [diff] [blame] | 323 | pjmedia_port *tee; /**< Video tee */ |
Benny Prijono | 9f468d1 | 2011-07-07 07:46:33 +0000 | [diff] [blame] | 324 | pjmedia_vid_dev_index preview_cap_id;/* Capture dev id */ |
| 325 | } pjsua_vid_win; |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 326 | |
| 327 | /** |
| 328 | * Global pjsua application data. |
| 329 | */ |
| 330 | struct pjsua_data |
| 331 | { |
| 332 | |
| 333 | /* Control: */ |
| 334 | pj_caching_pool cp; /**< Global pool factory. */ |
| 335 | pj_pool_t *pool; /**< pjsua's private pool. */ |
| 336 | pj_mutex_t *mutex; /**< Mutex protection for this data */ |
Benny Prijono | 0bc99a9 | 2011-03-17 04:34:43 +0000 | [diff] [blame] | 337 | pjsua_state state; /**< Library state. */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 338 | |
| 339 | /* Logging: */ |
| 340 | pjsua_logging_config log_cfg; /**< Current logging config. */ |
| 341 | pj_oshandle_t log_file; /**<Output log file handle */ |
| 342 | |
| 343 | /* SIP: */ |
| 344 | pjsip_endpoint *endpt; /**< Global endpoint. */ |
| 345 | pjsip_module mod; /**< pjsua's PJSIP module. */ |
Benny Prijono | 62c5c5b | 2007-01-13 23:22:40 +0000 | [diff] [blame] | 346 | pjsua_transport_data tpdata[8]; /**< Array of transports. */ |
Benny Prijono | 2140732 | 2010-03-10 13:33:25 +0000 | [diff] [blame] | 347 | pjsip_tp_state_callback old_tp_cb; /**< Old transport callback. */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 348 | |
| 349 | /* Threading: */ |
| 350 | pj_bool_t thread_quit_flag; /**< Thread quit flag. */ |
| 351 | pj_thread_t *thread[4]; /**< Array of threads. */ |
| 352 | |
Benny Prijono | c97608e | 2007-03-23 16:34:20 +0000 | [diff] [blame] | 353 | /* STUN and resolver */ |
| 354 | pj_stun_config stun_cfg; /**< Global STUN settings. */ |
| 355 | pj_sockaddr stun_srv; /**< Resolved STUN server address */ |
| 356 | pj_status_t stun_status; /**< STUN server status. */ |
Benny Prijono | bb995fd | 2009-08-12 11:03:23 +0000 | [diff] [blame] | 357 | pjsua_stun_resolve stun_res; /**< List of pending STUN resolution*/ |
Benny Prijono | c97608e | 2007-03-23 16:34:20 +0000 | [diff] [blame] | 358 | pj_dns_resolver *resolver; /**< DNS resolver. */ |
| 359 | |
Benny Prijono | 6ba8c54 | 2007-10-16 01:34:14 +0000 | [diff] [blame] | 360 | /* Detected NAT type */ |
| 361 | pj_stun_nat_type nat_type; /**< NAT type. */ |
| 362 | pj_status_t nat_status; /**< Detection status. */ |
| 363 | pj_bool_t nat_in_progress; /**< Detection in progress */ |
| 364 | |
Benny Prijono | 29c8ca3 | 2010-06-22 06:02:13 +0000 | [diff] [blame] | 365 | /* List of outbound proxies: */ |
| 366 | pjsip_route_hdr outbound_proxy; |
| 367 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 368 | /* Account: */ |
| 369 | unsigned acc_cnt; /**< Number of accounts. */ |
| 370 | pjsua_acc_id default_acc; /**< Default account ID */ |
| 371 | pjsua_acc acc[PJSUA_MAX_ACC]; /**< Account array. */ |
Benny Prijono | 093d302 | 2006-09-24 00:07:11 +0000 | [diff] [blame] | 372 | pjsua_acc_id acc_ids[PJSUA_MAX_ACC]; /**< Acc sorted by prio*/ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 373 | |
| 374 | /* Calls: */ |
| 375 | pjsua_config ua_cfg; /**< UA config. */ |
| 376 | unsigned call_cnt; /**< Call counter. */ |
| 377 | pjsua_call calls[PJSUA_MAX_CALLS];/**< Calls array. */ |
Benny Prijono | 5773cd6 | 2008-01-19 13:01:42 +0000 | [diff] [blame] | 378 | pjsua_call_id next_call_id; /**< Next call id to use*/ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 379 | |
| 380 | /* Buddy; */ |
| 381 | unsigned buddy_cnt; /**< Buddy count. */ |
| 382 | pjsua_buddy buddy[PJSUA_MAX_BUDDIES]; /**< Buddy array. */ |
| 383 | |
Benny Prijono | 7a5f510 | 2007-05-29 00:33:09 +0000 | [diff] [blame] | 384 | /* Presence: */ |
| 385 | pj_timer_entry pres_timer;/**< Presence refresh timer. */ |
| 386 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 387 | /* Media: */ |
| 388 | pjsua_media_config media_cfg; /**< Media config. */ |
| 389 | pjmedia_endpt *med_endpt; /**< Media endpoint. */ |
| 390 | pjsua_conf_setting mconf_cfg; /**< Additionan conf. bridge. param */ |
| 391 | pjmedia_conf *mconf; /**< Conference bridge. */ |
Benny Prijono | f798e50 | 2009-03-09 13:08:16 +0000 | [diff] [blame] | 392 | pj_bool_t is_mswitch;/**< Are we using audio switchboard |
| 393 | (a.k.a APS-Direct) */ |
| 394 | |
| 395 | /* Sound device */ |
| 396 | pjmedia_aud_dev_index cap_dev; /**< Capture device ID. */ |
| 397 | pjmedia_aud_dev_index play_dev; /**< Playback device ID. */ |
| 398 | pj_uint32_t aud_svmask;/**< Which settings to save */ |
| 399 | pjmedia_aud_param aud_param; /**< User settings to sound dev */ |
| 400 | pj_bool_t aud_open_cnt;/**< How many # device is opened */ |
Benny Prijono | e909eac | 2006-07-27 22:04:56 +0000 | [diff] [blame] | 401 | pj_bool_t no_snd; /**< No sound (app will manage it) */ |
Nanang Izzuddin | 68559c3 | 2008-06-13 17:01:46 +0000 | [diff] [blame] | 402 | pj_pool_t *snd_pool; /**< Sound's private pool. */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 403 | pjmedia_snd_port *snd_port; /**< Sound port. */ |
Nanang Izzuddin | 68559c3 | 2008-06-13 17:01:46 +0000 | [diff] [blame] | 404 | pj_timer_entry snd_idle_timer;/**< Sound device idle timer. */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 405 | pjmedia_master_port *null_snd; /**< Master port for null sound. */ |
| 406 | pjmedia_port *null_port; /**< Null port. */ |
Benny Prijono | 2d64772 | 2011-07-13 03:05:22 +0000 | [diff] [blame] | 407 | pj_bool_t snd_is_on; /**< Media flow is currently active */ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 408 | |
Nanang Izzuddin | 50fae73 | 2011-03-22 09:49:23 +0000 | [diff] [blame] | 409 | /* Video device */ |
| 410 | pjmedia_vid_dev_index vcap_dev; /**< Capture device ID. */ |
| 411 | pjmedia_vid_dev_index vrdr_dev; /**< Playback device ID. */ |
| 412 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 413 | /* File players: */ |
| 414 | unsigned player_cnt;/**< Number of file players. */ |
Benny Prijono | cba59d9 | 2007-02-16 09:22:56 +0000 | [diff] [blame] | 415 | pjsua_file_data player[PJSUA_MAX_PLAYERS];/**< Array of players.*/ |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 416 | |
| 417 | /* File recorders: */ |
| 418 | unsigned rec_cnt; /**< Number of file recorders. */ |
Benny Prijono | cba59d9 | 2007-02-16 09:22:56 +0000 | [diff] [blame] | 419 | pjsua_file_data recorder[PJSUA_MAX_RECORDERS];/**< Array of recs.*/ |
Benny Prijono | 9f468d1 | 2011-07-07 07:46:33 +0000 | [diff] [blame] | 420 | |
| 421 | /* Video windows */ |
| 422 | #if PJSUA_HAS_VIDEO |
| 423 | pjsua_vid_win win[PJSUA_MAX_VID_WINS]; /**< Array of windows */ |
| 424 | #endif |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 425 | }; |
| 426 | |
| 427 | |
| 428 | extern struct pjsua_data pjsua_var; |
| 429 | |
Benny Prijono | 44e88ea | 2007-10-30 15:42:35 +0000 | [diff] [blame] | 430 | /** |
| 431 | * Get the instance of pjsua |
| 432 | */ |
| 433 | PJ_DECL(struct pjsua_data*) pjsua_get_var(void); |
| 434 | |
| 435 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 436 | |
| 437 | /** |
| 438 | * IM callback data. |
| 439 | */ |
| 440 | typedef struct pjsua_im_data |
| 441 | { |
| 442 | pjsua_acc_id acc_id; |
| 443 | pjsua_call_id call_id; |
| 444 | pj_str_t to; |
| 445 | pj_str_t body; |
| 446 | void *user_data; |
| 447 | } pjsua_im_data; |
| 448 | |
| 449 | |
| 450 | /** |
| 451 | * Duplicate IM data. |
| 452 | */ |
| 453 | PJ_INLINE(pjsua_im_data*) pjsua_im_data_dup(pj_pool_t *pool, |
| 454 | const pjsua_im_data *src) |
| 455 | { |
| 456 | pjsua_im_data *dst; |
| 457 | |
Benny Prijono | 07113c9 | 2006-11-21 08:38:00 +0000 | [diff] [blame] | 458 | dst = (pjsua_im_data*) pj_pool_alloc(pool, sizeof(*dst)); |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 459 | dst->acc_id = src->acc_id; |
| 460 | dst->call_id = src->call_id; |
| 461 | pj_strdup_with_null(pool, &dst->to, &src->to); |
| 462 | dst->user_data = src->user_data; |
| 463 | pj_strdup_with_null(pool, &dst->body, &src->body); |
| 464 | |
| 465 | return dst; |
| 466 | } |
| 467 | |
| 468 | |
Benny Prijono | 148c9dd | 2006-09-19 13:37:53 +0000 | [diff] [blame] | 469 | #if 1 |
| 470 | #define PJSUA_LOCK() pj_mutex_lock(pjsua_var.mutex) |
| 471 | #define PJSUA_TRY_LOCK() pj_mutex_trylock(pjsua_var.mutex) |
| 472 | #define PJSUA_UNLOCK() pj_mutex_unlock(pjsua_var.mutex) |
Benny Prijono | 3a5e1ab | 2006-08-15 20:26:34 +0000 | [diff] [blame] | 473 | #else |
| 474 | #define PJSUA_LOCK() |
Benny Prijono | 148c9dd | 2006-09-19 13:37:53 +0000 | [diff] [blame] | 475 | #define PJSUA_TRY_LOCK() PJ_SUCCESS |
Benny Prijono | 3a5e1ab | 2006-08-15 20:26:34 +0000 | [diff] [blame] | 476 | #define PJSUA_UNLOCK() |
| 477 | #endif |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 478 | |
Benny Prijono | 0bc99a9 | 2011-03-17 04:34:43 +0000 | [diff] [blame] | 479 | /* Core */ |
| 480 | void pjsua_set_state(pjsua_state new_state); |
| 481 | |
Benny Prijono | bb995fd | 2009-08-12 11:03:23 +0000 | [diff] [blame] | 482 | /****** |
| 483 | * STUN resolution |
| 484 | */ |
| 485 | /* Resolve the STUN server */ |
| 486 | pj_status_t resolve_stun_server(pj_bool_t wait); |
| 487 | |
Benny Prijono | 91d06b6 | 2008-09-20 12:16:56 +0000 | [diff] [blame] | 488 | /** |
| 489 | * Normalize route URI (check for ";lr" and append one if it doesn't |
| 490 | * exist and pjsua_config.force_lr is set. |
| 491 | */ |
| 492 | pj_status_t normalize_route_uri(pj_pool_t *pool, pj_str_t *uri); |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 493 | |
Benny Prijono | c97608e | 2007-03-23 16:34:20 +0000 | [diff] [blame] | 494 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 495 | * Handle incoming invite request. |
| 496 | */ |
| 497 | pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata); |
| 498 | |
Benny Prijono | c97608e | 2007-03-23 16:34:20 +0000 | [diff] [blame] | 499 | /* |
| 500 | * Media channel. |
| 501 | */ |
| 502 | pj_status_t pjsua_media_channel_init(pjsua_call_id call_id, |
Benny Prijono | d817965 | 2008-01-23 20:39:07 +0000 | [diff] [blame] | 503 | pjsip_role_e role, |
Benny Prijono | 25b2ea1 | 2008-01-24 19:20:54 +0000 | [diff] [blame] | 504 | int security_level, |
Benny Prijono | 224b4e2 | 2008-06-19 14:10:28 +0000 | [diff] [blame] | 505 | pj_pool_t *tmp_pool, |
| 506 | const pjmedia_sdp_session *rem_sdp, |
Benny Prijono | 25b2ea1 | 2008-01-24 19:20:54 +0000 | [diff] [blame] | 507 | int *sip_err_code); |
Benny Prijono | c97608e | 2007-03-23 16:34:20 +0000 | [diff] [blame] | 508 | pj_status_t pjsua_media_channel_create_sdp(pjsua_call_id call_id, |
| 509 | pj_pool_t *pool, |
Benny Prijono | d817965 | 2008-01-23 20:39:07 +0000 | [diff] [blame] | 510 | const pjmedia_sdp_session *rem_sdp, |
Benny Prijono | 25b2ea1 | 2008-01-24 19:20:54 +0000 | [diff] [blame] | 511 | pjmedia_sdp_session **p_sdp, |
| 512 | int *sip_err_code); |
Benny Prijono | c97608e | 2007-03-23 16:34:20 +0000 | [diff] [blame] | 513 | pj_status_t pjsua_media_channel_update(pjsua_call_id call_id, |
Benny Prijono | 224b4e2 | 2008-06-19 14:10:28 +0000 | [diff] [blame] | 514 | const pjmedia_sdp_session *local_sdp, |
Benny Prijono | dbce2cf | 2007-03-28 16:24:00 +0000 | [diff] [blame] | 515 | const pjmedia_sdp_session *remote_sdp); |
Benny Prijono | c97608e | 2007-03-23 16:34:20 +0000 | [diff] [blame] | 516 | pj_status_t pjsua_media_channel_deinit(pjsua_call_id call_id); |
| 517 | |
Benny Prijono | ee0ba18 | 2011-07-15 06:18:29 +0000 | [diff] [blame^] | 518 | pj_status_t pjsua_call_media_init(pjsua_call_media *call_med, |
| 519 | pjmedia_type type, |
| 520 | const pjsua_transport_config *tcfg, |
| 521 | int security_level, |
| 522 | int *sip_err_code); |
| 523 | pj_status_t video_channel_update(pjsua_call_media *call_med, |
| 524 | pj_pool_t *tmp_pool, |
| 525 | const pjmedia_sdp_session *local_sdp, |
| 526 | const pjmedia_sdp_session *remote_sdp); |
| 527 | |
Benny Prijono | c97608e | 2007-03-23 16:34:20 +0000 | [diff] [blame] | 528 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 529 | /** |
| 530 | * Init presence. |
| 531 | */ |
| 532 | pj_status_t pjsua_pres_init(); |
| 533 | |
| 534 | /* |
| 535 | * Start presence subsystem. |
| 536 | */ |
| 537 | pj_status_t pjsua_pres_start(void); |
| 538 | |
| 539 | /** |
| 540 | * Refresh presence subscriptions |
| 541 | */ |
| 542 | void pjsua_pres_refresh(void); |
| 543 | |
| 544 | /* |
Benny Prijono | 4461c7d | 2007-08-25 13:36:15 +0000 | [diff] [blame] | 545 | * Update server subscription (e.g. when our online status has changed) |
| 546 | */ |
| 547 | void pjsua_pres_update_acc(int acc_id, pj_bool_t force); |
| 548 | |
| 549 | /* |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 550 | * Shutdown presence. |
| 551 | */ |
| 552 | void pjsua_pres_shutdown(void); |
| 553 | |
| 554 | /** |
Benny Prijono | 3a5e1ab | 2006-08-15 20:26:34 +0000 | [diff] [blame] | 555 | * Init presence for aoocunt. |
| 556 | */ |
| 557 | pj_status_t pjsua_pres_init_acc(int acc_id); |
| 558 | |
| 559 | /** |
Benny Prijono | 8b6834f | 2007-02-24 13:29:22 +0000 | [diff] [blame] | 560 | * Send PUBLISH |
| 561 | */ |
| 562 | pj_status_t pjsua_pres_init_publish_acc(int acc_id); |
| 563 | |
| 564 | /** |
Benny Prijono | 166d502 | 2010-02-10 14:24:48 +0000 | [diff] [blame] | 565 | * Send un-PUBLISH |
| 566 | */ |
| 567 | void pjsua_pres_unpublish(pjsua_acc *acc); |
| 568 | |
| 569 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 570 | * Terminate server subscription for the account |
| 571 | */ |
| 572 | void pjsua_pres_delete_acc(int acc_id); |
| 573 | |
| 574 | /** |
| 575 | * Init IM module handler to handle incoming MESSAGE outside dialog. |
| 576 | */ |
| 577 | pj_status_t pjsua_im_init(void); |
| 578 | |
| 579 | /** |
Benny Prijono | 4dd961b | 2009-10-26 11:21:37 +0000 | [diff] [blame] | 580 | * Start MWI subscription |
| 581 | */ |
| 582 | void pjsua_start_mwi(pjsua_acc *acc); |
| 583 | |
| 584 | /** |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 585 | * Init call subsystem. |
| 586 | */ |
| 587 | pj_status_t pjsua_call_subsys_init(const pjsua_config *cfg); |
| 588 | |
| 589 | /** |
| 590 | * Start call subsystem. |
| 591 | */ |
| 592 | pj_status_t pjsua_call_subsys_start(void); |
| 593 | |
| 594 | /** |
| 595 | * Init media subsystems. |
| 596 | */ |
| 597 | pj_status_t pjsua_media_subsys_init(const pjsua_media_config *cfg); |
| 598 | |
| 599 | /** |
| 600 | * Start pjsua media subsystem. |
| 601 | */ |
| 602 | pj_status_t pjsua_media_subsys_start(void); |
| 603 | |
| 604 | /** |
| 605 | * Destroy pjsua media subsystem. |
| 606 | */ |
| 607 | pj_status_t pjsua_media_subsys_destroy(void); |
| 608 | |
| 609 | /** |
| 610 | * Private: check if we can accept the message. |
| 611 | * If not, then p_accept header will be filled with a valid |
| 612 | * Accept header. |
| 613 | */ |
| 614 | pj_bool_t pjsua_im_accept_pager(pjsip_rx_data *rdata, |
| 615 | pjsip_accept_hdr **p_accept_hdr); |
| 616 | |
| 617 | /** |
| 618 | * Private: process pager message. |
| 619 | * This may trigger pjsua_ui_on_pager() or pjsua_ui_on_typing(). |
| 620 | */ |
| 621 | void pjsua_im_process_pager(int call_id, const pj_str_t *from, |
| 622 | const pj_str_t *to, pjsip_rx_data *rdata); |
| 623 | |
| 624 | |
| 625 | /** |
| 626 | * Create Accept header for MESSAGE. |
| 627 | */ |
| 628 | pjsip_accept_hdr* pjsua_im_create_accept(pj_pool_t *pool); |
| 629 | |
| 630 | /* |
| 631 | * Add additional headers etc in msg_data specified by application |
| 632 | * when sending requests. |
| 633 | */ |
| 634 | void pjsua_process_msg_data(pjsip_tx_data *tdata, |
| 635 | const pjsua_msg_data *msg_data); |
| 636 | |
| 637 | |
| 638 | /* |
| 639 | * Add route_set to outgoing requests |
| 640 | */ |
| 641 | void pjsua_set_msg_route_set( pjsip_tx_data *tdata, |
| 642 | const pjsip_route_hdr *route_set ); |
| 643 | |
| 644 | |
| 645 | /* |
| 646 | * Simple version of MIME type parsing (it doesn't support parameters) |
| 647 | */ |
| 648 | void pjsua_parse_media_type( pj_pool_t *pool, |
| 649 | const pj_str_t *mime, |
| 650 | pjsip_media_type *media_type); |
| 651 | |
| 652 | |
Benny Prijono | 62c5c5b | 2007-01-13 23:22:40 +0000 | [diff] [blame] | 653 | /* |
| 654 | * Internal function to init transport selector from transport id. |
| 655 | */ |
| 656 | void pjsua_init_tpselector(pjsua_transport_id tp_id, |
| 657 | pjsip_tpselector *sel); |
| 658 | |
Benny Prijono | 3c5e28b | 2008-09-24 10:10:15 +0000 | [diff] [blame] | 659 | pjsip_dialog* on_dlg_forked(pjsip_dialog *first_set, pjsip_rx_data *res); |
Benny Prijono | 627cbb4 | 2007-09-25 20:48:49 +0000 | [diff] [blame] | 660 | pj_status_t acquire_call(const char *title, |
| 661 | pjsua_call_id call_id, |
| 662 | pjsua_call **p_call, |
| 663 | pjsip_dialog **p_dlg); |
| 664 | const char *good_number(char *buf, pj_int32_t val); |
| 665 | void print_call(const char *title, |
| 666 | int call_id, |
| 667 | char *buf, pj_size_t size); |
| 668 | |
Benny Prijono | 9f468d1 | 2011-07-07 07:46:33 +0000 | [diff] [blame] | 669 | /* |
| 670 | * Video |
| 671 | */ |
| 672 | pj_status_t pjsua_vid_subsys_init(void); |
| 673 | pj_status_t pjsua_vid_subsys_start(void); |
| 674 | pj_status_t pjsua_vid_subsys_destroy(void); |
| 675 | |
| 676 | PJ_INLINE(void) pjsua_vid_win_reset(pjsua_vid_win_id wid) |
| 677 | { |
| 678 | #if PJSUA_HAS_VIDEO |
| 679 | pjsua_vid_win *w = &pjsua_var.win[wid]; |
| 680 | pj_pool_t *pool = w->pool; |
| 681 | |
| 682 | pj_bzero(w, sizeof(*w)); |
| 683 | if (pool) pj_pool_reset(pool); |
Nanang Izzuddin | 62053a6 | 2011-07-12 11:08:32 +0000 | [diff] [blame] | 684 | w->ref_cnt = 0; |
Benny Prijono | 9f468d1 | 2011-07-07 07:46:33 +0000 | [diff] [blame] | 685 | w->pool = pool; |
| 686 | w->preview_cap_id = PJMEDIA_VID_INVALID_DEV; |
| 687 | #endif |
| 688 | } |
| 689 | |
Benny Prijono | 62c5c5b | 2007-01-13 23:22:40 +0000 | [diff] [blame] | 690 | |
Benny Prijono | eebe9af | 2006-06-13 22:57:13 +0000 | [diff] [blame] | 691 | PJ_END_DECL |
| 692 | |
| 693 | #endif /* __PJSUA_INTERNAL_H__ */ |
| 694 | |