[SR-Users] Group module

Igor Olhovskiy igorolhovskiy at gmail.com
Wed Nov 6 18:05:20 CET 2019


Hi!

I'm trying to solve quite simple task and want to solve it as simple as possible.
Idea is to have restriction to allow register certain username/domain only from certain subnets.

So, I decided to use group and permissions modules.
But stuck on group one.
Code is fairly simple

modparam("group", "db_url", DBURL)
modparam("group", "use_domain", 1)
...
if (get_user_group("From", "$avp(user_groups)")) {
xlog("$fu from $si:$sp is matched group $avp(user_groups)\n");
if (allow_source_address("$avp(user_groups)")) {
...allow furter
}
} else {
xlog("$fu from $si:$sp is not matched any groups\n");
}

grp table is looks like
kamctl db exec 'select * from grp'
+----+-------------+-------------------+-----+---------------------+
| id | username | domain | grp | last_modified |
+----+-------------+-------------------+-----+---------------------+
| 1 | 61388140395 | sip.localhost.net | 5 | 2000-01-01 00:00:01 |
+----+-------------+-------------------+-----+---------------------+

But actual line of debug in logs saying this
kamailio_1 | 10(18) exec: {1 1 REGISTER 4oQTNaaVlEWQC2VMK6YAKg..} *** cfgtrace:request_route=[PERMISSIONS] c=[/etc/kamailio/kamailio.cfg] l=720 a=26 n=get_user_group
kamailio_1 | 10(18) DEBUG: {1 1 REGISTER 4oQTNaaVlEWQC2VMK6YAKg..} group [re_group.c:188]: get_user_group(): getting groups for <sip:61388140395 at sip.localhost.net>
kamailio_1 | 10(18) exec: {1 1 REGISTER 4oQTNaaVlEWQC2VMK6YAKg..} *** cfgtrace:request_route=[PERMISSIONS] c=[/etc/kamailio/kamailio.cfg] l=727 a=25 n=xlog
kamailio_1 | 10(18) ERROR: {1 1 REGISTER 4oQTNaaVlEWQC2VMK6YAKg..} <script>: sip:61388140395 at sip.localhost.net;transport=UDP from 172.21.0.1:56787 is not matched any groups

What am I missing here? Or module is too old?
Thanks!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20191106/a3387f37/attachment.html>


More information about the sr-users mailing list