diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2013-02-07 09:35:34 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2013-02-07 09:35:34 +0000 |
commit | cdb0f86fac81b206ee8e260d2b344e36cb3ac0aa (patch) | |
tree | a9d4aa8d94fc7e0ccfce07ff99d4e078008bb14d /pjsip | |
parent | 7b7c7c8b42a8c25b30b07a8cd524cccbb60173b3 (diff) |
Close #1602: configurable local port range for ICE transport.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4343 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r-- | pjsip/include/pjsua-lib/pjsua.h | 9 | ||||
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_media.c | 14 |
2 files changed, 23 insertions, 0 deletions
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h index 5114189d..e3d9dd31 100644 --- a/pjsip/include/pjsua-lib/pjsua.h +++ b/pjsip/include/pjsua-lib/pjsua.h @@ -2153,6 +2153,15 @@ typedef struct pjsua_transport_config unsigned port; /** + * Specify the port range for socket binding, relative to the start + * port number specified in \a port. Note that this setting is only + * applicable when the start port number is non zero. + * + * Default value is zero. + */ + unsigned port_range; + + /** * Optional address to advertise as the address of this transport. * Application can specify any address or hostname for this field, * for example it can point to one of the interface address in the diff --git a/pjsip/src/pjsua-lib/pjsua_media.c b/pjsip/src/pjsua-lib/pjsua_media.c index f891201a..26a6cb70 100644 --- a/pjsip/src/pjsua-lib/pjsua_media.c +++ b/pjsip/src/pjsua-lib/pjsua_media.c @@ -718,6 +718,13 @@ static pj_status_t create_ice_media_transport( if (acc_cfg->ice_cfg.ice_max_host_cands >= 0) ice_cfg.stun.max_host_cands = acc_cfg->ice_cfg.ice_max_host_cands; + /* Copy binding port setting to STUN setting */ + pj_sockaddr_init(ice_cfg.af, &ice_cfg.stun.cfg.bound_addr, + &cfg->bound_addr, cfg->port); + ice_cfg.stun.cfg.port_range = cfg->port_range; + if (cfg->port != 0 && ice_cfg.stun.cfg.port_range == 0) + ice_cfg.stun.cfg.port_range = pjsua_var.ua_cfg.max_calls * 10; + /* Copy QoS setting to STUN setting */ ice_cfg.stun.cfg.qos_type = cfg->qos_type; pj_memcpy(&ice_cfg.stun.cfg.qos_params, &cfg->qos_params, @@ -743,6 +750,13 @@ static pj_status_t create_ice_media_transport( ice_cfg.turn.cfg.qos_type = cfg->qos_type; pj_memcpy(&ice_cfg.turn.cfg.qos_params, &cfg->qos_params, sizeof(cfg->qos_params)); + + /* Copy binding port setting to TURN setting */ + pj_sockaddr_init(ice_cfg.af, &ice_cfg.turn.cfg.bound_addr, + &cfg->bound_addr, cfg->port); + ice_cfg.turn.cfg.port_range = cfg->port_range; + if (cfg->port != 0 && ice_cfg.turn.cfg.port_range == 0) + ice_cfg.turn.cfg.port_range = pjsua_var.ua_cfg.max_calls * 10; } /* Configure packet size for STUN and TURN sockets */ |