Hello,
the avps are available only for the duration of a transaction. They
don't persist between register and invite. But you should authenticate
invites as well, not only registrations, and then the avp will be loaded
and set for invites.
Cheers,
Daniel
On 19/10/16 10:36, Ivan Dudko wrote:
Hello?
Is avp value live only for one request dialog?
Or i am doing this wrong?
Or it lives until user is unregistered?
вт, 18 окт. 2016 г. в 16:10, Ivan Dudko <ivan.dudko(a)gmail.com
<mailto:ivan.dudko@gmail.com>>:
And I check. While kamailio process REGISTER request $avp(i:123)
value equals table column call_limit.
But after that while it process INVITE request $avp(i:123) is <null>
вт, 18 окт. 2016 г. в 11:59, Ivan Dudko <ivan.dudko(a)gmail.com
<mailto:ivan.dudko@gmail.com>>:
Thank you, Daniel
I am trying to do this.
modparam("auth_db", "load_credentials",
"$avp(i:123)=call_limit")
After auth:
This from mysql log:
2016-10-18T07:14:02.598195Z 4451 Query select
`password`,`call_limit` from `subscriber` where `username`='2000'
2016-10-18T07:14:02.599166Z 4451 Query select
`username` from `subscriber` where `username`='' AND
`domain`='172.21.0.150'
But when i want to see value of this avp in route[DIALOG]:
xlog("L_INFO", "Control Active Calls $avp(i:123)");
I call from 2000 to another peer аnd recieve null:
Oct 18 11:14:38 kamailio /usr/sbin/kamailio[11470]: INFO:
<script>: Control Active Calls <null>
пн, 17 окт. 2016 г. в 13:44, Daniel-Constantin Mierla
<miconda(a)gmail.com <mailto:miconda@gmail.com>>:
Hello,
you can use sqlops module to load data from database and
store in an xavp.
If you want to load from subscriber table along with auth
credentials, look at load_credentials parameter from
auth_db module.
Cheers,
Daniel
On 14/10/16 12:05, Ivan Dudko wrote:
Hello!
I am trying to implement limit of active calls for
subscribers. And for each subscriber this limit must be
personal.
I find example route in presentation of Daniel-Constantin
Mierla.
And i need to set $xavp(caller=>active_calls) = 1;
for each dialog. But i can't understand how to load this
number of active calls from some-thing similar of user
profile or subscriber table?
route[DIALOG] {
if (is_method("CANCEL") || (has_totag() &&
is_method("INVITE|BYE|ACK"))) {
dlg_manage();
return;
}
if (is_method("INVITE") && !has_totag() &&
!isflagset(WITH_ACTIVE_CALLS_LIMIT)) {
if( $xavp(caller[0]=>active_calls) != $null &&
$xavp(caller[0]=>active_calls) > 0 ) {
if(!get_profile_size("caller", "$fU@$fd",
"$var(acsize)")) {
send_reply("500", "No more active
calls");
exit;
}
if($var(acsize)>=$xavp(caller[0]=>active_calls)) {
send_reply("403", "No more active
calls");
exit;
}
set_dlg_profile("caller", "$fU@$fd");
}
setflag(WITH_ACTIVE_CALLS_LIMIT);
dlg_manage();
}
}
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users(a)lists.sip-router.org
<mailto:sr-users@lists.sip-router.org>
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda
<http://twitter.com/#%21/miconda> -
http://www.linkedin.com/in/miconda
Kamailio Advanced Training, Berlin, Oct 24-26, 2016 -
http://www.asipto.com
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users
mailing list
sr-users(a)lists.sip-router.org
<mailto:sr-users@lists.sip-router.org>
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users