Hello,

o Robert Szokovacs [06/11/09 10:54]:
On 2009 May 19, Tuesday 15:14:36 [email protected] wrote:

Hi,

in this code you don't send expires header when the expires value is 0. However, according to RCF3265, 3.1.1, 0 is a valid value. Please see the attached patch for my fix proposal.
0 is an allowed value for Expires header according to 3261, so I added the patch.

Be aware though, that the Expires header in the REFER request is *not* the same as the Expires header in SUBSCRIBE, and the value in NOTIFY. The Expires in REFER would IMO have a meaning only for the request to refer (and 0 value does not make any sense there), not about the subscription duration.

see also
http://www.mail-archive.com/[email protected]/msg00809.html
http://www.ietf.org/mail-archive/web/sip/current/msg01917.html

BR
Stefan


br

Szo

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

--
Stefan Sayer
VoIP Services

[email protected]
www.iptego.com

IPTEGO GmbH
Wittenbergplatz 1
10789 Berlin
Germany

Amtsgericht Charlottenburg, HRB 101010
Geschaeftsfuehrer: Alexander Hoffmann
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to