Module: sems Branch: rco/dnscache Commit: 0672c66d8e99208cba548d02b1d9adf292430f71 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=0672c66d8e99208cba548d02b1d9adf292430f71
Author: Raphael Coeffic <[email protected]> Committer: Raphael Coeffic <[email protected]> Date: Wed Sep 1 10:28:24 2010 +0200 fixes the port number when a new address is used --- core/sip/trans_layer.cpp | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/core/sip/trans_layer.cpp b/core/sip/trans_layer.cpp index 087b593..5fee74e 100644 --- a/core/sip/trans_layer.cpp +++ b/core/sip/trans_layer.cpp @@ -1696,19 +1696,28 @@ void _trans_layer::timer_expired(timer* t, trans_bucket* bucket, sip_trans* tr) sockaddr_storage sa; memset(&sa,0,sizeof(sockaddr_storage)); - //TODO: get the right port number - // get the next ip if(tr->msg->h_dns.next_ip(&sa) < 0){ tr->clear_timer(STIMER_M); return; } + + //If a SRV record is involved, the port number + // should have been set by h_dns.next_ip(...). + if(!((sockaddr_in*)&sa)->sin_port){ + //Else, we copy the old port number + ((sockaddr_in*)&sa)->sin_port = ((sockaddr_in*)&tr->msg->remote_ip)->sin_port; + } + + // copy the new address back memcpy(&tr->msg->remote_ip,&sa,sizeof(sockaddr_storage)); + // create new branch tag compute_branch((char*)(tr->msg->via_p1->branch.s+MAGIC_BRANCH_LEN), tr->msg->callid->value,tr->msg->cseq->value); + // and re-send retransmit(tr->msg); // reset counter for timer A & E _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
