Author: sayer
Date: 2009-05-19 15:14:35 +0200 (Tue, 19 May 2009)
New Revision: 1388

Modified:
   trunk/apps/announce_transfer/AnnounceTransfer.cpp
   trunk/core/AmSipDialog.cpp
   trunk/core/AmSipDialog.h
Log:
refer optionally with expires
some fix with CRLF on refer-to
some fix with content_type on announce_transfer

based on patch by Balint Kovacs



Modified: trunk/apps/announce_transfer/AnnounceTransfer.cpp
===================================================================
--- trunk/apps/announce_transfer/AnnounceTransfer.cpp   2009-05-19 11:22:47 UTC 
(rev 1387)
+++ trunk/apps/announce_transfer/AnnounceTransfer.cpp   2009-05-19 13:14:35 UTC 
(rev 1388)
@@ -143,8 +143,7 @@
       if (getHeader(req.hdrs,"Event") != "refer") 
        throw AmSession::Exception(481, "Subscription does not exist");
 
-      if ((strip_header_params(getHeader(req.hdrs,"Content-Type")) 
-          != "message/sipfrag"))
+      if ((strip_header_params(req.content_type) != "message/sipfrag"))
        throw AmSession::Exception(415, "Unsupported Media Type");
                        
       string sipfrag_sline = req.body.substr(8, req.body.find("\n") - 8);

Modified: trunk/core/AmSipDialog.cpp
===================================================================
--- trunk/core/AmSipDialog.cpp  2009-05-19 11:22:47 UTC (rev 1387)
+++ trunk/core/AmSipDialog.cpp  2009-05-19 13:14:35 UTC (rev 1388)
@@ -449,11 +449,16 @@
   }    
 }
 
-int AmSipDialog::refer(const string& refer_to)
+int AmSipDialog::refer(const string& refer_to,
+                      int expires)
 {
   switch(status){
-  case Connected:
-    return sendRequest("REFER", "", "", "Refer-To: "+refer_to);
+  case Connected: {
+    string hdrs = "Refer-To: " + refer_to + CRLF;
+    if (expires>0) 
+      hdrs+= "Expires: " + int2str(expires) + CRLF;
+    return sendRequest("REFER", "", "", hdrs);
+  }
   case Disconnecting:
   case Pending:
     DBG("refer(): we are not yet connected."
@@ -478,7 +483,7 @@
     AmSipDialog tmp_d(*this);
                
     tmp_d.setRoute("");
-    tmp_d.contact_uri = "Contact: <" + tmp_d.remote_uri + ">\n";
+    tmp_d.contact_uri = "Contact: <" + tmp_d.remote_uri + ">" CRLF;
     tmp_d.remote_uri = target;
                
     string r_set;
@@ -655,7 +660,7 @@
     string::size_type comma_pos;
        
     comma_pos = m_route.find(',');
-    //route += "Route: " + m_route.substr(0,comma_pos) + "\n";
+    //route += "Route: " + m_route.substr(0,comma_pos) + "\r\n";
     route.push_back(m_route.substr(0,comma_pos));
        
     if(comma_pos != string::npos)

Modified: trunk/core/AmSipDialog.h
===================================================================
--- trunk/core/AmSipDialog.h    2009-05-19 11:22:47 UTC (rev 1387)
+++ trunk/core/AmSipDialog.h    2009-05-19 13:14:35 UTC (rev 1388)
@@ -176,7 +176,8 @@
   int invite(const string& hdrs,  
             const string& content_type,
             const string& body);
-  int refer(const string& refer_to);
+  int refer(const string& refer_to,
+           int expires = -1);
   int transfer(const string& target);
   int drop();
 

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

Reply via email to