[OpenSIPS-Users] How to limit number of AOR for user
Răzvan Crainea
razvan at opensips.org
Fri Nov 14 13:20:28 CET 2014
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20141114/1528eb66/attachment.htm>
More information about the Users
mailing list