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

Author: bpintea <[email protected]>
Committer: bpintea <[email protected]>
Date:   Sat Nov 20 16:04:29 2010 +0100

100rel b/f

b/f: if '100rel' string already present in the right header
     (Require/Supported), don't add it again.
     The fix should help in B2B cases.

---

 core/AmSipDialog.cpp |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/core/AmSipDialog.cpp b/core/AmSipDialog.cpp
index 426171c..5d41eaa 100644
--- a/core/AmSipDialog.cpp
+++ b/core/AmSipDialog.cpp
@@ -551,12 +551,17 @@ void AmSipDialog::rel100OnReplyOut(const AmSipRequest 
&req, unsigned int code,
     if (100 < code && code < 200) {
       switch (reliable_1xx) {
         case REL100_SUPPORTED:
-          hdrs += SIP_HDR_COLSP(SIP_HDR_SUPPORTED) SIP_EXT_100REL CRLF;
+          if (! key_in_list(getHeader(hdrs, SIP_HDR_REQUIRE), SIP_EXT_100REL))
+            hdrs += SIP_HDR_COLSP(SIP_HDR_SUPPORTED) SIP_EXT_100REL CRLF;
           break;
         case REL100_REQUIRE:
           // add Require HF
-          hdrs += SIP_HDR_COLSP(SIP_HDR_REQUIRE) SIP_EXT_100REL CRLF;
+          if (! key_in_list(getHeader(hdrs, SIP_HDR_REQUIRE), SIP_EXT_100REL))
+            hdrs += SIP_HDR_COLSP(SIP_HDR_REQUIRE) SIP_EXT_100REL CRLF;
           // add RSeq HF
+          if (getHeader(hdrs, SIP_HDR_RSEQ).length())
+            // already added (by app?)
+            break;
 #ifndef NDEBUG
           if ((abs(rseq) & ((1 << MAX_RSEQ_BITS) - 1)) == 
               ((1 << MAX_RSEQ_BITS) - 1)) {
@@ -882,11 +887,13 @@ void AmSipDialog::rel100OnRequestOut(const string 
&method, string &hdrs)
 
   switch(reliable_1xx) {
     case REL100_SUPPORTED:
-      hdrs += SIP_HDR_COLSP(SIP_HDR_SUPPORTED) SIP_EXT_100REL CRLF;
-      return;
+      if (! key_in_list(getHeader(hdrs, SIP_HDR_REQUIRE), SIP_EXT_100REL))
+        hdrs += SIP_HDR_COLSP(SIP_HDR_SUPPORTED) SIP_EXT_100REL CRLF;
+      break;
     case REL100_REQUIRE:
-      hdrs += SIP_HDR_COLSP(SIP_HDR_REQUIRE) SIP_EXT_100REL CRLF;
-      return;
+      if (! key_in_list(getHeader(hdrs, SIP_HDR_REQUIRE), SIP_EXT_100REL))
+        hdrs += SIP_HDR_COLSP(SIP_HDR_REQUIRE) SIP_EXT_100REL CRLF;
+      break;
     default:
       ERROR("BUG: unexpected reliability switch value of '%d'.\n",
           reliable_1xx);

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

Reply via email to