Kamailio Group

From open-voip.org

Jump to: navigation, search

This module provides functionalities for different methods of group membership checking.

  • Documentation
http://www.kamailio.org/docs/modules/1.5.x/group.html

code example, note that is_user_in function:

# 6 digit dialing for local calls
if (uri=~"^sip:[2-9][0-9]{6}@") { 
if (is_user_in("credentials","local")) { 
prefix("816"); 
route(4); 
exit; 
} else { 
sl_send_reply("403", "No permissions for local calls"); 
exit; 
}; 
};  
# 9 didgit dialing for long distance
if (uri=~"^sip:1[2-9][1-9]{9}@") { 
if (is_user_in("credentials","ld")) { 
prefix("+"); 
route(4); 
exit; 
} else { 
sl_send_reply("403", "No permissions for long distance"); 
exit; 
}; 
};  
# international call starts with 011
if (uri=~"^sip:011[0-9]*@") { 
if (is_user_in("credentials","int")) { 
prefix("+"); 
route(4); 
exit; 
} else { 
sl_send_reply("403", "No permissions for international calls"); 
}; 
};

Managing users and groups with Kamctl

acl show [<username>] .............. show user membership
acl grant <username> <group> ....... grant user membership (*)
acl revoke <username> [<group>] .... grant user membership(s) (*)

example of adding users to "local" and "int" groups

kamctl acl grant 1000 int
kamctl acl grant 2000 local
kamctl acl show
+----+----------+------------+-------+---------------------+
| id | username | domain     | grp   | last_modified       |
+----+----------+------------+-------+---------------------+
|  3 | 1000     | domain.com | int   | 2010-05-22 08:28:47 | 
|  4 | 2000     | domain.com | local | 2010-05-22 08:29:17 | 
+----+----------+------------+-------+---------------------+

records will be enterd to the grp table in teh MySQL: File:kamailio_groups.JPG

Personal tools