diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-01-13 23:22:40 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-01-13 23:22:40 +0000 |
commit | 2fe4e4e9985b9c4cbff7209a9c876a314abc9779 (patch) | |
tree | 216d17b9d93ad17b74f70e76a5913fd18243ddb3 /pjsip/include/pjsua-lib | |
parent | 79a935f4554f9b852862e52df82c02b2ef22bae8 (diff) |
More work on ticket #50: binding of PJSUA-API account to specific transport, and minor fixes in PJSIP core implementation. Tested okay.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@881 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/include/pjsua-lib')
-rw-r--r-- | pjsip/include/pjsua-lib/pjsua.h | 34 | ||||
-rw-r--r-- | pjsip/include/pjsua-lib/pjsua_internal.h | 14 |
2 files changed, 45 insertions, 3 deletions
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h index 02b05ef4..f0bf5775 100644 --- a/pjsip/include/pjsua-lib/pjsua.h +++ b/pjsip/include/pjsua-lib/pjsua.h @@ -1341,6 +1341,19 @@ typedef struct pjsua_acc_config */ pjsip_cred_info cred_info[PJSUA_ACC_MAX_PROXIES]; + /** + * Optionally bind this account to specific transport. This normally is + * not a good idea, as account should be able to send requests using + * any available transports according to the destination. But some + * application may want to have explicit control over the transport to + * use, so in that case it can set this field. + * + * Default: -1 (PJSUA_INVALID_ID) + * + * @see pjsua_acc_set_transport() + */ + pjsua_transport_id transport_id; + } pjsua_acc_config; @@ -1354,6 +1367,7 @@ PJ_INLINE(void) pjsua_acc_config_default(pjsua_acc_config *cfg) pj_bzero(cfg, sizeof(*cfg)); cfg->reg_timeout = PJSUA_REG_INTERVAL; + cfg->transport_id = PJSUA_INVALID_ID; } @@ -1655,6 +1669,26 @@ PJ_DECL(pj_status_t) pjsua_acc_create_uas_contact( pj_pool_t *pool, pjsip_rx_data *rdata ); +/** + * Lock/bind this account to a specific transport/listener. Normally + * application shouldn't need to do this, as transports will be selected + * automatically by the stack according to the destination. + * + * When account is locked/bound to a specific transport, all outgoing + * requests from this account will use the specified transport (this + * includes SIP registration, dialog (call and event subscription), and + * out-of-dialog requests such as MESSAGE). + * + * Note that transport_id may be specified in pjsua_acc_config too. + * + * @param acc_id The account ID. + * @param tp_id The transport ID. + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjsua_acc_set_transport(pjsua_acc_id acc_id, + pjsua_transport_id tp_id); + /** * @} diff --git a/pjsip/include/pjsua-lib/pjsua_internal.h b/pjsip/include/pjsua-lib/pjsua_internal.h index 0664b721..43d28591 100644 --- a/pjsip/include/pjsua-lib/pjsua_internal.h +++ b/pjsip/include/pjsua-lib/pjsua_internal.h @@ -106,7 +106,7 @@ typedef struct pjsua_acc /** *Transport. */ -typedef struct transport_data +typedef struct pjsua_transport_data { int index; pjsip_transport_type_e type; @@ -118,7 +118,7 @@ typedef struct transport_data void *ptr; } data; -} transport_data; +} pjsua_transport_data; /** @@ -179,7 +179,7 @@ struct pjsua_data /* SIP: */ pjsip_endpoint *endpt; /**< Global endpoint. */ pjsip_module mod; /**< pjsua's PJSIP module. */ - transport_data tpdata[8]; /**< Array of transports. */ + pjsua_transport_data tpdata[8]; /**< Array of transports. */ /* Threading: */ pj_bool_t thread_quit_flag; /**< Thread quit flag. */ @@ -379,6 +379,14 @@ void pjsua_parse_media_type( pj_pool_t *pool, pjsip_media_type *media_type); +/* + * Internal function to init transport selector from transport id. + */ +void pjsua_init_tpselector(pjsua_transport_id tp_id, + pjsip_tpselector *sel); + + + PJ_END_DECL #endif /* __PJSUA_INTERNAL_H__ */ |