[OpenSIPS-Users] issue with trusted addresses listed with grp=0

Bogdan-Andrei Iancu bogdan at voice-system.ro
Fri Jul 9 19:56:27 CEST 2010


Hi Andrew,

Indeed there is design bug -  a script function returning 0 will break 
the script execution ; so if the group found by get_source_group() is 
zero, when returning the val, the script execution will end....

I change the way you use the function - instead of using the return code 
for group, you provide a pvar to store the result:

$var(group) = get_source_group();

         =>

get_source_group("$var(group)");


This fix is available on trunk (see revision 7009) - please test it and 
if ok, I will backport it to 1.6 also.

Regards,
Bogdan


Andrew Pogrebennyk wrote:
> Hello,
> I am using the address table to keep the trusted IPs like this:
>
> # check trusted IPs
> $var(group) = get_source_group();
> if ($var(group) == 32) { # use grp=32 as trusted indication
>      xlog("L_INFO", "Call from trusted peer - M=$rm RURI=$ru F=$fu T=$tu 
> IP=$si ID=$ci\n");
>      # do something stupid
> } else {
>      if(!proxy_authorize("", "subscriber")) {
>          proxy_challenge("", "0");
>          exit;
>      }
>      # process the call
> }
>
> Something strange happens when the INVITE source IP comes from the 
> address listed with grp=0 - the call seems to get stuck and never gets 
> to digest challenge:
>
>   
>> Jul  8 16:20:49 dev01 /usr/local/sbin/opensips[24667]: DBG:permissions:get_source_group: Looking for <df59f95c, 55518> in address table
>> Jul  8 16:20:49 dev01 /usr/local/sbin/opensips[24667]: DBG:permissions:get_source_group: Found <0>
>> Jul  8 16:20:49 dev01 /usr/local/sbin/opensips[24667]: DBG:dialog:next_state_dlg: unref dlg 0xb4c2c944 with 1 -> 2
>> Jul  8 16:20:49 dev01 /usr/local/sbin/opensips[24667]: DBG:dialog:next_state_dlg: dialog 0xb4c2c944 changed from state 1 to state 5, due event 1
>> Jul  8 16:20:49 dev01 /usr/local/sbin/opensips[24667]: DBG:dialog:dlg_onreply: dialog 0xb4c2c944 failed (negative reply)
>> Jul  8 16:20:49 dev01 /usr/local/sbin/opensips[24667]: DBG:dialog:unref_dlg: unref dlg 0xb4c2c944 with 1 -> 1
>> Jul  8 16:20:49 dev01 /usr/local/sbin/opensips[24667]: DBG:dialog:unref_dlg: unref dlg 0xb4c2c944 with 1 -> 0
>> Jul  8 16:20:49 dev01 /usr/local/sbin/opensips[24667]: DBG:dialog:unref_dlg: ref <=0 for dialog 0xb4c2c944
>> Jul  8 16:20:49 dev01 /usr/local/sbin/opensips[24667]: DBG:dialog:destroy_dlg: destroing dialog 0xb4c2c944
>> Jul  8 16:20:49 dev01 /usr/local/sbin/opensips[24667]: DBG:dialog:destroy_dlg: dlg expired or not in list - dlg 0xb4c2c944 [2039:572707183] with clid 'ZmNmMjkxZjlhZmU4MzU4ZThhOWJlNTZmYzY2YjM4NTQ.' and tags 'f9383040' 'NULL'
>> Jul  8 16:20:49 dev01 /usr/local/sbin/opensips[24667]: DBG:core:destroy_avp_list: destroying list 0xb4c28240
>> Jul  8 16:20:49 dev01 /usr/local/sbin/opensips[24667]: DBG:core:receive_msg: cleaning up
>> Jul  8 16:20:50 dev01 /usr/local/sbin/opensips[24675]: DBG:tm:timer_routine: timer routine:2,tl=0xb4c2dda0 next=(nil), timeout=70
>> Jul  8 16:20:50 dev01 /usr/local/sbin/opensips[24675]: DBG:tm:wait_handler: removing 0xb4c2dd58 from table
>> Jul  8 16:20:50 dev01 /usr/local/sbin/opensips[24675]: DBG:tm:delete_cell: delete transaction 0xb4c2dd58
>> Jul  8 16:20:50 dev01 /usr/local/sbin/opensips[24675]: DBG:tm:wait_handler: done
>>     
>
> It looks as if something was wrong with script variables operation 
> because with any grp!=0 there is a comparison operation after the 
> "Found" line:
>
>   
>> Jul  8 16:22:31 dev01 /usr/local/sbin/opensips[25047]: DBG:permissions:get_source_group: Found <1>
>> Jul  8 16:22:31 dev01 /usr/local/sbin/opensips[25047]: DBG:core:comp_scriptvar: int 20 : 1 / 32
>>     
>
> However I can give up an idea that I am doing something stupid, else 
> with 0 being default value much more people would have noticed this 
> problem before. Any ideas?
>
>   


-- 
Bogdan-Andrei Iancu
OpenSIPS Bootcamp
20 - 24 September 2010, Frankfurt, Germany
www.voice-system.ro




More information about the Users mailing list