Copyright © 2004-2008 Juha Heinanen
Revision History | |
---|---|
Revision $Revision: 4863 $ | $Date: 2008-09-05 13:11:33 +0200 (Fri, 05 Sep 2008) $ |
Table of Contents
radius_config
(string)caller_service_type
(integer)callee_service_type
(integer)group_service_type
(integer)uri_service_type
(integer)caller_extra
(string)callee_extra
(string)group_extra
(string)uri_extra
(string)use_sip_uri_host
(integer)List of Examples
radius_config
parameter usagecaller_service_type
parameter usagecallee_service_type
parameter usagegroup_service_type
parameter usageuri_service_type
parameter usagecaller_extra
parameter usagecallee_extra
parameter usagegroup_extra
parameter usageuri_extra
parameter usageuse_sip_uri_host
parameter usageradius_load_caller_avps()
usageradius_load_callee_avps()
usageradius_is_user_in()
usageradius_does_uri_exist()
usageradius_does_uri_user_exist()
usageModule misc_radius implements various RADIUS related functions. Currently functions exist for loading caller's or callee's attributes into AVPs, checking if user belongs to a group, and checking if URI belongs to a user. It thus replaces old avp_radius, group_radius, and uri_radius modules.
All functions of this module load AVPs from SIP-AVP reply items received from RADIUS upon a successful request. Value of SIP-AVP reply item must be a string of form:
value = SIP_AVP_NAME SIP_AVP_VALUE
SIP_AVP_NAME = STRING_NAME | '#'ID_NUMBER
SIP_AVP_VALUE = ':'STRING_VALUE | '#'NUMBER_VALUE
Example 1.1. “SIP-AVP” RADIUS AVP exmaples
.... "email:joe@yahoo.com" -> STRING NAME AVP (email) with STRING VALUE (joe@yahoo.com) "#14:joe@yahoo.com" -> ID AVP (14) with STRING VALUE (joe@yahoo.com) "age#28" -> STRING NAME AVP (age) with INTEGER VALUE (28) "#14#28" -> ID AVP (14) with INTEGER VALUE (28) ....
Unlike in old avp_radius module, functions radius_load_calle[re]_avps() do not prefix string names of AVPs by string “caller_” or “callee_” depending if caller's or callee's attributes were loaded. If you need these prefixes, make your RADIUS server to prepend them into attribute names when it constructs reply items.
A new feature of misc_radius module is that it is now possible to include user defined extra RADIUS attributes in all requests send by functions of this module.
The module depends on the following modules (in the other words the listed modules must be loaded before this module):
none
The following libraries or applications must be installed before compilling Kamailio with this module loaded:
radiusclient-ng 0.5.6 or higher -- library and development files. See http://developer.berlios.de/projects/radiusclient-ng/.
This is the location of the configuration file of radius client libraries.
Default value is “/usr/local/etc/radiusclient-ng/radiusclient.conf”.
Example 1.2. radius_config
parameter usage
... modparam("misc_radius", "radius_config", "/etc/radiusclient.conf")
This is the value of the Service-Type radius attribute to be used, when caller's attributes are loaded.
Default value is dictionary value of “SIP-Caller-AVPs” Service-Type.
Example 1.3. caller_service_type
parameter usage
... modparam("misc_radius", "caller_service_type", 18)
This is the value of the Service-Type radius attribute to be used, when callee's attributes are loaded.
Default value is dictionary value of “SIP-Callee-AVPs” Service-Type.
Example 1.4. callee_service_type
parameter usage
... modparam("misc_radius", "callee_service_type", 19)
This is the value of Service-Type RADIUS attribute to be used, when radius_is_user_in() function is called.
Default value is dictionary value of “Group-Check” Service-Type.
Example 1.5. group_service_type
parameter usage
... modparam("misc_radius", "group_service_type", 20)
This is the value of Service-Type RADIUS attribute to be used, when radius_does_uri[_user]_exist() function is called.
Default value is dictionary value of “Call-Check” Service-Type.
Semi-colon separated list of extra RADIUS attribute name=pseudo variable pairs. When radius_load_caller_avps() is called, the listed extra attributes are included RADIUS request with current values of corresponding pseudo variables.
There is no default value, i.e., by default no extra attributes are included.
Example 1.7. caller_extra
parameter usage
... modparam("misc_radius", "caller_extra", "Calling-Station-Id=$fu")
Semi-colon separated list of extra RADIUS attribute name=pseudo variable pairs. When radius_load_callee_avps() is called, the listed extra attributes are included RADIUS request with current values of corresponding pseudo variables.
There is no default value, i.e., by default no extra attributes are included.
Example 1.8. callee_extra
parameter usage
... modparam("misc_radius", "callee_extra", "SIP-URI-User=$rU;SIP-URI-Host=$rd")
Semi-colon separated list of extra RADIUS attribute name=pseudo variable pairs. When radius_is_user_in() is called, the listed extra attributes are included RADIUS request with current values of corresponding pseudo variables.
There is no default value, i.e., by default no extra attributes are included.
Example 1.9. group_extra
parameter usage
... modparam("misc_radius", "group_extra", "My-Special=$avp(i:100)")
Semi-colon separated list of extra RADIUS attribute name=pseudo variable pairs. When radius_does_uri[_user]_exist() function is called, the listed extra attributes are included in RADIUS request with current values of corresponding pseudo variables.
There is no default value, i.e., by default no extra attributes are included.
Example 1.10. uri_extra
parameter usage
... modparam("misc_radius", "uri_extra", "Called-Station-Id=$tu")
If zero, radius_does_uri_exist() function sends to RADIUS server userpart@hostpart in UserName attribute. If non-zero, radius_does_uri_exist() function sends to RADIUS server userpart in UserName attribute and hostpart in SIP-URI-Host attribute.
Default value is 0 (only use UserName attribute).
The functions loads caller's attributes from radius and stores them into AVPs. Parameter “caller” is a string that may contain pseudo variables. It indicates the user, whose attributes are loaded.
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
Example 1.12. radius_load_caller_avps()
usage
... radius_load_caller_avps("$fU@$fd"); # take caller from From URI ... radius_load_caller_avps("$au@$ar"); # take caller from Authorization ... # or Proxy-Authorization header
The functions loads callee's attributes from radius and stores them into AVPs. Parameter “callee” is a string that may contain pseudo variables. It indicates the user, whose attributes are loaded.
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
Example 1.13. radius_load_callee_avps()
usage
... radius_load_callee_avps("$rU@$rd"); # take callee from Request-URI ...
The functions checks from RADIUS, if user given in first argument belongs to group given in second argument. Both arguments are strings, but user string may also contain pseudo variables. In case of positive result, loads AVPs from SIP-AVP reply items, if any.
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE, and LOCAL_ROUTE.
Example 1.14. radius_is_user_in()
usage
... radius_is_user_in("$rU@$rd", "1"); # take user from Request-URI ... radius_is_user_in("$au@$ar", "group_x");# take user from credentials ...
Checks from RADIUS if userpart@hostpart of Request-URI or of an URI stored in optional pseudo variable argument belongs to a local user. In case of positive result, loads AVPs from SIP-AVP reply items, if any.
This function can be used from REQUEST_ROUTE and LOCAL_ROUTE.
Example 1.15. radius_does_uri_exist()
usage
... if (radius_does_uri_exist()) ... # check Request-URI ... if (radius_does_uri_exist("$avp(i:99)")) ... # check URI in $avp(i:99) ...
Similar to radius_does_uri_exist, but check is done based only on Request-URI userpart or userpart stored in optional pseudo variable argument. Userpart should thus be unique among all user URIs, such as an E.164 number. In case of positive result, loads AVPs from SIP-AVP reply items, if any.
This function can be used from REQUEST_ROUTE and LOCAL_ROUTE.
Example 1.16. radius_does_uri_user_exist()
usage
... if (radius_does_uri_user_exist()) ... # check Request-URI userpart ... if (radius_does_uri_exist("$fU")) ... # check From URI userpart ...