[Kamailio-Users] Carrierroute issue

Uriel Rozenbaum uriel.rozenbaum at gmail.com
Thu Jul 30 20:16:14 CEST 2009


It's really weird. Try changing the domain on the X.X.X.X host to 1, so you
only have Y.Y.Y.Y host available as first option.

On Thu, Jul 30, 2009 at 3:07 PM, michel freiha <michofr at gmail.com> wrote:

> Dear Sir,
>
> I did 2 calls from the same endpoint to the same number and get 2 different
> IDs but still forwarding the calls to X.X.X.X as follow:
>
> Call1:
>
> call-id for this call 56549e09d94c1430Jul 30 17:00:32 [10607]
> DBG:carrierroute:get_route_tree_by_id: searching in carrier default, id 5
> Jul 30 17:00:32 [10607] DBG:carrierroute:get_route_tree_by_id: tree
> default, domain 0 : 0
> Jul 30 17:00:32 [10607] DBG:carrierroute:rewrite_on_rule: searching for
> matching routing rulesJul 30 17:00:32 [10607] DBG:core:hash_func: hash:
> 1307293616 % -2147483648 = 1307293616
> Jul 30 17:00:32 [10607] INFO:carrierroute:cr_do_route: uri 009613089187 was
> rewritten to sip:001232333333 at X.X.X.X
>
> Call2:
> call-id for this call 063197524438d55dJul 30 17:02:18 [10605]
> DBG:carrierroute:get_route_tree_by_id: searching in carrier default, id 5
> Jul 30 17:02:18 [10605] DBG:carrierroute:get_route_tree_by_id: tree
> default, domain 0 : 0
> Jul 30 17:02:18 [10605] DBG:carrierroute:rewrite_on_rule: searching for
> matching routing rulesJul 30 17:02:18 [10605] DBG:core:hash_func: hash:
> 931879127 % -2147483648 = 931879127
> Jul 30 17:02:18 [10605] INFO:carrierroute:cr_do_route: uri 009613089187 was
> rewritten to sip:001232333333 at X.X.X.X
>
> Any suggestions?
>
> Regards
>
>
>
>
>
> On Thu, Jul 30, 2009 at 5:17 PM, Uriel Rozenbaum <
> uriel.rozenbaum at gmail.com> wrote:
>
>> The random value is based on the Call-ID, use debug=4 and add an XLOG as
>> follows before every call to cr_route:
>>
>> xlog("L_ERR", "call-id for this call $ci");
>>
>> Check the call-id is different every time and the CRC32 algorithm to
>> calculate the hash values gives a different answer.
>>
>>
>> On Thu, Jul 30, 2009 at 9:49 AM, michel freiha <michofr at gmail.com> wrote:
>>
>>> When restarting kamailio I found out that it reads both routes
>>>
>>> Jul 30 11:46:40 [9165] INFO:carrierroute:rule_fixup_recursor: hashless
>>> rule with host Y.Y.Y.Y hash hash_index 1
>>> Jul 30 11:46:40 [9165] INFO:carrierroute:rule_fixup_recursor: hashless
>>> rule with host X.X.X.X hash hash_index 2
>>>
>>> I jjst do not know why it's not reading the prob
>>>
>>>
>>>
>>> On Thu, Jul 30, 2009 at 3:39 PM, michel freiha <michofr at gmail.com>wrote:
>>>
>>>> Dear Sir,
>>>>
>>>> Please find below carrierroute table...
>>>>
>>>> +----+---------+--------+-------------+-------+------+------+-------+--------------+----------------+----------------+-------------+
>>>> | id | carrier | domain | scan_prefix | flags | mask | prob | strip |
>>>> rewrite_host | rewrite_prefix | rewrite_suffix | description |
>>>>
>>>> +----+---------+--------+-------------+-------+------+------+-------+--------------+----------------+----------------+-------------+
>>>> |  1 |       5 | 0      | 00          |     0 |    0 |  0.1 |     0 |
>>>> X.X.X.X |                |                | NULL        |
>>>> |  2 |       5 | 0      | 00          |     0 |    0 |  0.9 |     0 |
>>>> Y.Y.Y.Y |                |                | NULL        |
>>>>
>>>> +----+---------+--------+-------------+-------+------+------+-------+--------------+----------------+----------------+-------------+
>>>>
>>>>
>>>> on kamailio.conf:
>>>>
>>>> if(!cr_route("default", "0", "$rU", "$rU", "call_id")){
>>>>
>>>>        sl_send_reply("403", "Not allowed");
>>>>      } else {
>>>>          # In cas of failure, re-route the request
>>>>           t_on_failure("1");
>>>>           # Relay the request to the gateway
>>>>            t_relay();
>>>>    }
>>>>
>>>>
>>>> When trying to call 00123456666  the call is forwarded all the time to
>>>> X.X.X.X IP and never to Y.Y.Y.Y IP...why this happening? It's like Kamailio
>>>> is not reading prob field
>>>>
>>>> Regards
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Thu, Jul 30, 2009 at 3:13 PM, Uriel Rozenbaum <
>>>> uriel.rozenbaum at gmail.com> wrote:
>>>>
>>>>> I'm really not sure how it works when you use a 0 prob.
>>>>>
>>>>> Try something like 50/50 and check if the requests go to both servers.
>>>>>
>>>>> Also, some extract from /var/log/messages will help.
>>>>>
>>>>>
>>>>> On Thu, Jul 30, 2009 at 4:38 AM, michel freiha <michofr at gmail.com>wrote:
>>>>>
>>>>>> Dear Sir,
>>>>>>
>>>>>> My tables are defined as below:
>>>>>>
>>>>>> *carrierroute table:*
>>>>>>
>>>>>> id      carrier     domain     scan_prefix     flags     mask
>>>>>> prob    strip    rewrite_host
>>>>>> 19       5               1                 00             0
>>>>>> 0          0         0      IP_address1
>>>>>> 19       5               1                 00             0
>>>>>> 0           1         0     IP_Address1
>>>>>>
>>>>>> *route_tree table:*
>>>>>>
>>>>>> id     carrier
>>>>>> 5        default
>>>>>>
>>>>>> *In kamalio.cfg:*
>>>>>>
>>>>>> if(!cr_route("default", "1", "$rU", "$rU", "call_id")){
>>>>>>
>>>>>>
>>>>>> The issue is that kamailio is forwarding all calls to IP_Address1 and
>>>>>> never to IP_Address2 even if prob is 1 for IP_Address2 and 0 for IP_Address1
>>>>>>
>>>>>>
>>>>>> Any help please?
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Wed, Jul 29, 2009 at 6:45 PM, Uriel Rozenbaum <
>>>>>> uriel.rozenbaum at gmail.com> wrote:
>>>>>>
>>>>>>> Michel,
>>>>>>>
>>>>>>> The prob field is to set the proportion of a certain entry to be
>>>>>>> taken when you are load balancing between carriers.
>>>>>>>
>>>>>>> To perform an overflow operation you have to use the domain field.
>>>>>>>
>>>>>>> Check the samples on the module documentation; it's preety clear
>>>>>>> there; if you have further questions just post them here.
>>>>>>>
>>>>>>> Rgds,
>>>>>>> Uriel
>>>>>>>
>>>>>>> On Wed, Jul 29, 2009 at 10:39 AM, michel freiha <michofr at gmail.com>wrote:
>>>>>>>
>>>>>>>> Hi all,
>>>>>>>>
>>>>>>>> I'm using carrierroute module and ie seems that it's not working
>>>>>>>> well...Suppose I have 2 entries in carrierroute table...Entry 1 with scan
>>>>>>>> prefix 00 and prob 0 and a second entry with scan prefix 00 and prob=1...As
>>>>>>>> soon as i make a call, this call will be forwarded to the entry with prob 0
>>>>>>>> because i guess it appears before the one with prob 1 in the table...
>>>>>>>>
>>>>>>>> When starting Kamailio I got the below:
>>>>>>>>
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route: adding prefix
>>>>>>>> 1, prob -14931260.000000
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:get_route_tree: domain 0
>>>>>>>> not found, add it
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route_tree: tree
>>>>>>>> default has 1 trees
>>>>>>>> Jul 29 12:30:11 [23143] DBG:carrierroute:add_route_tree: tree 0Jul
>>>>>>>> 29 12:30:11 [23143] INFO:carrierroute:get_route_tree: created route tree: 0,
>>>>>>>> with id 0
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route: found route,
>>>>>>>> now adding
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route_rule: no backed
>>>>>>>> up rules
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route: adding prefix ,
>>>>>>>> prob -14931260.000000
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:get_route_tree: found
>>>>>>>> domain 0
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route: found route,
>>>>>>>> now adding
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route_rule: no backed
>>>>>>>> up rules
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route: adding prefix
>>>>>>>> 011, prob -14931260.000000
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:get_route_tree: found
>>>>>>>> domain 0
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route: found route,
>>>>>>>> now adding
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route_rule: no backed
>>>>>>>> up rules
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route: adding prefix
>>>>>>>> 00, prob -14931260.000000
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:get_route_tree: found
>>>>>>>> domain 0
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route: found route,
>>>>>>>> now adding
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route_rule: no backed
>>>>>>>> up rules
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route: adding prefix
>>>>>>>> 111, prob -14931260.000000
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:get_route_tree: found
>>>>>>>> domain 0
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route: found route,
>>>>>>>> now adding
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route_rule: no backed
>>>>>>>> up rules
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route: adding prefix
>>>>>>>> 00, prob -14931260.000000
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:get_route_tree: found
>>>>>>>> domain 0
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route: found route,
>>>>>>>> now adding
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route_rule: no backed
>>>>>>>> up rules
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route: adding prefix ,
>>>>>>>> prob -14931260.000000
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:get_route_tree: found
>>>>>>>> domain 0
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route: found route,
>>>>>>>> now adding
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route_rule: no backed
>>>>>>>> up rules
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route: adding prefix
>>>>>>>> 011, prob -14931260.000000
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:get_route_tree: found
>>>>>>>> domain 0
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route: found route,
>>>>>>>> now adding
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route_rule: no backed
>>>>>>>> up rules
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route: adding prefix
>>>>>>>> 011, prob -14931260.000000
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:get_route_tree: found
>>>>>>>> domain 0
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route: found route,
>>>>>>>> now adding
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route_rule: no backed
>>>>>>>> up rules
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route: adding prefix ,
>>>>>>>> prob -14931260.000000
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:get_route_tree: found
>>>>>>>> domain 0
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route: found route,
>>>>>>>> now adding
>>>>>>>> Jul 29 12:30:11 [23143] INFO:carrierroute:add_route_rule: no backed
>>>>>>>> up rules
>>>>>>>>
>>>>>>>> It seems that kamailio is not reading probability entry in carrier
>>>>>>>> route table
>>>>>>>>
>>>>>>>> Please find below carrierroute table structure:
>>>>>>>>
>>>>>>>> CREATE TABLE IF NOT EXISTS `carrierroute` (
>>>>>>>>   `id` int(10) unsigned NOT NULL auto_increment,
>>>>>>>>   `carrier` int(10) unsigned NOT NULL default '0',
>>>>>>>>   `domain` varchar(64) NOT NULL default '',
>>>>>>>>   `scan_prefix` varchar(64) NOT NULL default '',
>>>>>>>>   `flags` int(11) unsigned NOT NULL default '0',
>>>>>>>>   `mask` int(11) unsigned NOT NULL default '0',
>>>>>>>>   `prob` float NOT NULL default '0',
>>>>>>>>   `strip` int(11) unsigned NOT NULL default '0',
>>>>>>>>   `rewrite_host` varchar(128) NOT NULL default '',
>>>>>>>>   `rewrite_prefix` varchar(64) NOT NULL default '',
>>>>>>>>   `rewrite_suffix` varchar(64) NOT NULL default '',
>>>>>>>>   `description` varchar(255) default NULL,
>>>>>>>>   PRIMARY KEY  (`id`)
>>>>>>>> ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=23 ;
>>>>>>>>
>>>>>>>>
>>>>>>>> Can someone help me to find this issue?
>>>>>>>>
>>>>>>>> Regards
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Kamailio (OpenSER) - Users mailing list
>>>>>>>> Users at lists.kamailio.org
>>>>>>>> http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
>>>>>>>> http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/users/attachments/20090730/2353bb9e/attachment.htm>


More information about the Users mailing list