[OpenSIPS-Users] How to limit number of AOR for user

Răzvan Crainea razvan at opensips.org
Mon Nov 17 13:27:13 CET 2014


Hi, Anton!

Have you tried using the save() function with a single parameter 
("location") and the max_contacts parameter, and you still have two 
contacts for your AOR?

Best regards,

Răzvan Crainea
OpenSIPS Solutions
www.opensips-solutions.com

On 11/15/2014 10:35 PM, Anton wrote:
> Please tell me that is part of the AOR?
> Why, in my case in the list of permitted two AOR instead of one?
> Does "max_contacts" come if registration requests with the same 
> username and password, but different in other parameters (From, To 
> Contact...)?
>
> 14.11.2014 23:18, Anton пишет:
>> In any case, here there is a parameter modparam ("registrar", 
>> "max_contacts", 1)
>> so as not not be 2 AOR....
>> I think that the second AOR here - it's UACbehind NAT...
>> How to disable registration in this case?
>>
>> 14.11.2014 18:30, Răzvan Crainea пишет:
>>> I think there is a bug and I opened an issue on github related to 
>>> that[1]. If you could confirm it works when explicitely specifying 
>>> the AVP that would be great.
>>>
>>> [1] https://github.com/OpenSIPS/opensips/issues/385
>>>
>>> Best regards,
>>> Răzvan Crainea
>>> OpenSIPS Solutions
>>> www.opensips-solutions.com
>>> On 11/14/2014 03:14 PM, Anton wrote:
>>>> Why so? Quote from: 
>>>> http://www.opensips.org/html/docs/modules/1.11.x/auth_db.html#id293578
>>>>
>>>> *Example 1.8. |load_credentials| parameter usage*
>>>>
>>>> # load rpid column into $avp(13) and email_address column
>>>> # into $avp(email_address)
>>>> modparam("auth_db", "load_credentials", "$avp(13)=rpid;email_address")
>>>>
>>>>
>>>> But  as I have:
>>>> modparam("auth_db", "load_credentials", "$avp(loadedip)=domain;$avp(subscriber_username)=username;maxaor")
>>>> .....
>>>>
>>>> Nelly  is not  correct?
>>>>
>>>> 14.11.2014 15:20, Răzvan Crainea пишет:
>>>>> Can you print $avp(maxaor) just before the save() function? I am 
>>>>> pretty sure it is not populated. And the reason is that you are 
>>>>> not specifying an AVP to store it. The load_credentials parameter 
>>>>> should be
>>>>> "$avp(loadedip)=domain;$avp(subscriber_username)=username;$avp(maxaor)=maxaor"
>>>>> Răzvan Crainea
>>>>> OpenSIPS Solutions
>>>>> www.opensips-solutions.com
>>>>> On 11/14/2014 09:41 AM, Лытаев Антон Викторович wrote:
>>>>>> Hi!
>>>>>>
>>>>>> There is a need to limit the maximum number of AOR for the user.
>>>>>> To do so:
>>>>>>
>>>>>> modparam("registrar", "max_contacts", 1)
>>>>>> modparam("auth_db", "load_credentials", 
>>>>>> "$avp(loadedip)=domain;$avp(subscriber_username)=username;maxaor")
>>>>>>
>>>>>> [user at opensips]# opensipsctl db show subscriber
>>>>>> id      username        domain  password email_address   ha1     
>>>>>> ha1b    rpid    maxaor  quota
>>>>>> 1    202020  77.66.55.44  123456 f665ec129cd4556aeed95f3b204ff002 
>>>>>> 888f4df11367b3f2859c4993a4ad7dd3        NULL 1 1
>>>>>>
>>>>>> Where: maxaor - maximum number of AOR (max limit).
>>>>>>
>>>>>> Next in the config:
>>>>>>
>>>>>> if (is_method("REGISTER"))
>>>>>>     {
>>>>>>         if(client_nat_test("8"))
>>>>>>         {
>>>>>>             sl_send_reply("403", "Not working NAT");
>>>>>>             www_challenge("", "0");
>>>>>>             exit;
>>>>>>         }
>>>>>>         # authenticate the REGISTER requests (uncomment to enable 
>>>>>> auth)
>>>>>>         if (!www_authorize("", "subscriber"))
>>>>>>         {
>>>>>>             www_challenge("", "0");
>>>>>>             exit;
>>>>>>         }
>>>>>>         if ($si!=$avp(loadedip))
>>>>>>         {
>>>>>>             www_challenge("", "0");
>>>>>>             exit;
>>>>>>         }
>>>>>> save("location","c($avp(maxaor))");
>>>>>>         if (!db_check_to())
>>>>>>         {
>>>>>>             sl_send_reply("403","Forbidden auth ID");
>>>>>>             exit;
>>>>>>         }
>>>>>>
>>>>>>         if (!save("location"))
>>>>>>             sl_reply_error();
>>>>>>         exit;
>>>>>>     }
>>>>>>
>>>>>> But in the presence of 2 AOR record:
>>>>>>
>>>>>> [user at opensips]# opensipsctl ul show 202020
>>>>>> Contact:: 
>>>>>> <sip:202020 at 77.66.55.44;uniq=6041F87C7634A40A246E833DDA15E>;q=;expires=1471;flags=0x0;cflags=0x0;socket=<udp:85.85.85.85:5060>;callid=<A8502C3B45165582 at 192.168.178.1>;methods=0x3F7F;user_agent=<AVM 
>>>>>> FRITZ!Box Fon WLAN 7140 Annex A 39.04.77 (Feb 14 2014)>
>>>>>> Contact:: 
>>>>>> <sip:202020 at 77.66.55.44:5075>;q=;expires=450;flags=0x0;cflags=0x0;socket=<udp:85.85.85.85:5060>;callid=<5E7D-E2CA-46940374551E59A3ADE4-649 at SipHost>;methods=0xFFFFFFFF;user_agent=<204 
>>>>>> 12-37-1612531>
>>>>>>
>>>>>> Why? What did I do wrong?
>>>>>>
>>>>>> Added a check here:
>>>>>>     if ($ct.fields(uri)=~'uniq')
>>>>>>     {
>>>>>>         sl_send_reply("403", "Wrong contact params");
>>>>>>         www_challenge("", "0");
>>>>>>         exit;
>>>>>>     }
>>>>>> But it seems to me that this is not quite right.....
>>>>>> Please help!
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> 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
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>>
>>
>>
>> _______________________________________________
>> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20141117/25ca155f/attachment.htm>


More information about the Users mailing list