Module: kamailio
Branch: master
Commit: 9fd57a96510898dfaa5b73d8bc9b884fd8960622
URL: 
https://github.com/kamailio/kamailio/commit/9fd57a96510898dfaa5b73d8bc9b884fd8960622

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2015-07-30T12:36:14+02:00

Merge pull request #257 from krieger-od/master

rr: add enable double rr always option

---

Modified: modules/rr/doc/rr_admin.xml
Modified: modules/rr/record.c
Modified: tcp_read.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/9fd57a96510898dfaa5b73d8bc9b884fd8960622.diff
Patch: 
https://github.com/kamailio/kamailio/commit/9fd57a96510898dfaa5b73d8bc9b884fd8960622.patch

---

diff --git a/modules/rr/doc/rr_admin.xml b/modules/rr/doc/rr_admin.xml
index 5108165..4d1b904 100644
--- a/modules/rr/doc/rr_admin.xml
+++ b/modules/rr/doc/rr_admin.xml
@@ -175,6 +175,25 @@ modparam("rr", "enable_double_rr", 0)
 ...
 </programlisting>
       </example>
+      <para>Some useragents (e. g. Linphone) incorrectly use UDP transport for
+      subsequent requests in dialog, despite being configured to use another
+      SIP transport protocol. This can be worked around by setting Record-Route
+      header with explicit transport attribute. But enable_double_rr enabled in
+      default mode omits transport attribute from being added to header if it
+      detects that both sender and receiver use same protocol (e. g. TCP or
+      TLS), and this results in UDP being used by such broken clients. Set
+      enable_double_rr to value 2 to always have two RR headers with transport
+      attributes expicitly set.</para>
+
+      <example>
+        <title>Set <varname>enable_double_rr</varname> to 2 to always have two 
explicit RR headers</title>
+
+        <programlisting format="linespecific">
+...
+modparam("rr", "enable_double_rr", 2)
+...
+</programlisting>
+      </example>
     </section>
 
     <section>
diff --git a/modules/rr/record.c b/modules/rr/record.c
index d335748..9fdd157 100644
--- a/modules/rr/record.c
+++ b/modules/rr/record.c
@@ -283,7 +283,7 @@ static inline int build_rr(struct lump* _l, struct lump* 
_l2, str* user,
        if (_l ==0 )
                goto lump_err;
        if (enable_double_rr) {
-               if (!(_l = insert_cond_lump_after(_l, COND_IF_DIFF_REALMS, 0)))
+               if (!(_l = insert_cond_lump_after(_l, enable_double_rr == 2 ? 
COND_TRUE : COND_IF_DIFF_REALMS, 0)))
                        goto lump_err;
                if (!(_l = insert_new_lump_after(_l, r2, RR_R2_LEN, 0)))
                        goto lump_err;
@@ -429,8 +429,8 @@ int record_route(struct sip_msg* _m, str *params)
                        ret = -5;
                        goto error;
                }
-               l = insert_cond_lump_after(l, COND_IF_DIFF_REALMS, 0);
-               l2 = insert_cond_lump_before(l2, COND_IF_DIFF_REALMS, 0);
+               l = insert_cond_lump_after(l, enable_double_rr == 2 ? COND_TRUE 
: COND_IF_DIFF_REALMS, 0);
+               l2 = insert_cond_lump_before(l2, enable_double_rr == 2 ? 
COND_TRUE : COND_IF_DIFF_REALMS, 0);
                if (!l || !l2) {
                        LM_ERR("failed to insert conditional lump\n");
                        ret = -6;
@@ -706,14 +706,14 @@ static inline int build_advertised_rr(struct lump* _l, 
struct lump* _l2, str *_d
                goto lump_err;
        }
        hdr = NULL;
-       if (!(_l = insert_cond_lump_after(_l, COND_IF_DIFF_PROTO, 0)))
+       if (!(_l = insert_cond_lump_after(_l, enable_double_rr == 2 ? COND_TRUE 
: COND_IF_DIFF_PROTO, 0)))
                goto lump_err;
        if (!(_l = insert_new_lump_after(_l, trans, RR_TRANS_LEN, 0)))
                goto lump_err;
        if (!(_l = insert_subst_lump_after(_l, 
_inbound?SUBST_RCV_PROTO:SUBST_SND_PROTO, 0)))
                goto lump_err;
        if (enable_double_rr) {
-               if (!(_l = insert_cond_lump_after(_l, COND_IF_DIFF_REALMS, 0)))
+               if (!(_l = insert_cond_lump_after(_l, enable_double_rr == 2 ? 
COND_TRUE : COND_IF_DIFF_REALMS, 0)))
                        goto lump_err;
                if (!(_l = insert_new_lump_after(_l, r2, RR_R2_LEN, 0)))
                        goto lump_err;
@@ -790,8 +790,8 @@ int record_route_advertised_address(struct sip_msg* _m, 
str* _data)
                        ret = -3;
                        goto error;
                }
-               l = insert_cond_lump_after(l, COND_IF_DIFF_PROTO, 0);
-               l2 = insert_cond_lump_before(l2, COND_IF_DIFF_PROTO, 0);
+               l = insert_cond_lump_after(l, enable_double_rr == 2 ? COND_TRUE 
: COND_IF_DIFF_PROTO, 0);
+               l2 = insert_cond_lump_before(l2, enable_double_rr == 2 ? 
COND_TRUE : COND_IF_DIFF_PROTO, 0);
                if (!l || !l2) {
                        LM_ERR("failed to insert conditional lump\n");
                        ret = -4;
diff --git a/tcp_read.c b/tcp_read.c
index 2e1d3f2..f6ffb7b 100644
--- a/tcp_read.c
+++ b/tcp_read.c
@@ -1663,6 +1663,7 @@ inline static int handle_io(struct fd_map* fm, short 
events, int idx)
        return ret;
 con_error:
        con->state=S_CONN_BAD;
+       LM_WARN("%s:%d %s releasing\n", __FILE__, __LINE__, 
__PRETTY_FUNCTION__);
        release_tcpconn(con, CONN_ERROR, tcpmain_sock);
        return ret;
 error:


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to