<p></p>
<h3>Description</h3>
<p>SIP OPTION relayed using <code>t_forward_nonack()</code> not being URI decoded</p>

<h3>Troubleshooting</h3>
<h4>Reproduction</h4>
<p>register with PATH and use SIP OPTION keep alive<br>
or simply send relay a SIP OPTIONS with a route.</p>
<h4>Debugging Data</h4>

<pre lang="#1" data-meta=" 0x00007fa3067a998f in t_forward_nonack (t=0x7fa3246fce88,"><code>    p_msg=0x7fa3885aa1c0, proxy=0x0, proto=0) at t_fwd.c:1729
1729                            raise(SIGSEGV);
(gdb) l
1724                            ser_error=MIN_int(lowest_ret, E_CFG);
1725                            return -1;
1726                    }
1727                    if(lowest_ret!=E_CFG) {
1728                            LM_ERR("failure to add branches\n");
1729                            raise(SIGSEGV);  << raising exception to get the coredump
1730                    }
1731                    ser_error=lowest_ret;
1732                    return lowest_ret;
1733            }

</code></pre>
<h4>Log Messages</h4>
<pre><code>4(34) ERROR: tm [ut.h:245]: uri2dst2(): bad_uri: sip:247.25.169.51:52307%3Btransport%3Dtls
4(34) ERROR: tm [t_fwd.c:1728]: t_forward_nonack(): failure to add branches
</code></pre>
<h3>Possible Solutions</h3>
<p>This patch can fix the problem from the routing script :</p>
<pre><code>if (is_method("OPTIONS") && uri!=myself) {
        $var(path_uri) = $(hdr(Route){re.subst,/<(.*)>/\1/});                                                                                                                                                       
        if (defined $(var(path_uri){uri.params}) && $(var(path_uri){uri.params}{param.value,received})         != "") {
                $var(received) = $(var(path_uri){uri.params}{param.value,received});
                if ($var(received) =~ "sip:.*:.*") {
                        $du = $var(received);           
                $avp(received) = $(var(path_uri){uri.params}{param.value,received});
                avp_subst("$avp(received)", "/%3Btransport%3Dtcp/;transport=tcp/ig");
                if ($avp(received) =~ "sip:.*:.*") {
                        $du = $avp(received);           
                }
        }
        t_relay();
}
</code></pre>
<h3>Additional Information</h3>
<p>tested on 5.3.2, something changed during 5.3.0.dev, I will try to pin point the commit</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/2255">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZN72GAWMXNFMCNZTQDRIEEARANCNFSM4LOXJCFA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZNZPL5EOJJA5SAYHBTRIEEARA5CNFSM4LOXJCFKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IWNXZ5Q.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/2255",
"url": "https://github.com/kamailio/kamailio/issues/2255",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>