<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 05/26/2012 05:39 PM, Aft nix wrote:
    <blockquote
cite="mid:CAGuaRCtNSCT=2LyN3SXQcjAyEu--qLLOQEmXN8-jo1QQTQLnmA@mail.gmail.com"
      type="cite">
      <pre wrap="">Hi,

I'm trying to create a ruri from contact header like following :

In request route I've saved contact header in a hashtable using htable module.
request_route{

---------------------
---------------------
#!ifdef WITH_HASH
         if (is_method("INVITE") &amp;&amp; !has_totag()){
                 xdbg ("Contact [$ct] with Callid [$ci]");
                 $sht(a=&gt;$ci) = $ct;
         }
 #!endif

----------------
}

And in route[WITHINDLG]

route[WITHINDLG] {

---------------------------
---------------------------
 #!ifdef WITH_HASH
                                 xdbg ("ruri [$ru]");
                                 if ($sht(a=&gt;$ci) != $ru){
                                         $ru = ($sht(a=&gt;$ci));
                                         xdbg ("rewriting ruri to [$ru]");
                                 }
 #!endif

But it log shows that its unable to parse the uri :

[4039]: DEBUG: &lt;core&gt; [parser/parse_uri.c:1277]: parse_uri: bad uri,
state 0 parsed: &lt;&lt;sip&gt; (4) / &lt;<a class="moz-txt-link-rfc2396E" href="mailto:sip:2020@103.23.169.2:64358">&lt;sip:2020@103.23.169.2:64358&gt;</a>&gt; (29)
: DEBUG: &lt;core&gt; [parser/parse_uri.c:1327]: ERROR: parse_sip_msg_uri:
bad uri &lt;<a class="moz-txt-link-rfc2396E" href="mailto:sip:2020@103.23.169.2:64358">&lt;sip:2020@103.23.169.2:64358&gt;</a>&gt;
[4039]: ERROR: pv [pv_core.c:232]: failed to parse the R-URI
[4039]: DEBUG: &lt;script&gt;: rewriting ruri to [&lt;null&gt;]


I'm not understanding what's wrong with that. May be the port part
should be discarded, but how i'm gonna do that?
</pre>
    </blockquote>
    <br>
    It looks like $sht(a=&gt;$ci) is empty. I see that you have "xdbg
    ("Contact [$ct] with Callid [$ci]");
    " line, but you didn't show us that line at the debug.<br>
    If you add $ci to the debug information at the route[WITHINDLG] and
    show full debug from INVITE to BYE it will help to find where the
    mistake is. <br>
    <br>
    And i think it would be better if you change <u>if ($sht(a=&gt;$ci)
      != $ru)</u> to <u>if ( $sht(a=&gt;$ci) != $null &amp;&amp;
      $sht(a=&gt;$ci) != $ru)</u> , because when $sht() is empty it
    always not equal to $ru.<br>
    <br>
  </body>
</html>