summaryrefslogtreecommitdiff
path: root/pjsip
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2009-11-10 03:45:42 +0000
committerBenny Prijono <bennylp@teluu.com>2009-11-10 03:45:42 +0000
commitc019e89de8322549b99856e0c7c243780d44d6e9 (patch)
tree386e327c6a4fb56e99442a0db9271287258c90b3 /pjsip
parent71fd5297986ebaf30a22dfbabf88a8f0e80a9091 (diff)
Ticket #864: Revise on account registration Contact update rule
- don't switch if only port number is different and the Via received address is private - always update the transport (i.e. Via) address as well git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3001 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r--pjsip/src/pjsua-lib/pjsua_acc.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_acc.c b/pjsip/src/pjsua-lib/pjsua_acc.c
index 26ff39a7..4321d752 100644
--- a/pjsip/src/pjsua-lib/pjsua_acc.c
+++ b/pjsip/src/pjsua-lib/pjsua_acc.c
@@ -687,6 +687,19 @@ static pj_bool_t acc_check_nat_addr(pjsua_acc *acc,
return PJ_FALSE;
}
+ /* Also don't switch if only the port number part is different, and
+ * the Via received address is private.
+ * See http://trac.pjsip.org/repos/ticket/864
+ */
+ if (acc->cfg.allow_contact_rewrite != 2 &&
+ pj_sockaddr_cmp(&contact_addr, &recv_addr)==0 &&
+ is_private_ip(via_addr))
+ {
+ /* Don't switch */
+ pj_pool_release(pool);
+ return PJ_FALSE;
+ }
+
PJ_LOG(3,(THIS_FILE, "IP address change detected for account %d "
"(%.*s:%d --> %.*s:%d). Updating registration..",
acc->index,
@@ -743,16 +756,9 @@ static pj_bool_t acc_check_nat_addr(pjsua_acc *acc,
pj_strdup2_with_null(acc->pool, &acc->contact, tmp);
}
- /* For UDP transport, if STUN is enabled then update the transport's
- * published name as well.
- */
- if (tp->key.type==PJSIP_TRANSPORT_UDP &&
- (pjsua_var.ua_cfg.stun_domain.slen != 0 ||
- pjsua_var.ua_cfg.stun_host.slen != 0))
- {
- pj_strdup_with_null(tp->pool, &tp->local_name.host, via_addr);
- tp->local_name.port = rport;
- }
+ /* Always update, by http://trac.pjsip.org/repos/ticket/864. */
+ pj_strdup_with_null(tp->pool, &tp->local_name.host, via_addr);
+ tp->local_name.port = rport;
/* Perform new registration */
pjsua_acc_set_registration(acc->index, PJ_TRUE);