diff options
author | Benny Prijono <bennylp@teluu.com> | 2013-01-16 09:51:45 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2013-01-16 09:51:45 +0000 |
commit | 499311adc96333e1bf0c9b59321f458e949e9a39 (patch) | |
tree | 90de2c218f5d7b0a9fce97025d8157dc05045e10 /pjsip | |
parent | c157bc02e842ad3b6eb84fc841d07504fbb423ec (diff) |
Fixed #1607: Send UDP keep-alive to original request address if response comes from different address
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4318 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_acc.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_acc.c b/pjsip/src/pjsua-lib/pjsua_acc.c index 14575f56..d121dc16 100644 --- a/pjsip/src/pjsua-lib/pjsua_acc.c +++ b/pjsip/src/pjsua-lib/pjsua_acc.c @@ -1862,9 +1862,26 @@ static void update_keep_alive(pjsua_acc *acc, pj_bool_t start, /* Save transport and destination address. */ acc->ka_transport = param->rdata->tp_info.transport; pjsip_transport_add_ref(acc->ka_transport); - pj_memcpy(&acc->ka_target, ¶m->rdata->pkt_info.src_addr, - param->rdata->pkt_info.src_addr_len); - acc->ka_target_len = param->rdata->pkt_info.src_addr_len; + + /* https://trac.pjsip.org/repos/ticket/1607: + * Calculate the destination address from the original request. Some + * (broken) servers send the response using different source address + * than the one that receives the request, which is forbidden by RFC + * 3581. + */ + { + pjsip_transaction *tsx; + pjsip_tx_data *req; + + tsx = pjsip_rdata_get_tsx(param->rdata); + PJ_ASSERT_ON_FAIL(tsx, return); + + req = tsx->last_tx; + + pj_memcpy(&acc->ka_target, &req->tp_info.dst_addr, + req->tp_info.dst_addr_len); + acc->ka_target_len = req->tp_info.dst_addr_len; + } /* Setup and start the timer */ acc->ka_timer.cb = &keep_alive_timer_cb; |