Kamailio Permissions

From open-voip.org

Jump to: navigation, search
  • The permissions module is used to permit IPs (for example PSTN Gateways) that does not goes through the authentication process
  • use the allow_trusted() function in order to verify that source Ip address of requests and the protocol (UDP, TCP or ANY) are allowed.

a regular expressions also can be used.

at the modules section add

loadmodule "permissions.so"

and in the module parameters section add

# permissions param
modparam("permissions","db_url", "mysql://openser:asterisk@localhost/openser")
modparam("permissions", "db_mode", 1)
modparam("permissions", "trusted_table", "trusted")

look at the followind INVITE proccessing code:

if (from_uri==myself) {                             # if sent to my kamailio
 if (!allow_trusted()) {                            # check in DB that source IP is not trusted
   if (!proxy_authorize("", "subscriber")) {        #If not authenticated yet
     proxy_challenge("", "0");                      # challenge the user and exit 
 consume_credentials();                              # remove the authentication details
                                                     # caller authenticated - you can proceed
Personal tools