diff options
author | Benny Prijono <bennylp@teluu.com> | 2013-06-27 10:07:14 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2013-06-27 10:07:14 +0000 |
commit | 6c89f9bf3b48896bcaf8d65caf8513f722eeb2e3 (patch) | |
tree | e00b5f63cf88bf7295928e529c2070bb2448dbcc /pjsip | |
parent | 5f38a6edfb8fc1824b133f9bda6d080b73663ea3 (diff) |
More re #1683:
- also update the Via port when only the port has changed AND either the received IP is public OR allow_contact_rewrite is set to 2
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4546 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_acc.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_acc.c b/pjsip/src/pjsua-lib/pjsua_acc.c index bcebe355..52c5685d 100644 --- a/pjsip/src/pjsua-lib/pjsua_acc.c +++ b/pjsip/src/pjsua-lib/pjsua_acc.c @@ -1451,10 +1451,17 @@ static pj_bool_t acc_check_nat_addr(pjsua_acc *acc, via_addr = &via->sent_by.host; /* If allow_via_rewrite is enabled, we save the Via "received" address - * from the response. + * from the response, if either of the following condition is met: + * - the Via "received" address differs from saved one (or we haven't + * saved any yet) + * - transport is different + * - only the port has changed, AND either the received address is + * public IP or allow_contact_rewrite is 2 */ if (acc->cfg.allow_via_rewrite && - (pj_strcmp(&acc->via_addr.host, via_addr) || acc->via_tp != tp)) + (pj_strcmp(&acc->via_addr.host, via_addr) || acc->via_tp != tp || + (acc->via_addr.port != rport && + (!is_private_ip(via_addr) || acc->cfg.allow_contact_rewrite == 2)))) { if (pj_strcmp(&acc->via_addr.host, via_addr)) pj_strdup(acc->pool, &acc->via_addr.host, via_addr); |