#505 DROUTING - postgresql, routid param in dr_rules

modules (454)

I use drouting with postgresql in 1.8 (and 1.7 too).
In documentation written that I should not define this column if I don't like to run route after rule matched.
Here Bogdan wrote that I should leave this column null:

If I do update dr_rules set routeid='', then in log I see messages like:
Apr 9 13:22:39 opensips opensips[5645]: ERROR:drouting:build_rt_info: failed to parse the destinations
Apr 9 13:22:39 opensips opensips[5645]: ERROR:drouting:dr_load_routing_info: failed to add routing info for rule id 11 -> skipping

If I allow nulls in table (alter table dr_rules alter column routeid drop not null) and do update dr_rules set routeid=null, then I see messages like:
Apr 9 13:23:50 opensips opensips[5844]: ERROR:drouting:parse_destination_list: bad char #000 (-15723487) [8,9;11,12]
Apr 9 13:23:50 opensips opensips[5844]: ERROR:drouting:add_carrier: failed to parse the destinations
Apr 9 13:23:50 opensips opensips[5844]: ERROR:drouting:dr_load_routing_info: failed to add carrier db_id 4 -> skipping
And then opensips exits (without generating core).

If I do update dr_rules set routeid='0', then I see:
Apr 9 13:24:47 opensips opensips[6020]: WARNING:drouting:dr_load_routing_info: route <0> does not exist
I think it's not correct, but in this variant drouting works.
Also I don't understand why it cannot find route 0 if it defined in my script (If it would find it it will be great bug when it will run route[0] after rule matched???)

I think it's not correct and drouting module should accept null value in db.


  • Vladut-Stefan Paiu


    In OpenSIPS 1.8 you cannot use ';' anymore to create gw groups inside the gwlist field of the dr_rules table, so having a ';' in the gw list is considered as a 'bad char' ( see the errors ).

    What you can do is define different carriers ( in the dr_carriers ) table, and then have multiple carriers for a prefix rule, like '#1,#2'.

    In regards to the routeid field, simply setting it to '' should work. I have just tested this with 1.8 and no errors are printed. Can you please paste the full set of errors that you receive when you set routeid to '' ?

    Also, you cannot have routeid as 0. If you try to have route[0] in your script you will get an error like :
    overwritting(2) default request routing table
    and you most likely would not want to re-run the main route when a rule is matched, that's why the main route is excluded from the routes search.


  • Nick Altmann

    Nick Altmann - 2012-04-09

    Sorry about ';', db has just migrated from 1.7.
    When I set routeid='0' I see
    WARNING:drouting:dr_load_routing_info: route <0> does not exist, but not
    overwritting(2) default request routing table. Is it okay?
    I understand about useless of setting routeid to 0, but I asked why it writes that route 0 doesn't exists?

    Now I set routeid to '' and it works okay. Thank you.

  • Bogdan-Andrei Iancu

    Thanks for update on the original report - route 0 it was deprecated since we added names for routes; and we have integers IDs (like the 0) and names (like configured in DR)....long story :).

    On the other hand, I agree, that accepting NULL for the column will be nice - I will take care of this.


  • Bogdan-Andrei Iancu

    • assigned_to: nobody --> bogdan_iancu
  • Vladut-Stefan Paiu


    Migration docs have been updated.


  • Bogdan-Andrei Iancu

    • status: open --> closed-fixed
  • Bogdan-Andrei Iancu

    OK, NULL is the default value now for the routeid. Also '' is accepted.



Log in to post a comment.