[OpenSIPS-Users] New method in alias_db

Noel R. Morais noelrocha at gmail.com
Wed Mar 25 21:48:12 CET 2009


It is really useful for me.

I've done a workaround using subst_uri, alias_db_lookup, revert_uri.
It will make things easier.

Thanks Sergio,

Noel

2009/3/25 Sergio Gutierrez <saguti at gmail.com>:
> Hi Vladimir.
>
> It looks useful; please submit a patch on tracker, so that developers can
> review it.
>
> Thanks and regards.
>
> Sergio
>
> 2009/3/25 Romanov Vladimir <VRomanov at yota.ru>
>>
>> Hi!
>>
>> I implement new  method in alias_db module –
>> alias_db_find(“tablename”,”avp”). This method  similar to alias_db_lookup
>> but use avp as instead of message RURI.
>>
>> I use this this new method in in this case:
>>
>>
>>
>> if (uri==myself) {
>>
>>         if (is_method("REGISTER")) {
>>
>>             sl_send_reply("100", "Trying");
>>
>>             $avp(s:alias):=$tu;
>>
>>             if (alias_db_find("dbaliases","$avp(s:alias)")) {
>>
>>                 xlog("L_INFO", "Registration was aliased - $tu ->
>> $avp(s:alias)\n");
>>
>>             }
>>
>>
>>
>>             if (!www_authorize("_SIP_DOMAIN", "subscriber")) {
>>
>>                   www_challenge("_SIP_DOMAIN", "0");
>>
>>                   return;
>>
>>             };
>>
>>             if (!check_to()) {
>>
>>                  xlog("L_INFO", "Spoofed To-URI detected - M=$rm RURI=$ru
>> F=$fu T=$tu IP=$si ID=$ci\n");
>>
>>                  sl_send_reply("403", "Spoofed To-URI Detected");
>>
>>                  exit;
>>
>>             };
>>
>>             if (!save("location","0","$avp(s:alias)"))  {
>>
>>                 xlog("L_ERR", "Saving contact failed - M=$rm RURI=$ru
>> F=$fu T=$tu IP=$si ID=$ci\n");
>>
>>                 sl_reply_error();
>>
>>             }
>>
>>             exit;
>>
>>         };
>>
>>
>>
>> This method implementationin main part  is copypaste from alias_db_lookup.
>> Is this interesting to OpenSips users?
>>
>> -----------------
>>
>> Vladimir Romanov
>>
>> Scartel Star Lab
>>
>> CTO
>>
>> +7 (960) 239-0853
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>
>
>
> --
> Sergio Gutiérrez
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>


More information about the Users mailing list