From 1e49381d0e8e1a57afe3e59f5e91c06d66ebc335 Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Tue, 16 Oct 2007 20:03:32 +0000 Subject: [PATCH] * In OpenSER mode cr is added after lf only if it is not already there. There may be a bug in sems, because sometimes cr is in sdp body (like when calling out using di_dial) and sometimes not (like inviting a new member to conference). git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@535 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- core/AmSipDialog.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/core/AmSipDialog.cpp b/core/AmSipDialog.cpp index 65ba3aae..fad8dfeb 100644 --- a/core/AmSipDialog.cpp +++ b/core/AmSipDialog.cpp @@ -193,15 +193,10 @@ void AmSipDialog::updateStatus(const AmSipReply& reply) if(!reply.route.empty()) setRoute(reply.route); - if (!reply.next_hop.empty()) - next_hop = reply.next_hop; + next_hop = reply.next_hop; } - if (!reply.next_request_uri.empty()) { - DBG("updating remote Contact: %s -> %s\n", - remote_uri.c_str(), reply.next_request_uri.c_str()); - remote_uri = reply.next_request_uri; - } + remote_uri = reply.next_request_uri; switch(status){ case Disconnecting: @@ -298,15 +293,19 @@ string escape(string s) return s; } -/* Add CR before each LF */ +/* Add CR before each LF if not already there */ string lf2crlf(string s) { string::size_type pos; pos = 0; while ((pos = s.find("\n", pos)) != string::npos) { - s.insert(pos, "\r"); - pos = pos + 2; + if ((pos > 0) && (s[pos - 1] == 13)) { + pos = pos + 1; + } else { + s.insert(pos, "\r"); + pos = pos + 2; + } } return s; }