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

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Wed Apr 11 17:34:03 2012 +0200

option to ignore low CSeq for NOTIFY for old event sub implementations

new sems.conf option:

  Ignore too low CSeq for NOTIFYs? [yes | no]

 May be necessary to interwork with simplistic/old (following 3265
 instead of 5057) SIP event notification implementations.

 ignore_notify_lower_cseq=yes

---

 core/AmConfig.cpp         |    5 +++++
 core/AmConfig.h           |    2 ++
 core/AmSipDialog.cpp      |   23 ++++++++++++++---------
 core/etc/sems.conf.sample |    7 +++++++
 4 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/core/AmConfig.cpp b/core/AmConfig.cpp
index d0d427d..48673b3 100644
--- a/core/AmConfig.cpp
+++ b/core/AmConfig.cpp
@@ -80,6 +80,7 @@ string       AmConfig::OutboundProxy           = "";
 bool         AmConfig::ForceOutboundProxy      = false;
 string       AmConfig::NextHop                 = "";
 bool         AmConfig::ProxyStickyAuth         = false;
+bool         AmConfig::IgnoreNotifyLowerCSeq   = false;
 bool         AmConfig::DisableDNSSRV           = false;
 string       AmConfig::Signature               = "";
 unsigned int AmConfig::MaxForwards             = MAX_FORWARDS;
@@ -324,6 +325,10 @@ int AmConfig::readConfiguration()
     ProxyStickyAuth = (cfg.getParameter("proxy_sticky_auth") == "yes");
   }
 
+  if(cfg.hasParameter("ignore_notify_lower_cseq")) {
+    IgnoreNotifyLowerCSeq = (cfg.getParameter("ignore_notify_lower_cseq") == 
"yes");
+  }
+
   if(cfg.hasParameter("disable_dns_srv")) {
     DisableDNSSRV = (cfg.getParameter("disable_dns_srv") == "yes");
   }
diff --git a/core/AmConfig.h b/core/AmConfig.h
index 6718200..aaa10c2 100644
--- a/core/AmConfig.h
+++ b/core/AmConfig.h
@@ -145,6 +145,8 @@ struct AmConfig
   static string NextHop;
   /** update ruri-host to previously resolved IP:port on SIP auth */
   static bool ProxyStickyAuth;
+  /** Ignore Low CSeq on NOTIFY  - for RFC 3265 instead of 5057 */
+  static bool IgnoreNotifyLowerCSeq;
   /** skip DNS SRV lookup for resolving destination address*/
   static bool DisableDNSSRV;
   /** Server/User-Agent header (optional) */
diff --git a/core/AmSipDialog.cpp b/core/AmSipDialog.cpp
index 2d93eeb..40c3d7c 100644
--- a/core/AmSipDialog.cpp
+++ b/core/AmSipDialog.cpp
@@ -112,17 +112,22 @@ void AmSipDialog::onRxRequest(const AmSipRequest& req)
 
     // Sanity checks
     if (r_cseq_i && req.cseq <= r_cseq){
-      string hdrs;
-      if (req.method == "NOTIFY") {
-       // clever trick to not break subscription dialog usage
-       // for implementations which follow 3265 instead of 5057
-       hdrs = SIP_HDR_COLSP(SIP_HDR_RETRY_AFTER)  "0"  CRLF;
+      string hdrs; bool i = false;
+      if (req.method == SIP_METH_NOTIFY) {
+       if (AmConfig::IgnoreNotifyLowerCSeq)
+         i = true;
+       else
+         // clever trick to not break subscription dialog usage
+         // for implementations which follow 3265 instead of 5057
+         hdrs = SIP_HDR_COLSP(SIP_HDR_RETRY_AFTER)  "0"  CRLF;
       }
 
-      INFO("remote cseq lower than previous ones - refusing request\n");
-      // see 12.2.2
-      reply_error(req, 500, SIP_REPLY_SERVER_INTERNAL_ERROR, hdrs);
-      return;
+      if (!i) {
+       INFO("remote cseq lower than previous ones - refusing request\n");
+       // see 12.2.2
+       reply_error(req, 500, SIP_REPLY_SERVER_INTERNAL_ERROR, hdrs);
+       return;
+      }
     }
 
     if (req.method == SIP_METH_INVITE) {
diff --git a/core/etc/sems.conf.sample b/core/etc/sems.conf.sample
index fdc934f..87e6986 100644
--- a/core/etc/sems.conf.sample
+++ b/core/etc/sems.conf.sample
@@ -494,6 +494,13 @@ use_default_signature=yes
 #
 # proxy_sticky_auth=yes
 
+# Ignore too low CSeq for NOTIFYs? [yes | no]
+#
+# May be necessary to interwork with simplistic/old SIP event notification 
+# implementations.
+#
+#ignore_notify_lower_cseq=yes
+
 #
 # Accept final replies without To-tag? [yes|no]
 #

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

Reply via email to