diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-03-23 16:34:20 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-03-23 16:34:20 +0000 |
commit | e3fd604ea862f68ad3ece248ca7d853899cbf48f (patch) | |
tree | 88fb4659ab449d79b25dc8e0dfe3b64f145b9dd3 /pjsip/include | |
parent | 05e7998ba4cbd7fb0b02b7f82c5b328cf203fbc9 (diff) |
ICE (work in progress): integration with PJSUA
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1098 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/include')
-rw-r--r-- | pjsip/include/pjsip/sip_endpoint.h | 9 | ||||
-rw-r--r-- | pjsip/include/pjsua-lib/pjsua.h | 130 | ||||
-rw-r--r-- | pjsip/include/pjsua-lib/pjsua_internal.h | 24 |
3 files changed, 52 insertions, 111 deletions
diff --git a/pjsip/include/pjsip/sip_endpoint.h b/pjsip/include/pjsip/sip_endpoint.h index 08c67931..f285ef8f 100644 --- a/pjsip/include/pjsip/sip_endpoint.h +++ b/pjsip/include/pjsip/sip_endpoint.h @@ -156,6 +156,15 @@ PJ_DECL(pj_status_t) pjsip_endpt_schedule_timer( pjsip_endpoint *endpt, PJ_DECL(void) pjsip_endpt_cancel_timer( pjsip_endpoint *endpt, pj_timer_entry *entry ); +/** + * Get the timer heap instance of the SIP endpoint. + * + * @param endpt The endpoint. + * + * @return The timer heap instance. + */ +PJ_DECL(pj_timer_heap_t*) pjsip_endpt_get_timer_heap(pjsip_endpoint *endpt); + /** * Register new module to the endpoint. diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h index 55cf6264..fcd0549a 100644 --- a/pjsip/include/pjsua-lib/pjsua.h +++ b/pjsip/include/pjsua-lib/pjsua.h @@ -902,6 +902,14 @@ typedef struct pjsua_config */ pj_str_t outbound_proxy[4]; + /** + * Specify STUN server. This server will be first resolved with DNS SRV + * to get the actual server address. If DNS SRV resolution failed, or + * when nameserver is not configured, the server will be resolved using + * DNS A resolution (i.e. gethostbyname()). + */ + pj_str_t stun_srv; + /** * Number of credentials in the credential array. */ @@ -1001,6 +1009,7 @@ PJ_INLINE(void) pjsua_config_dup(pj_pool_t *pool, } pj_strdup_with_null(pool, &dst->user_agent, &src->user_agent); + pj_strdup_with_null(pool, &dst->stun_srv, &src->stun_srv); } @@ -1334,60 +1343,6 @@ typedef int pjsua_transport_id; /** - * This structure describes STUN configuration for SIP and media transport, - * and is embedded inside pjsua_transport_config structure. - */ -typedef struct pjsua_stun_config -{ - /** - * The first STUN server IP address or hostname. - */ - pj_str_t stun_srv1; - - /** - * Port number of the first STUN server. - * If zero, default STUN port will be used. - */ - unsigned stun_port1; - - /** - * Optional second STUN server IP address or hostname, for which the - * result of the mapping request will be compared to. If the value - * is empty, only one STUN server will be used. - */ - pj_str_t stun_srv2; - - /** - * Port number of the second STUN server. - * If zero, default STUN port will be used. - */ - unsigned stun_port2; - -} pjsua_stun_config; - - - -/** - * Call this function to initialize STUN config with default values. - * STUN config is normally embedded inside pjsua_transport_config, so - * normally there is no need to call this function and rather just - * call pjsua_transport_config_default() instead. - * - * @param cfg The STUN config to be initialized. - * - * \par Python: - * The corresponding Python function creates and initialize the config: - * \code - stun_cfg = py_pjsua.stun_config_default() - * \endcode - */ -PJ_INLINE(void) pjsua_stun_config_default(pjsua_stun_config *cfg) -{ - pj_bzero(cfg, sizeof(*cfg)); -} - - -/** * Transport configuration for creating transports for both SIP * and media. Before setting some values to this structure, application * MUST call #pjsua_transport_config_default() to initialize its @@ -1435,16 +1390,6 @@ typedef struct pjsua_transport_config pj_str_t bound_addr; /** - * Flag to indicate whether STUN should be used. - */ - pj_bool_t use_stun; - - /** - * STUN configuration, must be specified when STUN is used. - */ - pjsua_stun_config stun_config; - - /** * This specifies TLS settings for TLS transport. It is only be used * when this transport config is being used to create a SIP TLS * transport. @@ -1468,46 +1413,11 @@ typedef struct pjsua_transport_config PJ_INLINE(void) pjsua_transport_config_default(pjsua_transport_config *cfg) { pj_bzero(cfg, sizeof(*cfg)); - pjsua_stun_config_default(&cfg->stun_config); pjsip_tls_setting_default(&cfg->tls_setting); } /** - * This is a utility function to normalize STUN config. It's only - * used internally by the library. - * - * @param cfg The STUN config to be initialized. - * - * \par Python: - * \code - py_pjsua.normalize_stun_config(cfg) - * \code - */ -PJ_INLINE(void) pjsua_normalize_stun_config( pjsua_stun_config *cfg ) -{ - if (cfg->stun_srv1.slen) { - - if (cfg->stun_port1 == 0) - cfg->stun_port1 = 3478; - - if (cfg->stun_srv2.slen == 0) { - cfg->stun_srv2 = cfg->stun_srv1; - cfg->stun_port2 = cfg->stun_port1; - } else { - if (cfg->stun_port2 == 0) - cfg->stun_port2 = 3478; - } - - } else { - cfg->stun_port1 = 0; - cfg->stun_srv2.slen = 0; - cfg->stun_port2 = 0; - } -} - - -/** * Duplicate transport config. * * @param pool The pool. @@ -1522,19 +1432,8 @@ PJ_INLINE(void) pjsua_transport_config_dup(pj_pool_t *pool, pjsua_transport_config *dst, const pjsua_transport_config *src) { + PJ_UNUSED_ARG(pool); pj_memcpy(dst, src, sizeof(*src)); - - if (src->stun_config.stun_srv1.slen) { - pj_strdup_with_null(pool, &dst->stun_config.stun_srv1, - &src->stun_config.stun_srv1); - } - - if (src->stun_config.stun_srv2.slen) { - pj_strdup_with_null(pool, &dst->stun_config.stun_srv2, - &src->stun_config.stun_srv2); - } - - pjsua_normalize_stun_config(&dst->stun_config); } @@ -3530,6 +3429,15 @@ struct pjsua_media_config */ int jb_max; + /** + * Enable ICE + */ + pj_bool_t enable_ice; + + /** + * Enable ICE media relay. + */ + pj_bool_t enable_relay; }; diff --git a/pjsip/include/pjsua-lib/pjsua_internal.h b/pjsip/include/pjsua-lib/pjsua_internal.h index 4f6a49fd..5365ff12 100644 --- a/pjsip/include/pjsua-lib/pjsua_internal.h +++ b/pjsip/include/pjsua-lib/pjsua_internal.h @@ -186,6 +186,12 @@ struct pjsua_data pj_bool_t thread_quit_flag; /**< Thread quit flag. */ pj_thread_t *thread[4]; /**< Array of threads. */ + /* STUN and resolver */ + pj_stun_config stun_cfg; /**< Global STUN settings. */ + pj_sockaddr stun_srv; /**< Resolved STUN server address */ + pj_status_t stun_status; /**< STUN server status. */ + pj_dns_resolver *resolver; /**< DNS resolver. */ + /* Account: */ unsigned acc_cnt; /**< Number of accounts. */ pjsua_acc_id default_acc; /**< Default account ID */ @@ -270,12 +276,30 @@ PJ_INLINE(pjsua_im_data*) pjsua_im_data_dup(pj_pool_t *pool, #endif +/** + * Resolve STUN server. + */ +pj_status_t pjsua_resolve_stun_server(pj_bool_t wait); /** * Handle incoming invite request. */ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata); +/* + * Media channel. + */ +pj_status_t pjsua_media_channel_init(pjsua_call_id call_id, + pjsip_role_e role); +pj_status_t pjsua_media_channel_create_sdp(pjsua_call_id call_id, + pj_pool_t *pool, + pjmedia_sdp_session **p_sdp); +pj_status_t pjsua_media_channel_update(pjsua_call_id call_id, + pjmedia_sdp_session *local_sdp, + pjmedia_sdp_session *remote_sdp); +pj_status_t pjsua_media_channel_deinit(pjsua_call_id call_id); + + /** * Init presence. */ |