[SR-Users] Creating RURI ($ru) from Contact ($ct)

Aft nix aftnix at gmail.com
Sun May 27 00:46:51 CEST 2012


On Sun, May 27, 2012 at 3:57 AM, Vitaliy Aleksandrov
<vitalik.voip at gmail.com> wrote:
> On 05/26/2012 05:39 PM, Aft nix wrote:
>
> 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") && !has_totag()){
>                  xdbg ("Contact [$ct] with Callid [$ci]");
>                  $sht(a=>$ci) = $ct;
>          }
>  #!endif
>
> ----------------
> }
>
> And in route[WITHINDLG]
>
> route[WITHINDLG] {
>
> ---------------------------
> ---------------------------
>  #!ifdef WITH_HASH
>                                  xdbg ("ruri [$ru]");
>                                  if ($sht(a=>$ci) != $ru){
>                                          $ru = ($sht(a=>$ci));
>                                          xdbg ("rewriting ruri to [$ru]");
>                                  }
>  #!endif
>
> But it log shows that its unable to parse the uri :
>
> [4039]: DEBUG: <core> [parser/parse_uri.c:1277]: parse_uri: bad uri,
> state 0 parsed: <<sip> (4) / <<sip:2020 at 103.23.169.2:64358>> (29)
> : DEBUG: <core> [parser/parse_uri.c:1327]: ERROR: parse_sip_msg_uri:
> bad uri <<sip:2020 at 103.23.169.2:64358>>
> [4039]: ERROR: pv [pv_core.c:232]: failed to parse the R-URI
> [4039]: DEBUG: <script>: rewriting ruri to [<null>]
>
>
> I'm not understanding what's wrong with that. May be the port part
> should be discarded, but how i'm gonna do that?
>
>
> It looks like $sht(a=>$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.
> 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.
>

Hi Aleksandrov
Thanks for the reply.

Yes my checks should be more specific.

On the side how , i'm facing difficulties to print script variables
and hashtable entries.

xdbg("my var [$var(temp)]")
xdbg("my hash entries [$sht(a=>$ci)"])

Both statements shows parse errors. What's the correct syntax to print script
variables and hash table entries?

"xlog" module documentation does not seems to address this.

Cheers.
> And i think it would be better if you change if ($sht(a=>$ci) != $ru) to if
> ( $sht(a=>$ci) != $null && $sht(a=>$ci) != $ru) , because when $sht() is
> empty it always not equal to $ru.
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>



-- 
-aft



More information about the sr-users mailing list