Changeset 236 for pjproject/trunk/pjsip/src/pjsua/pjsua.h
- Timestamp:
- Feb 26, 2006 9:23:45 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua/pjsua.h
r223 r236 48 48 * Max buddies in buddy list. 49 49 */ 50 #define PJSUA_MAX_BUDDIES 32 50 #ifndef PJSUA_MAX_BUDDIES 51 # define PJSUA_MAX_BUDDIES 32 52 #endif 53 51 54 52 55 /** 53 56 * Max simultaneous calls. 54 57 */ 55 #define PJSUA_MAX_CALLS 8 58 #ifndef PJSUA_MAX_CALLS 59 # define PJSUA_MAX_CALLS 256 60 #endif 61 62 63 /** 64 * Aditional ports to be allocated in the conference ports for non-call 65 * streams. 66 */ 67 #define PJSUA_CONF_MORE_PORTS 2 68 69 70 /** 71 * Maximum accounts. 72 */ 73 #ifndef PJSUA_MAX_ACC 74 # define PJSUA_MAX_ACC 8 75 #endif 76 77 78 /** 79 * Maximum credentials. 80 */ 81 #ifndef PJSUA_MAX_CRED 82 # define PJSUA_MAX_CRED PJSUA_MAX_ACC 83 #endif 56 84 57 85 58 86 /** 59 * Structure to be attached to alldialog.87 * Structure to be attached to invite dialog. 60 88 * Given a dialog "dlg", application can retrieve this structure 61 89 * by accessing dlg->mod_data[pjsua.mod.id]. 62 90 */ 63 struct pjsua_ inv_data91 struct pjsua_call 64 92 { 65 PJ_DECL_LIST_MEMBER(struct pjsua_inv_data); 66 93 unsigned index; /**< Index in pjsua array. */ 67 94 pjsip_inv_session *inv; /**< The invite session. */ 95 int acc_index; /**< Account index being used. */ 68 96 pjmedia_session *session; /**< The media session. */ 69 97 unsigned conf_slot; /**< Slot # in conference bridge. */ 70 unsigned call_slot; /**< RTP media index in med_sock_use[] */71 98 pjsip_evsub *xfer_sub; /**< Xfer server subscription, if this 72 99 call was triggered by xfer. */ 100 pjmedia_sock_info skinfo; /**< Preallocated media sockets. */ 101 102 void *app_data; /**< Application data. */ 73 103 }; 104 105 typedef struct pjsua_call pjsua_call; 74 106 75 107 … … 80 112 { 81 113 pj_str_t uri; /**< Buddy URI */ 114 int acc_index; /**< Which account to use. */ 82 115 pj_bool_t monitor; /**< Should we monitor? */ 83 116 pjsip_evsub *sub; /**< Buddy presence subscription */ … … 101 134 102 135 136 /** 137 * Account 138 */ 139 struct pjsua_acc 140 { 141 int index; /**< Index in accounts array. */ 142 pj_str_t local_uri; /**< Uri in From: header. */ 143 pj_str_t user_part; /**< User part of local URI. */ 144 pj_str_t host_part; /**< Host part of local URI. */ 145 pj_str_t contact_uri; /**< Uri in Contact: header. */ 146 147 pj_str_t reg_uri; /**< Registrar URI. */ 148 pjsip_regc *regc; /**< Client registration session. */ 149 pj_int32_t reg_timeout; /**< Default timeout. */ 150 pj_timer_entry reg_timer; /**< Registration timer. */ 151 pj_status_t reg_last_err; /**< Last registration error. */ 152 int reg_last_code; /**< Last status last register. */ 153 154 pj_str_t proxy; /**< Proxy URL. */ 155 pjsip_route_hdr route_set; /**< Route set. */ 156 157 pj_bool_t online_status; /**< Our online status. */ 158 pjsua_srv_pres pres_srv_list; /**< Server subscription list. */ 159 160 void *app_data; /**< Application data. */ 161 }; 162 163 164 typedef struct pjsua_acc pjsua_acc; 165 103 166 104 167 /* PJSUA application variables. */ … … 106 169 { 107 170 /* Control: */ 108 109 171 pj_caching_pool cp; /**< Global pool factory. */ 110 172 pjsip_endpoint *endpt; /**< Global endpoint. */ … … 114 176 115 177 /* Media: */ 116 117 178 pjmedia_endpt *med_endpt; /**< Media endpoint. */ 118 unsigned max_ports; /**< Max ports in conf. */119 179 pjmedia_conf *mconf; /**< Media conference. */ 120 180 pj_bool_t null_audio; /**< Null audio flag. */ 121 181 char *wav_file; /**< WAV file name to play. */ 122 182 unsigned wav_slot; /**< WAV player slot in bridge */ 183 pj_bool_t auto_play; /**< Auto play file for calls? */ 184 pj_bool_t auto_loop; /**< Auto loop RTP stream? */ 185 pj_bool_t auto_conf; /**< Auto put to conference? */ 186 123 187 124 188 /* User Agent behaviour: */ 125 126 189 int auto_answer; /**< Automatically answer in calls. */ 127 190 128 129 /* Since we support simultaneous calls, we need to have multiple 130 * RTP sockets. 131 */ 132 pjmedia_sock_info med_sock_info[PJSUA_MAX_CALLS]; 133 pj_bool_t med_sock_use[PJSUA_MAX_CALLS]; 134 135 /* User info: */ 136 137 pj_str_t local_uri; /**< Uri in From: header. */ 138 pj_str_t contact_uri; /**< Uri in Contact: header. */ 139 140 /* Proxy URLs: */ 141 142 pj_str_t proxy; 143 pj_str_t outbound_proxy; 144 pjsip_route_hdr route_set; 145 146 147 /* Registration: */ 148 149 pj_str_t registrar_uri; 150 pjsip_regc *regc; 151 pj_int32_t reg_timeout; 152 pj_timer_entry regc_timer; 153 pj_status_t regc_last_err; /**< Last registration error. */ 154 int regc_last_code;/**< Last status last register. */ 191 /* Account: */ 192 int acc_cnt; /**< Number of client registrations */ 193 pjsua_acc acc[PJSUA_MAX_ACC]; /** Client regs array. */ 155 194 156 195 157 196 /* Authentication credentials: */ 158 197 159 unsigned cred_count;160 pjsip_cred_info cred_info[ 4];198 int cred_count; /**< Number of credentials. */ 199 pjsip_cred_info cred_info[10]; /**< Array of credentials. */ 161 200 162 201 163 202 /* Threading (optional): */ 164 165 203 int thread_cnt; /**< Thread count. */ 166 204 pj_thread_t *threads[8]; /**< Thread instances. */ … … 168 206 169 207 /* Transport (UDP): */ 170 171 208 pj_uint16_t sip_port; /**< SIP signaling port. */ 172 209 pj_sock_t sip_sock; /**< SIP UDP socket. */ 173 210 pj_sockaddr_in sip_sock_name; /**< Public/STUN UDP socket addr. */ 174 211 212 pj_str_t outbound_proxy;/**< Outbound proxy. */ 175 213 176 214 177 215 /* STUN: */ 178 179 216 pj_str_t stun_srv1; 180 217 int stun_port1; … … 183 220 184 221 185 /* Logging: */ 186 222 /* Logging: */ 187 223 int log_level; /**< Logging verbosity. */ 188 224 int app_log_level; /**< stdout log verbosity. */ … … 191 227 192 228 193 /* List of invite sessions: */ 194 195 struct pjsua_inv_data inv_list; 229 /* PJSUA Calls: */ 230 int max_calls; /**< Max nb of calls. */ 231 int call_cnt; /**< Number of calls. */ 232 pjsua_call calls[PJSUA_MAX_CALLS]; /** Calls array. */ 196 233 197 234 198 235 /* SIMPLE and buddy status: */ 199 200 pj_bool_t online_status; /**< Out online status. */ 201 pjsua_srv_pres pres_srv_list; /**< Server subscription list. */ 202 203 unsigned buddy_cnt; 204 pjsua_buddy buddies[PJSUA_MAX_BUDDIES]; 236 int buddy_cnt; 237 pjsua_buddy buddies[PJSUA_MAX_BUDDIES]; 205 238 }; 206 239 … … 256 289 257 290 258 /***************************************************************************** 259 * PJSUA Invite session API (defined in pjsua_inv.c). 260 */ 291 /** 292 * Find account for incoming request. 293 */ 294 int pjsua_find_account_for_incoming(pjsip_rx_data *rdata); 295 296 297 /** 298 * Find account for outgoing request. 299 */ 300 int pjsua_find_account_for_outgoing(const pj_str_t *url); 301 302 303 /***************************************************************************** 304 * PJSUA Call API (defined in pjsua_call.c). 305 */ 306 307 /** 308 * Init pjsua call module. 309 */ 310 pj_status_t pjsua_call_init(void); 261 311 262 312 /** 263 313 * Make outgoing call. 264 314 */ 265 pj_status_t pjsua_invite(const char *cstr_dest_uri, 266 struct pjsua_inv_data **p_inv_data); 315 pj_status_t pjsua_make_call(int acc_index, 316 const char *cstr_dest_uri, 317 int *p_call_index); 267 318 268 319 … … 270 321 * Handle incoming invite request. 271 322 */ 272 pj_bool_t pjsua_inv_on_incoming(pjsip_rx_data *rdata); 273 323 pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata); 324 325 326 /** 327 * Answer call. 328 */ 329 void pjsua_call_answer(int call_index, int code); 274 330 275 331 /** 276 332 * Hangup call. 277 333 */ 278 void pjsua_ inv_hangup(struct pjsua_inv_data *inv_session, int code);334 void pjsua_call_hangup(int call_index, int code); 279 335 280 336 … … 282 338 * Put call on-hold. 283 339 */ 284 void pjsua_ inv_set_hold(struct pjsua_inv_data *inv_session);340 void pjsua_call_set_hold(int call_index); 285 341 286 342 … … 288 344 * Send re-INVITE (to release hold). 289 345 */ 290 void pjsua_ inv_reinvite(struct pjsua_inv_data *inv_session);346 void pjsua_call_reinvite(int call_index); 291 347 292 348 … … 294 350 * Transfer call. 295 351 */ 296 void pjsua_inv_xfer_call(struct pjsua_inv_data *inv_session, 297 const char *dest); 298 299 300 /** 301 * Callback to be called by session when invite session's state has changed. 302 */ 303 void pjsua_inv_on_state_changed(pjsip_inv_session *inv, pjsip_event *e); 304 305 306 /** 307 * Callback to be called by session when outgoing dialog has forked. 308 * This function will create a forked dialog. 309 */ 310 void pjsua_inv_on_new_session(pjsip_inv_session *inv, pjsip_event *e); 311 312 313 /** 314 * Callback to be called when SDP offer/answer negotiation has just completed 315 * in the session. This function will start/update media if negotiation 316 * has succeeded. 317 */ 318 void pjsua_inv_on_media_update(pjsip_inv_session *inv, pj_status_t status); 319 320 /** 321 * Callback called when invite session received new offer. 322 */ 323 void pjsua_inv_on_rx_offer( pjsip_inv_session *inv, 324 const pjmedia_sdp_session *offer); 325 326 /** 327 * Callback to receive transaction state inside invite session or dialog 328 * (e.g. REFER, MESSAGE). 329 */ 330 void pjsua_inv_on_tsx_state_changed(pjsip_inv_session *inv, 331 pjsip_transaction *tsx, 332 pjsip_event *e); 352 void pjsua_call_xfer(int call_index, const char *dest); 353 333 354 334 355 /** … … 347 368 * @param app_callback Optional callback 348 369 */ 349 pj_status_t pjsua_regc_init( void);370 pj_status_t pjsua_regc_init(int acc_index); 350 371 351 372 /** … … 353 374 * this will start unregistration process. 354 375 */ 355 void pjsua_regc_update( pj_bool_t renew);376 void pjsua_regc_update(int acc_index, pj_bool_t renew); 356 377 357 378 … … 370 391 * Refresh both presence client and server subscriptions. 371 392 */ 372 void pjsua_pres_refresh( void);393 void pjsua_pres_refresh(int acc_index); 373 394 374 395 /** … … 393 414 * Notify UI when invite state has changed. 394 415 */ 395 void pjsua_ui_inv_on_state_changed( pjsip_inv_session *inv, pjsip_event *e);416 void pjsua_ui_inv_on_state_changed(int call_index, pjsip_event *e); 396 417 397 418 /** 398 419 * Notify UI when registration status has changed. 399 420 */ 400 void pjsua_ui_regc_on_state_changed(int code);421 void pjsua_ui_regc_on_state_changed(int acc_index); 401 422 402 423 … … 418 439 */ 419 440 pj_status_t pjsua_load_settings(const char *filename); 441 442 /** 443 * Dump settings. 444 */ 445 int pjsua_dump_settings(char *buf, pj_size_t max); 420 446 421 447 /**
Note: See TracChangeset
for help on using the changeset viewer.