[OpenSIPS-Users] Basic dynamic routing question

James Wiegand originaljimdandy at gmail.com
Tue Jun 23 17:56:37 CEST 2009


Ah, yes, now I see where I went wrong. In switching to OpenSIPS, I
left off a prefix.

Thanks so much for your help!!!

-jim

On Tue, Jun 23, 2009 at 3:42 AM, Bogdan-Andrei
Iancu<bogdan at voice-system.ro> wrote:
> Hi James,
>
> I would say the script ids working, but you do not print the right stuff.
> After do_routing() the first GW is already set as ruri in the request;
> $avp(s:dr_ruri) is storing the next GWs to be used (if any). Try:
>
>
> ..
> modparam("drouting", "attrs_avp", '$avp(s:dr_attrs)')
> modparam("drouting", "ruri_avp", '$avp(s:dr_ruri)')
> ...
> route {
> ...
>       # set failure route for forward
>       t_on_failure("1");
>       # detect resources and do balancing
>       xlog("-----Doing routing\n");
>
>       if (!do_routing("1")) {
>           sl_send_reply("503", "No destination available");
>           exit;
>       }
>       xlog("----- gw attr is $avp(s:dr_attrs)\n");
>       xlog("----- ruri is $ru\n");
>
>       if (!t_relay()) {
>         xlog("----- relay failed\n");
>         sl_reply_error();
>     }
> }
>
>
>
>
> Regards,
> Bogdan
>
>
> James Wiegand wrote:
>>
>> Still no luck ... I can see the routing match, but the relay always fails.
>>
>> -----Doing routing
>> Jun 22 11:55:35 [12508] DBG:drouting:do_routing: using dr group 1
>> Jun 22 11:55:35 [12508] DBG:drouting:internal_check_rt: found rgid 1 (rule
>> list
>>  0xb60cadc8)
>> Jun 22 11:55:35 [12508] DBG:drouting:do_routing: setting attr [] as for
>> ruri
>> Jun 22 11:55:35 [12508] DBG:drouting:do_routing: setting the gw [0] as
>> ruri "si
>> p:87zzzzzzz at xx.xx.xx.59 <mailto:p%3A8706569978 at 66.234.135.59>"
>> ----- gw attr is
>> ----- ruri is <null>
>> Jun 22 11:55:35 [12508] DBG:core:pv_get_dsturi: no destination URI
>> -----to uri is <null>
>> Jun 22 11:55:35 [12508] DBG:tm:t_newtran: transaction on entrance=(nil)
>> Jun 22 11:55:35 [12508] DBG:core:parse_headers: flags=ffffffffffffffff
>> Jun 22 11:55:35 [12508] DBG:core:get_hdr_field: content_length=388
>> Jun 22 11:55:35 [12508] DBG:core:get_hdr_field: found end of header
>>
>>
>> My config:
>>
>> ...
>> modparam("drouting", "attrs_avp", '$avp(s:dr_attrs)')
>> modparam("drouting", "ruri_avp", '$avp(s:dr_ruri)')
>> ...
>> route {
>> ...
>>        # set failure route for forward
>>        t_on_failure("1");
>>        # detect resources and do balancing
>>        xlog("-----Doing routing\n");
>>
>>      if (!do_routing("1")) {
>>        sl_send_reply("503", "No destination available");
>>        exit;
>>       }
>>      xlog("----- gw attr is $avp(s:dr_attrs)\n");
>>      xlog("----- ruri is $avp(s:dr_ruri)\n");
>>
>>      xlog("-----to uri is $du\n");
>>
>>      if (!t_relay())
>>      {
>>          xlog("----- relay failed\n");
>>          sl_reply_error();
>>      }
>> }
>>
>> What am I missing here?
>>
>> -jim
>>
>> On Fri, Jun 19, 2009 at 6:05 PM, Bogdan-Andrei Iancu
>> <bogdan at voice-system.ro <mailto:bogdan at voice-system.ro>> wrote:
>>
>>    Hi James,
>>
>>    The logic is a bit different that the one for lcr - the
>>    do_routing() functions already pushes the initial destination, so
>>    no need to do the "use_next_gw" after it:
>>
>>    route {
>>
>>    ...
>>          if (!do_routing("1")) {
>>
>>            sl_send_reply("503", "No destination available");
>>            exit;
>>           }
>>          xlog("-----gw attr is $avp(s:dr_attrs)\n");
>>
>>
>>          if (!t_relay())
>>          {
>>              sl_reply_error();
>>          }
>>
>>    }
>>
>>
>>    Regards,
>>    Bogdan
>>
>>
>>
>>    James Wiegand wrote:
>>
>>        Hi all,
>>
>>        I am trying to get dynamic routing working and can't seem to
>>        get any
>>        traction on the problem
>>
>>        when I do a do_routing() call in the request loop nothing seems to
>>        happen.  I am at a loss troubleshooting this problem.  How can you
>>        tell what possible matches there are?
>>
>>        Routing setup I have includes the following items - OpenSIPS 1.5.1
>>
>>        table dr_rules:
>>
>>        ruleid  groupid         prefix  timerec         priority
>>     routeid         gwlist  description
>>        1               1               870     20040101T000000
>>    0       0       1       Default route
>>
>>        table dr_gateways:
>>
>>        gwid    type    address                  strip  pri_prefix
>>     attrs   description
>>        1       10      XXX.XXX.XXX.XXX  0      NULL    NULL    Provider
>>
>>        route {
>>
>>        ...
>>               do_routing("1");
>>               xlog("-----gw attr is $avp(s:dr_attrs)\n");
>>
>>               if(use_next_gw())
>>               {
>>                 if (!t_relay())
>>                 {
>>                   sl_reply_error();
>>                 }
>>                 exit;
>>
>>
>>               } else {
>>                 sl_send_reply("503", "No destination available");
>>                 exit;
>>               }
>>
>>        }
>>
>>        >From the log:
>>
>>        Jun 19 17:10:55 [9270] DBG:drouting:do_routing: using dr group 1
>>        Jun 19 17:10:55 [9270] DBG:drouting:internal_check_rt: found
>>        rgid 1
>>        (rule list 0xb60d4dc8)
>>        Jun 19 17:10:55 [9270] DBG:drouting:do_routing: setting attr
>>        [] as for ruri
>>        Jun 19 17:10:55 [9270] DBG:drouting:do_routing: setting the gw
>>        [0] as
>>        ruri "sip:8706569978 at XXX.XXX.XXX.XXX"
>>        -----gw attr is <null>
>>
>>
>>        Thanks,
>>
>>        -jim
>>
>>
>>
>>
>>
>> --
>> --
>> Jim Wiegand
>> -----------
>> Home:  originaljimdandy at gmail.com <mailto:originaljimdandy at gmail.com>
>> AIM:     originaljimdandy
>
>



-- 
-- 
Jim Wiegand
-----------
Home:  originaljimdandy at gmail.com
AIM:     originaljimdandy



More information about the Users mailing list