Misc (re #1882): Fixed bug STUN still being used in media transport UDP & ICE after STUN is disabled in account config (media_stun_use == PJSUA_STUN_USE_DISABLED).
git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@5217 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
parent
cdb73f16ce
commit
eac69a61c3
|
@ -608,6 +608,7 @@ pj_status_t normalize_route_uri(pj_pool_t *pool, pj_str_t *uri);
|
|||
|
||||
/* acc use stun? */
|
||||
pj_bool_t pjsua_sip_acc_is_using_stun(pjsua_acc_id acc_id);
|
||||
pj_bool_t pjsua_media_acc_is_using_stun(pjsua_acc_id acc_id);
|
||||
|
||||
/* Get local transport address suitable to be used for Via or Contact address
|
||||
* to send request to the specified destination URI.
|
||||
|
|
|
@ -2480,7 +2480,15 @@ pj_bool_t pjsua_sip_acc_is_using_stun(pjsua_acc_id acc_id)
|
|||
pjsua_acc *acc = &pjsua_var.acc[acc_id];
|
||||
|
||||
return acc->cfg.sip_stun_use != PJSUA_STUN_USE_DISABLED &&
|
||||
pjsua_var.ua_cfg.stun_srv_cnt != 0;
|
||||
pjsua_var.ua_cfg.stun_srv_cnt != 0;
|
||||
}
|
||||
|
||||
pj_bool_t pjsua_media_acc_is_using_stun(pjsua_acc_id acc_id)
|
||||
{
|
||||
pjsua_acc *acc = &pjsua_var.acc[acc_id];
|
||||
|
||||
return acc->cfg.media_stun_use != PJSUA_STUN_USE_DISABLED &&
|
||||
pjsua_var.ua_cfg.stun_srv_cnt != 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -253,7 +253,7 @@ static pj_status_t create_rtp_rtcp_sock(pjsua_call_media *call_med,
|
|||
af = use_ipv6 ? pj_AF_INET6() : pj_AF_INET();
|
||||
|
||||
/* Make sure STUN server resolution has completed */
|
||||
if (!use_ipv6 && pjsua_sip_acc_is_using_stun(call_med->call->acc_id)) {
|
||||
if (!use_ipv6 && pjsua_media_acc_is_using_stun(call_med->call->acc_id)) {
|
||||
status = resolve_stun_server(PJ_TRUE);
|
||||
if (status != PJ_SUCCESS) {
|
||||
pjsua_perror(THIS_FILE, "Error resolving STUN server", status);
|
||||
|
@ -350,7 +350,8 @@ static pj_status_t create_rtp_rtcp_sock(pjsua_call_media *call_med,
|
|||
* If we're configured to use STUN, then find out the mapped address,
|
||||
* and make sure that the mapped RTCP port is adjacent with the RTP.
|
||||
*/
|
||||
if (!use_ipv6 && pjsua_sip_acc_is_using_stun(call_med->call->acc_id) &&
|
||||
if (!use_ipv6 &&
|
||||
pjsua_media_acc_is_using_stun(call_med->call->acc_id) &&
|
||||
pjsua_var.stun_srv.addr.sa_family != 0)
|
||||
{
|
||||
char ip_addr[32];
|
||||
|
@ -747,10 +748,12 @@ static pj_status_t create_ice_media_transport(
|
|||
acc_cfg = &pjsua_var.acc[call_med->call->acc_id].cfg;
|
||||
|
||||
/* Make sure STUN server resolution has completed */
|
||||
status = resolve_stun_server(PJ_TRUE);
|
||||
if (status != PJ_SUCCESS) {
|
||||
pjsua_perror(THIS_FILE, "Error resolving STUN server", status);
|
||||
return status;
|
||||
if (pjsua_media_acc_is_using_stun(call_med->call->acc_id)) {
|
||||
status = resolve_stun_server(PJ_TRUE);
|
||||
if (status != PJ_SUCCESS) {
|
||||
pjsua_perror(THIS_FILE, "Error resolving STUN server", status);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
/* Create ICE stream transport configuration */
|
||||
|
@ -765,7 +768,9 @@ static pj_status_t create_ice_media_transport(
|
|||
ice_cfg.opt = acc_cfg->ice_cfg.ice_opt;
|
||||
|
||||
/* Configure STUN settings */
|
||||
if (pj_sockaddr_has_addr(&pjsua_var.stun_srv)) {
|
||||
if (pj_sockaddr_has_addr(&pjsua_var.stun_srv) &&
|
||||
pjsua_media_acc_is_using_stun(call_med->call->acc_id))
|
||||
{
|
||||
pj_sockaddr_print(&pjsua_var.stun_srv, stunip, sizeof(stunip), 0);
|
||||
ice_cfg.stun.server = pj_str(stunip);
|
||||
ice_cfg.stun.port = pj_sockaddr_get_port(&pjsua_var.stun_srv);
|
||||
|
|
Loading…
Reference in New Issue