[SR-Users] Cant make from_uri, request_uri work for LCR module

Antanas Masevicius antanas.masevicius at ntt.lt
Tue Jul 24 14:55:37 CEST 2012


Hello once again,

It looks like core issue was not a termination of regexp. Was not
getting segfaults, but did not get a match either.
After changing rule_id from 2617960 to 0, rule got loaded properly:

sercmd> lcr.dump_rules
{
        lcr_id: 90
        rule_id: 0
        prefix: 118
        from_uri: sip:00000000 at xx.xx.lt
        request_uri: 118
        stopper: 1
}
{
        gw_index: 1
        priority: 0
        weight: 100
}
3

I suspect that lcr code somehow a bit differently stores such rules
internally and primary id fragmentation results in rules set loaded with
improper rule_id:

sercmd> lcr.dump_rules
{
        lcr_id: 90
        rule_id: 0
        prefix: 118
        from_uri: sip:00000000 at xx.xx.lt
        request_uri: 118
        stopper: 1
}
 
Here, in dump above it should contain rule_id=2617960, but contains 0.
Also for such rule gw fails to be identified.

Antanas
NTT

On 2012.07.24 12:20, Antanas Masevicius wrote:
> Hello,
>
> Looks like i finally got it. REGEXP patterns in from_uri and
> request_uri must be terminated between //.
> Maybe someone could add a notice about this in LCR documentation?
> Only got it after reading some documentation on pcre lib.
>
> best regards,
>
> Antanas
> NTT
>
> On 2012.07.24 11:17, Antanas Masevicius wrote:
>> Hello,
>>
>> thanks for the tip Alex, but still getting the same error:
>>
>> lcr [hash.c:166]: could not find (disabled) rule with id <2617960>
>>
>> if it helps, here is my ldd output for lcr.so:
>>
>>         linux-vdso.so.1 =>  (0x00007ffffe7ff000)
>>         libpcre.so.3 => /lib/libpcre.so.3 (0x00007faf0cfd1000)
>>         libsrdb1.so.1 => /usr/local2/lib64/kamailio/libsrdb1.so.1
>> (0x00007faf0cdbf000)
>>         libkcore.so.1 => /usr/local2/lib64/kamailio/libkcore.so.1
>> (0x00007faf0cbb3000)
>>         libc.so.6 => /lib/libc.so.6 (0x00007faf0c852000)
>>         /lib64/ld-linux-x86-64.so.2 (0x00007faf0d42e000)
>>
>> Here is extended debug excerpt:
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: <core>
>> [db_val.c:117]: converting STRING [118]
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: lcr
>> [lcr_mod.c:1236]: loading, cycle 0 with <1> rows
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: <core>
>> [db_res.c:62]: freeing rows at 0x7f0dc4afe4d8
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: <core>
>> [db_res.c:85]: freeing RES_NAMES[5] at 0x7f0dc4afaa50
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: <core>
>> [db_res.c:118]: allocate 48 bytes for result set at 0x7f0dc4afdee8
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: db_mysql
>> [km_res.c:85]: allocate 16 bytes for RES_NAMES[0] at 0x7f0dc4afaa50
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: db_mysql
>> [km_res.c:92]: RES_NAMES(0x7f0dc4afe420)[1]=[ip_addr]
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: db_mysql
>> [km_res.c:85]: allocate 16 bytes for RES_NAMES[4] at 0x7f0dc4afdf78
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: db_mysql
>> [km_res.c:92]: RES_NAMES(0x7f0dc4afe440)[5]=[params]
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: db_mysql
>> [km_res.c:136]: use DB1_STRING result type
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: db_mysql
>> [km_res.c:136]: use DB1_STRING result type
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: db_mysql
>> [km_res.c:100]: use DB1_INT result type
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: db_mysql
>> [km_res.c:85]: allocate 16 bytes for RES_NAMES[12] at 0x7f0dc4afe3d8
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: <core>
>> [db_val.c:73]: converting INT [0]
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: <core>
>> [db_val.c:56]: converting NULL value
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: <core>
>> [db_val.c:56]: converting NULL value
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: <core>
>> [db_res.c:85]: freeing RES_NAMES[1] at 0x7f0dc4afe420
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: <core>
>> [db_res.c:85]: freeing RES_NAMES[4] at 0x7f0dc4afdf78
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: <core>
>> [db_res.c:85]: freeing RES_NAMES[12] at 0x7f0dc4afe3d8
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: <core>
>> [db_res.c:62]: freeing rows at 0x7f0dc4afe488
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: <core>
>> [db_res.c:155]: allocate 104 bytes for result names at 0x7f0dc4afe598
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: db_mysql
>> [km_res.c:85]: allocate 16 bytes for RES_NAMES[2] at 0x7f0dc4afe558
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: db_mysql
>> [km_res.c:92]: RES_NAMES(0x7f0dc4afe518)[4]=[transport]
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: db_mysql
>> [km_res.c:136]: use DB1_STRING result type
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: db_mysql
>> [km_res.c:85]: allocate 16 bytes for RES_NAMES[7] at 0x7f0dc4afe440
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: db_mysql
>> [km_res.c:136]: use DB1_STRING result type
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: db_mysql
>> [km_res.c:85]: allocate 16 bytes for RES_NAMES[11] at 0x7f0dc4afe420
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: db_mysql
>> [km_res.c:92]: RES_NAMES(0x7f0dc4afaa50)[12]=[id]
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: <core>
>> [db_res.c:85]: freeing RES_NAMES[3] at 0x7f0dc4afe538
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: <core>
>> [db_res.c:85]: freeing RES_NAMES[8] at 0x7f0dc4afdf78
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: <core>
>> [db_res.c:94]: freeing result names at 0x7f0dc4afe598
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: db_mysql
>> [km_res.c:100]: use DB1_INT result type
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: db_mysql
>> [km_res.c:92]: RES_NAMES(0x7f0dc4afe400)[1]=[gw_id]
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: db_mysql
>> [km_res.c:100]: use DB1_INT result type
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: <core>
>> [db_val.c:73]: converting INT [0]
>> Jul 24 11:12:54 xx /usr/local2/sbin/kamailio[26004] DEBUG: lcr
>> [hash.c:166]: could not find (disabled) rule with id <2617960>
>>
>> Antanas
>> NTT
>>
>> On 2012.07.24 10:53, Alex Balashov wrote:
>>> When calling load_gws(), try putting $rU and $fu in double quotes,
>>> e.g. "$rU" rather than $rU bare. 
>>>
>>>
>>>
>>>
>>> -- Alex
>>>
>>> --
>>> Sent from my Samsung mobile, and thus lacking in the refinement one
>>> might expect from a proper keyboard.
>>>
>>> Alex Balashov - Principal
>>> Evariste Systems LLC
>>> 235 E Ponce de Leon Ave
>>> Suite 106
>>> Decatur, GA 30030
>>> Tel: +1-678-954-0670
>>> Web: http://www.evaristesys.com/
>>>
>>> Antanas Masevicius <antanas.masevicius at ntt.lt> wrote:
>>> Hello,
>>>
>>> having trouble running LCR in kamailio 3.3 (head).
>>>
>>> Here is my DB excerpt which i use to reproduce the problem:
>>> INSERT INTO `lcr_rule` VALUES (2617960,90,'118','.*',1,1,'.*');
>>> INSERT INTO `lcr_rule_target` VALUES (7771454,90,2617960,1424,0,100);
>>> INSERT INTO `lcr_gw` VALUES
>>> (1424,90,'OP1','10.10.10.10','',5060,NULL,1,0,NULL,'11#',1,NULL,NULL);
>>>
>>> I stripped all other LCR data from my DB and only this rule with
>>> from_uri and request_uri  seems to bother me.
>>>
>>> Tried this version on debian lenny and debian squeeze. On Lenny i am not
>>> able to load lcr tables at all, get a segfault.
>>> On squeeze, lcr tables loads up, but this rule gets marked as disabled.
>>> Here is config part which i use to load a rule:
>>>         if (load_gws(90, $rU, $fu)) {
>>>             if (next_gw()) {
>>>                 t_on_failure("FAIL_GW");
>>>             } else {
>>>                 route(NO_ROUTE);
>>>             }
>>>
>>> On squeeze, if i add following code to lcr_mod.c:1249 :
>>>   LM_INFO("LOADING lcr rule <%u> \n", rule_id);
>>> right after:
>>>   rule_id = (unsigned int)VAL_INT(ROW_VALUES(row));
>>>
>>> rule_id is still printed, but i get segfault like this:
>>>
>>> Jul 24 10:17:43 sp1 kernel: [23482626.105865] kamailio[15136]: segfault
>>> at a4 ip 00007fde15cb8802 sp 00007fff39d68320 error 4 in
>>> lcr.so[7fde15ca8000+23000]
>>>
>>> Not sure what i do terribly wrong. Setting from_uri and request_uri to
>>> anythig but NULL makes the code to segfault with that print line added.
>>> Without print line, kamailio starts, but never loads that rule.
>>>
>>> Any help would be appreciated.
>>>
>>> best regards,
>>>
>>> Antanas Masevicius
>>> NTT
>>>
>>>
>>> _______________________________________________
>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>>> sr-users at lists.sip-router.org
>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>
>>>
>>> _______________________________________________
>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>>> sr-users at lists.sip-router.org
>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>
>> -- 
>> Antanas Masevic(ius
>> Technikos direktorius
>> UAB "Nacionalinis telekomunikaciju tinklas"
>> Tel.  +370 5 2056000
>> Tel.  +370 700 00031 (tiesioginis)
>> Fax.  +370 700 00034
>> el.p: antanas.masevicius at ntt.lt
>> www.ntt.lt
>> www.spykas.com
>
> -- 
> Antanas Masevic(ius
> Technikos direktorius
> UAB "Nacionalinis telekomunikaciju tinklas"
> Tel.  +370 5 2056000
> Tel.  +370 700 00031 (tiesioginis)
> Fax.  +370 700 00034
> el.p: antanas.masevicius at ntt.lt
> www.ntt.lt
> www.spykas.com
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Antanas Masevic(ius
Technikos direktorius
UAB "Nacionalinis telekomunikaciju tinklas"
Tel.  +370 5 2056000
Tel.  +370 700 00031 (tiesioginis)
Fax.  +370 700 00034
el.p: antanas.masevicius at ntt.lt
www.ntt.lt
www.spykas.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20120724/13e41a51/attachment.htm>


More information about the sr-users mailing list