From d0a74c550ebd1b514a0b660c57d3ff59ed0d63ab Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Thu, 28 Feb 2008 11:16:10 +0000 Subject: [PATCH] - fixes the issue with B2BUA and bad 'Contact' as reported by Juha. git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@749 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- core/AmSipDialog.cpp | 5 +++++ core/AmSipMsg.h | 5 +++-- core/plug-in/sipctrl/SipCtrlInterface.cpp | 8 ++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/core/AmSipDialog.cpp b/core/AmSipDialog.cpp index 8c3529b5..8c65b5d6 100644 --- a/core/AmSipDialog.cpp +++ b/core/AmSipDialog.cpp @@ -200,6 +200,11 @@ void AmSipDialog::updateStatus(const AmSipReply& reply) remote_uri = reply.next_request_uri; + if(!reply.dstip.empty()){ + sip_ip = reply.dstip; + sip_port = reply.port; + } + switch(status){ case Disconnecting: if( t.method == "INVITE" ){ diff --git a/core/AmSipMsg.h b/core/AmSipMsg.h index 43850533..2b3ef7e8 100644 --- a/core/AmSipMsg.h +++ b/core/AmSipMsg.h @@ -19,6 +19,9 @@ class _AmSipMsgInDlg string body; unsigned int cseq; + string dstip; // IP where Ser received the message + string port; // Ser's SIP port + string serKey; _AmSipMsgInDlg() : cseq(0) { } @@ -50,8 +53,6 @@ class AmSipRequest : public _AmSipMsgInDlg string user; string domain; - string dstip; // IP where Ser received the message - string port; // Ser's SIP port string r_uri; string from_uri; string from; diff --git a/core/plug-in/sipctrl/SipCtrlInterface.cpp b/core/plug-in/sipctrl/SipCtrlInterface.cpp index e82447eb..9763c38f 100644 --- a/core/plug-in/sipctrl/SipCtrlInterface.cpp +++ b/core/plug-in/sipctrl/SipCtrlInterface.cpp @@ -94,8 +94,9 @@ string SipCtrlInterface::getContact(const string &displayName, if (hostName.length()) localUri += hostName; else { - localUri += AmConfig::LocalSIPIP; // Ser will replace that... - localUri += ":" + AmConfig::LocalSIPPort; + + localUri += AmConfig::LocalSIPIP; + localUri += ":" + int2str(AmConfig::LocalSIPPort); } if (uriParams.length()) { @@ -502,6 +503,9 @@ void SipCtrlInterface::handle_sip_reply(sip_msg* msg) reply.remote_tag = c2stlstr(((sip_from_to*)msg->to->p)->tag); reply.local_tag = c2stlstr(((sip_from_to*)msg->from->p)->tag); + reply.dstip = get_addr_str(((sockaddr_in*)(&msg->local_ip))->sin_addr); //FIXME: IPv6 + reply.port = int2str(ntohs(((sockaddr_in*)(&msg->local_ip))->sin_port)); + if( (get_cseq(msg)->method == sip_request::INVITE) && (msg->u.reply->code >= 200) && (msg->u.reply->code < 300) ){