summaryrefslogtreecommitdiff
path: root/pjsip/src/pjsua-lib/pjsua_media.c
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2016-05-31 04:28:00 +0000
committerNanang Izzuddin <nanang@teluu.com>2016-05-31 04:28:00 +0000
commit44ffa26787dc2e24069303eded31c9be5253e102 (patch)
tree456ad8b0f00e29ef28a2815faac09f33b46980dd /pjsip/src/pjsua-lib/pjsua_media.c
parent2e0a80f6dcd9a642d659a452df264196ac701819 (diff)
Re #1918:
- Fixed issue of cannot make/receive call after previous call initialization fails due to STUN error, reproducing steps: 1. Configure an account with acc->cfg.media_stun_use set PJSUA_STUN_RETRY_ON_FAILURE. 2. Start pjsua with STUN servers A and B configured. On startup, both STUN servers A and B are available, so PJSIP will use STUN server A 3. Both STUN server A and B become unavailable 4. Make an outgoing call. 5. Pjsua first tries with STUN server A, fails 6. Pjsua then retry with STUN server B, still fails 7. PJSIP then aborts the call with error (which is desired!) 8. Both STUN server A and B become available again 9. User tries to dial or receive an incoming call, but cannot because the last STUN server status is stored and used in making/receiving call without retrying to resolve STUN server. - Fixed deadlock issues. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5326 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsua-lib/pjsua_media.c')
-rw-r--r--pjsip/src/pjsua-lib/pjsua_media.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_media.c b/pjsip/src/pjsua-lib/pjsua_media.c
index bb8dc49b..cab67ff2 100644
--- a/pjsip/src/pjsua-lib/pjsua_media.c
+++ b/pjsip/src/pjsua-lib/pjsua_media.c
@@ -254,7 +254,10 @@ static pj_status_t create_rtp_rtcp_sock(pjsua_call_media *call_med,
/* Make sure STUN server resolution has completed */
if (!use_ipv6 && pjsua_media_acc_is_using_stun(call_med->call->acc_id)) {
- status = resolve_stun_server(PJ_TRUE);
+ pj_bool_t retry_stun = (acc->cfg.media_stun_use &
+ PJSUA_STUN_RETRY_ON_FAILURE) ==
+ PJSUA_STUN_RETRY_ON_FAILURE;
+ status = resolve_stun_server(PJ_TRUE, retry_stun);
if (status != PJ_SUCCESS) {
pjsua_perror(THIS_FILE, "Error resolving STUN server", status);
return status;
@@ -390,7 +393,8 @@ static pj_status_t create_rtp_rtcp_sock(pjsua_call_media *call_med,
#endif
if (status != PJ_SUCCESS && pjsua_var.ua_cfg.stun_srv_cnt > 1 &&
- ((acc->cfg.media_stun_use & PJSUA_STUN_RETRY_ON_FAILURE)!=0))
+ ((acc->cfg.media_stun_use & PJSUA_STUN_RETRY_ON_FAILURE)==
+ PJSUA_STUN_RETRY_ON_FAILURE))
{
pj_str_t srv =
pjsua_var.ua_cfg.stun_srv[pjsua_var.stun_srv_idx];
@@ -418,11 +422,7 @@ static pj_status_t create_rtp_rtcp_sock(pjsua_call_media *call_med,
}
status=pjsua_update_stun_servers(pjsua_var.ua_cfg.stun_srv_cnt,
pjsua_var.ua_cfg.stun_srv,
- PJ_FALSE);
-
- if (status == PJ_SUCCESS)
- status = resolve_stun_server(PJ_TRUE);
-
+ PJ_TRUE);
if (status == PJ_SUCCESS) {
if (pjsua_var.stun_srv.addr.sa_family != 0) {
pj_sockaddr_print(&pjsua_var.stun_srv,
@@ -828,7 +828,10 @@ static pj_status_t create_ice_media_transport(
/* Make sure STUN server resolution has completed */
if (pjsua_media_acc_is_using_stun(call_med->call->acc_id)) {
- status = resolve_stun_server(PJ_TRUE);
+ pj_bool_t retry_stun = (acc_cfg->media_stun_use &
+ PJSUA_STUN_RETRY_ON_FAILURE) ==
+ PJSUA_STUN_RETRY_ON_FAILURE;
+ status = resolve_stun_server(PJ_TRUE, retry_stun);
if (status != PJ_SUCCESS) {
pjsua_perror(THIS_FILE, "Error resolving STUN server", status);
return status;