[OpenSIPS-Users] Credential protection.

Thiago Rondon thiago at aware.com.br
Mon Nov 30 22:06:24 CET 2009


One problem that I see in the perl module of OpenSIPS 1.6.0 is that I 
can't get the return value of a function.

For example, I need this:

if (!perl_exec('foobar')) {
    # ...
}

If I "return 1" it's ok, but if I "return 0" the route is not process.

Thanks!
-Thiago Rondon

Thiago Rondon escreveu:
> I try to use a perl script:
>
> use OpenSIPS;
> use OpenSIPS::Constants;
>
> use DateTime;
> use IPC::Shareable;
>
> my %userslogged;
> my %tokill;
>
> sub onlyone {
>     my $m = shift;
>     my ($user, $domain) = split('@', $m->pseudoVar("\$Au"));
>   
>     tie %userslogged, IPC::Shareable, {
>         key => 'lsus',
>         create => 1,
>         destroy => 1
>     } or die "Error with IPC::Shareble";
>
>     tie %tokill, IPC::Shareable, {
>         key => 'lstk',
>         create => '1',
>         detroy => 1
>     } or die "Error with IPC::Shareble";
>
>     my ($currentid) = split(/;/, $m->getHeader("Via"));
>
>     if ($m->getMethod() eq "REGISTER") {
>         %tokill->{$user} = $currentid
>             if length(%userslogged->{$user})
>             && %userslogged->{$user} != $currentid;
>        
>         %userslogged->{$user} = $currentid;
>     }
>
>     foreach my $nuser (keys %tokill) {
>         next if $nuser ne $user;
>         next if %userslogged->{$users} ne $currentid;
>         # Kill $user via "Via:" fields.
>     }
> }
>
> But, how the best option to kill a user instance via opensips ?
>
> Thanks in advanced!
> -Thiago Rondon
>
>
>
> Thiago Rondon escreveu:
>   
>> Hi,
>>
>> I try to do this in my registrar with opensips:
>>
>> 1 - db_check_auth()
>>
>>    Check credential for the user.
>>
>> 2 - check_if_user_is_logged()
>>
>>    Check if there are same credential logged with the same username.
>>
>> 3 - kill_user_currently_logged()
>>
>>    Kill the username (send a terminted session message) currently logged.
>>
>> 4 - Login OK.
>>
>>    Do the login.
>>
>> So, I doesn't allow simultaneos login, but when the same user logged in, 
>> I need to logout the previews logged session of user.
>>
>> Suggestions ?
>>
>> Thanks in advanced!
>> -Thiago Rondon
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>>   
>>     
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>   




More information about the Users mailing list