Module: sems
Branch: master
Commit: 0316b50aad8ca88750563b73310923b98655bfab
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=0316b50aad8ca88750563b73310923b98655bfab

Author: Juha Heinanen <[email protected]>
Committer: Juha Heinanen <[email protected]>
Date:   Sat Apr 27 16:27:33 2013 +0300

core: make sure that address type is correct on o= and c= lines of sdp

---

 core/AmSdp.cpp |   30 ++++++++++++++++++++++--------
 1 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/core/AmSdp.cpp b/core/AmSdp.cpp
index fa5448b..8f7945d 100644
--- a/core/AmSdp.cpp
+++ b/core/AmSdp.cpp
@@ -237,21 +237,35 @@ void AmSdp::print(string& body) const
 {
   string out_buf = "v="+int2str(version)+"\r\n"
     "o="+origin.user+" "+int2str(origin.sessId)+" "+
-         int2str(origin.sessV)+" IN " + addr_t_2_str(conn.addrType) + " ";
+    int2str(origin.sessV)+" IN ";
+
   if (!origin.conn.address.empty())
-    out_buf += origin.conn.address+"\r\n";
+    if (origin.conn.address.find(".") != std::string::npos)
+      out_buf += "IP4 " + origin.conn.address + "\r\n";
+    else
+      out_buf += "IP6 " + origin.conn.address + "\r\n";
   else if (!conn.address.empty())
-    out_buf += conn.address+"\r\n";
+    if (conn.address.find(".") != std::string::npos)
+      out_buf += "IP4 " + conn.address + "\r\n";
+    else
+      out_buf += "IP6 " + conn.address + "\r\n";
   else if (media.size() && !media[0].conn.address.empty())
-    out_buf += media[0].conn.address+"\r\n";
+    if (media[0].conn.address.find(".") != std::string::npos)
+      out_buf += "IP4 " + media[0].conn.address + "\r\n";
+    else
+      out_buf += "IP6 " + media[0].conn.address + "\r\n";
   else
-    out_buf += "0.0.0.0\r\n";
+    out_buf += "IP4 0.0.0.0\r\n";
 
   out_buf +=
     "s="+sessionName+"\r\n";
-  if (!conn.address.empty())
-    out_buf += "c=IN " + addr_t_2_str(conn.addrType) + " " +
-           conn.address + "\r\n";
+  if (!conn.address.empty()) {
+    if (conn.address.find(".") != std::string::npos)
+      out_buf += "c=IN IP4 ";
+    else
+      out_buf += "c=IN IP6 ";
+    out_buf += conn.address + "\r\n";
+  }
 
   out_buf += "t=0 0\r\n";
 

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to