[OpenSIPS-Users] Dynamic Routing never routes call

Jon Abrams ffshoh at gmail.com
Fri Jan 25 10:31:40 EST 2019


You have the t_relay() in the do_routing() failure code section. Move it
afterwards:


        $avp(gw_whitelist) = "testpbx1";
        if (
!do_routing("1","L","$avp(gw_whitelist)","$avp(rules_attributes)","$avp(gw_attributes)"))
{

          send_reply("404","DID not found");
          xlog("do_routing: No rules matching the URI\n");
          exit;
         }

         t_relay();

- Jon

On Fri, Jan 25, 2019 at 9:27 AM Mark Farmer <farmorg at gmail.com> wrote:

> Thanks Jim.
>
> I now have:
>
>         $avp(gw_whitelist) = "testpbx1";
>         if (
> !do_routing("1","L","$avp(gw_whitelist)","$avp(rules_attributes)","$avp(gw_attributes)"))
> {
>           t_relay();
>           send_reply("404","DID not found");
>           xlog("do_routing: No rules matching the URI\n");
>           exit;
>
> Sadly no change.
>
> I'll head over to the docs again now.
>
>
>
> On Fri, 25 Jan 2019 at 15:08, Jim DeVito <jim at devito.cc> wrote:
>
>> Are you missing the actual relay part? I'm pretty sure do_routing just
>> loads routing info from the database but you sill need to call the actual
>> relay. Put a t_relay() after the IF statement and see what happens. Also
>> look at the docs regarding capturing and displaying the return code from
>> do_routing.
>>
>>
>>
>> On Fri, Jan 25, 2019 at 9:52 AM Mark Farmer <farmorg at gmail.com> wrote:
>>
>>> Hello all
>>>
>>> Very new OpenSIPS user trying to build my first real server.
>>>
>>> Using debug logging I can see that my alias/dialplan operations seem to
>>> be working but when it reaches the do_routing the call never actually gets
>>> routed.
>>>
>>> I've been trying to get this working for nearly 2 weeks now and I'm at a
>>> loss now. Please can someone help me?
>>>
>>> From my script:
>>>
>>>         $avp(gw_whitelist) = "testpbx1";
>>>         if (
>>> !do_routing("1","L","$avp(gw_whitelist)","$avp(rules_attributes)","$avp(gw_attributes)"))
>>> {
>>>           send_reply("404","DID not found");
>>>           xlog("do_routing: No rules matching the URI\n");
>>>           exit;
>>>
>>> Oddly, I never get the no rules log entry but it drops out of here &
>>> into the else if below which forces proxy auth.
>>>
>>> My DB:
>>>
>>> dr gateways
>>>
>>> +----+--------------+------+---------------------+-------+------------+--------------+------------+-------+--------+-------------+
>>> | id | gwid         | type | address             | strip | pri_prefix |
>>> attrs        | probe_mode | state | socket | description |
>>>
>>> +----+--------------+------+---------------------+-------+------------+--------------+------------+-------+--------+-------------+
>>> |  2 | BT_SDIN_BCTE |    1 | sip:xxx.xxx.xxx.xxx   |     0 |
>>>  | BT_SDIN_BCTE |          2 |     0 |        | Inbound     |
>>> |  3 | BT_SDIN_GDH  |    1 | sip:xxx.xxx.xxx.xxx   |     0 |
>>>  | BT_SDIN_GDH  |          2 |     0 |        | Inbound     |
>>> |  1 | BT_SDIN_LFH  |    1 | sip:xxx.xxx.xxx.xxx |     0 |            |
>>> BT_SDIN_LFH  |          2 |     0 |        | Inbound     |
>>> |  4 | BT_SDIN_SEH  |    1 | sip:xxx.xxx.xxx.xxx  |     0 |            |
>>> BT_SDIN_SEH  |          2 |     0 |        | Inbound     |
>>> |  5 | testpbx1     |    1 | sip:10.98.0.11      |     2 | 0          |
>>> testpbx1     |          2 |     0 |        | Inbound     |
>>>
>>> +----+--------------+------+---------------------+-------+------------+--------------+------------+-------+--------+-------------+
>>> dr groups
>>>
>>> +----+--------------+----------------------------+---------+-------------+
>>> | id | username     | domain                     | groupid | description
>>> |
>>>
>>> +----+--------------+----------------------------+---------+-------------+
>>> |  7 | 441423369031 | 10.98.0.11                 |       1 |
>>> |
>>> |  6 | 441423369031 | my.domain |       2 |             |
>>>
>>> +----+--------------+----------------------------+---------+-------------+
>>> dr carriers
>>>
>>> +----+-----------+--------------------------------------------------+-------+-------+-------+-------------+
>>> | id | carrierid | gwlist                                           |
>>> flags | state | attrs | description |
>>>
>>> +----+-----------+--------------------------------------------------+-------+-------+-------+-------------+
>>> |  1 | BT        | BT_SDIN_BCTE,BT_SDIN_GDH,BT_SDIN_LFH,BT_SDIN_SEH |
>>>   0 |     0 |       | BT SDIN     |
>>>
>>> +----+-----------+--------------------------------------------------+-------+-------+-------+-------------+
>>> dr rules
>>>
>>> +--------+---------+--------------+---------+----------+---------+----------+-------------------+------------------+
>>> | ruleid | groupid | prefix       | timerec | priority | routeid |
>>> gwlist   | attrs             | description      |
>>>
>>> +--------+---------+--------------+---------+----------+---------+----------+-------------------+------------------+
>>> |     13 | 1       | 441423369031 |         |        0 |         |
>>> testpbx1 | rule_441423369031 | Send to testpbx1 |
>>>
>>> +--------+---------+--------------+---------+----------+---------+----------+-------------------+------------------+
>>>
>>>
>>>
>>> --
>>> Mark Farmer
>>> farmorg at gmail.com
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opensips.org
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>
>>
>>
>> --
>> -------------
>> Jim DeVito
>> Mobile 216.507.9497
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>
>
> --
> Mark Farmer
> farmorg at gmail.com
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20190125/01699b7a/attachment-0001.html>


More information about the Users mailing list