[Kamailio-Users] help using rewrite prefix

Henning Westerholt henning.westerholt at 1und1.de
Fri Apr 17 14:32:58 CEST 2009


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?

> 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.

Cheers,

Henning



More information about the Users mailing list