Hello, I have to take care of an old server running kamailio 1.4 (I plan to upgrade to latest, but I cannot do it at the moment).
It uses carrierroute and it works fine.
Now I am testing adding a new carrier and it worked.
However, sometimes I get a failure to resolve a route (using cr_route):
Oct  9 21:29:04 centos53-02121 /usr/local/src/svn/kamailio-1.4/kamailio[3160]: ERROR:carrierroute:cr_do_route: desired routing domain doesn't exist, prefix 99900000112233445566778899, carrier 10, domain 0

I can see the cause of the problem is because an element called "id" is solved differently sometimes when "cr_reload_routes" is issued.
I am using always this same table:


mysql> select * from carrierroute where carrier=10;
+------+---------+--------+-------------+-------+------+------+-------+--------------------+----------------+----------------+-------------+
| id   | carrier | domain | scan_prefix | flags | mask | prob | strip | rewrite_host       | rewrite_prefix | rewrite_suffix | description |
+------+---------+--------+-------------+-------+------+------+-------+--------------------+----------------+----------------+-------------+
| 4271 |      10 | 0      | 999000      |     0 |    0 |    1 |     6 | 192.168.2.123:5060 |                |                | NULL        |
| 4272 |      10 | 1      | 999000      |     0 |    0 |    1 |     6 | 192.168.2.123:5060 |                |                | NULL        |
+------+---------+--------+-------------+-------+------+------+-------+--------------------+----------------+----------------+-------------+
2 rows in set (0.00 sec)


When cr_route works fine, the reload logged this:
Oct  9 21:31:21 centos53-02121 /usr/local/src/svn/kamailio-1.4/kamailio[7902]: DBG:carrierroute:get_route_tree_by_id: tree carrier_10, domain 0 : 0
Oct  9 21:31:21 centos53-02121 /usr/local/src/svn/kamailio-1.4/kamailio[7902]: DBG:carrierroute:get_route_tree_by_id: tree carrier_10, domain 1 : 1

But when it fails, it logged this:
Oct  9 21:29:04 centos53-02121 /usr/local/src/svn/kamailio-1.4/kamailio[3160]: DBG:carrierroute:get_route_tree_by_id: tree carrier_10, domain 0 : 1
Oct  9 21:29:04 centos53-02121 /usr/local/src/svn/kamailio-1.4/kamailio[3160]: DBG:carrierroute:get_route_tree_by_id: tree carrier_10, domain 1 : 2

So I understand that the problem is a mismatch between a value that is produced by kamailio when I ask for a domain (named '0' and '1') and value of id that probably was computed based on domain at the time the route_tree was created.
So, I was thinking, maybe domain names '0' and '1' would not be good for this and I should use some longer names. Well i should not expect a domain named '0' to always result in an id=0. But I would expect that whatever id is resolved, it should happen equally for both values being matched that came from the same base element (supposedly, the domain name).
I will test using longer names anyway, but since this problem doesn't happen everytime I do cr_reload_routes, I was hoping to get an opinion about it.

Regards,
Takeshi