[Kamailio-Users] help using rewrite prefix

Carlos A. Alvarez carlos.alvarez at commxinc.com
Fri Apr 17 16:55:22 CEST 2009



-----Original Message-----
From: Henning Westerholt [mailto:henning.westerholt at 1und1.de] 
Sent: Friday, April 17, 2009 8:33 AM
To: Carlos A. Alvarez
Cc: users at lists.kamailio.org
Subject: Re: [Kamailio-Users] help using rewrite prefix

On Thursday 16 April 2009, Carlos A. Alvarez wrote:
> Yes sir that is correct. I have a b2bua and the requests are forwarded to
> it, this causes kamailio to loose track of the state of the call.
>
> Invite!
> <uac>---->><b2bua>------->><kamailio>----->><carrier-GW>
>
> Replies messages are sent like this
>
> <carrier-GW>------->><b2bua>----->><uac>

Hi Carlos,

perhaps you forgot to enable record-routing, so kamailio is removed from the 
path?

No I do use record-route, like I said, it only failes after a re-write.

> Only happens when I strip a number or rewrite the prefix.   All other cr
> calls are processed fine. Now if I add the prefix to the table this works
> fine...  For example, I dial prefix 54011 to select carrier A, carrier A
> wants to see only CC NXXX XXXX from me, so I strip 5 digits to send the
> number, than I see this condition.  If I add the CC prefix to the table,
> then CR module does a second look up and correctly routes the call.

Ok, but normally it should work just fine with only one lookup.

> Dial 54011 53 2339 2339 sent to carrier A 53 2339 2339...  you can imagine
> how my tables are going to look if I have to add to routes per carrier...
> at least for those carriers that are not assigning me a prefix. Routing
> login is below.
>
>
> route [11]{
>         xlog("L_INFO", "INFO: entering carrierroute routine\n");
>         cr_user_carrier("$fd", "$fd", "$avp(s:carrier)");
>         $avp(s:domain)=$fd;
>                 setflag(16);

Ok.

>         if (!cr_route("$avp(s:carrier)", "$avp(s:domain)", "$rU", "$rU",
> "call_id", "$avp(s:host)")) {
>                         sl_send_reply("480", "Temporarily Unavailable");
>                         setflag(2);
>                         exit;
>                 }
>          if (cr_route("$avp(s:carrier)", "$avp(s:domain)", "$rU", "$rU",
> "call_id", "$avp(s:host)")) {
>                  xlog("L_INFO","Carrier found!! (\"$avp(s:carrier)\",
> \"$avp(s:domain)\", \"$rU\", \"$rU\", \"$avp(s:host)\");\n");
> force_rtp_proxy("o");

Why do you use the routing function two times? I can't imagine a good reason 
for this. If you want to log the success, just do this after the first 
cr_route. And also move all your logic in the second if case after the first 
one. If the lookup in the first cr_route fails then your routing tables are 
not correct.

I am only following the few examples that I can find.  The message is missing something, the second route is the failure route.  But in your reply it seems to be truncated. I wish there was a few implementation examples that we could follow, I really like the carrierroute vs lcr. 


Cheers,

Henning

No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.287 / Virus Database: 270.11.58/2062 - Release Date: 04/16/09 16:38:00


More information about the sr-users mailing list