Pārlūkot izejas kodu

documentation: Rebuild all modified READMEs

Hugh Waite 12 gadi atpakaļ
vecāks
revīzija
0577abba2a

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 367 - 282
modules/auth/README


+ 138 - 131
modules/auth_db/README

@@ -1,3 +1,4 @@
+
 Auth_db Module
 
 Jan Janak
@@ -24,10 +25,10 @@ Jan Janak
 
    <[email protected]>
 
-   Copyright © 2002, 2003 FhG FOKUS
+   Copyright © 2002, 2003 FhG FOKUS
 
-   Copyright © 2005 Voice Sistem SRL
-     __________________________________________________________________
+   Copyright © 2005 Voice Sistem SRL
+     _________________________________________________________________
 
    Table of Contents
 
@@ -53,12 +54,12 @@ Jan Janak
 
         4. Functions
 
-              4.1. www_authenticate(realm, table [, method])
-              4.2. www_authorize(realm, table)
-              4.3. proxy_authenticate(realm, table)
-              4.4. proxy_authorize(realm, table)
-              4.5. auth_check(realm, table, flags)
-              4.6. is_subscriber(uri, dbtable, flags)
+              4.1. www_authenticate(realm, table [, method]) 
+              4.2. www_authorize(realm, table) 
+              4.3. proxy_authenticate(realm, table) 
+              4.4. proxy_authorize(realm, table) 
+              4.5. auth_check(realm, table, flags) 
+              4.6. is_subscriber(uri, dbtable, flags) 
 
    List of Examples
 
@@ -100,19 +101,19 @@ Chapter 1. Admin Guide
 
    4. Functions
 
-        4.1. www_authenticate(realm, table [, method])
-        4.2. www_authorize(realm, table)
-        4.3. proxy_authenticate(realm, table)
-        4.4. proxy_authorize(realm, table)
-        4.5. auth_check(realm, table, flags)
-        4.6. is_subscriber(uri, dbtable, flags)
+        4.1. www_authenticate(realm, table [, method]) 
+        4.2. www_authorize(realm, table) 
+        4.3. proxy_authenticate(realm, table) 
+        4.4. proxy_authorize(realm, table) 
+        4.5. auth_check(realm, table, flags) 
+        4.6. is_subscriber(uri, dbtable, flags) 
 
 1. Overview
 
-   This module contains all authentication related functions that need the
-   access to the database. This module should be used together with auth
-   module, it cannot be used independently because it depends on the
-   module. Select this module if you want to use database to store
+   This  module  contains  all authentication related functions that need
+   the  access  to the database. This module should be used together with
+   auth module, it cannot be used independently because it depends on the
+   module.  Select  this  module  if  you  want  to use database to store
    authentication information like subscriber usernames and passwords. If
    you want to use radius authentication, then use auth_radius instead.
 
@@ -123,14 +124,15 @@ Chapter 1. Admin Guide
 
 2.1. Kamailio Modules
 
-   The module depends on the following modules (in the other words the
+   The  module  depends  on the following modules (in the other words the
    listed modules must be loaded before this module):
      * auth -- Generic authentication functions
-     * database -- Any database module (currently mysql, postgres, dbtext)
+     * database  --  Any  database  module  (currently  mysql,  postgres,
+       dbtext)
 
 2.2. External Libraries or Applications
 
-   The following libraries or applications must be installed before
+   The  following  libraries  or  applications  must  be installed before
    running Kamailio with this module loaded:
      * none
 
@@ -149,12 +151,13 @@ Chapter 1. Admin Guide
 3.1. db_url (string)
 
    This is URL of the database to be used. Value of the parameter depends
-   on the database module used. For example for mysql and postgres modules
-   this is something like mysql://username:password@host:port/database.
-   For dbtext module (which stores data in plaintext files) it is
-   directory in which the database resides.
+   on  the  database  module  used.  For  example  for mysql and postgres
+   modules this is something like
+   mysql://username:password@host:port/database. For dbtext module (which
+   stores  data in plaintext files) it is directory in which the database
+   resides.
 
-   Default value is “mysql://kamailioro:kamailioro@localhost/kamailio�.
+   Default value is "mysql://kamailioro:kamailioro@localhost/kamailio". 
 
    Example 1.1. db_url parameter usage
 ...
@@ -163,10 +166,11 @@ modparam("auth_db", "db_url", "dbdriver://username:password@dbhost/dbname")
 
 3.2. user_column (string)
 
-   This is the name of the column holding usernames. Default value is fine
-   for most people. Use the parameter if you really need to change it.
+   This  is  the  name  of the column holding usernames. Default value is
+   fine  for  most people. Use the parameter if you really need to change
+   it.
 
-   Default value is “username�.
+   Default value is "username".
 
    Example 1.2. user_column parameter usage
 ...
@@ -176,10 +180,10 @@ modparam("auth_db", "user_column", "user")
 3.3. domain_column (string)
 
    This is the name of the column holding domains of users. Default value
-   is fine for most people. Use the parameter if you really need to change
-   it.
+   is  fine  for  most  people.  Use  the parameter if you really need to
+   change it.
 
-   Default value is “domain�.
+   Default value is "domain".
 
    Example 1.3. domain_column parameter usage
 ...
@@ -188,13 +192,13 @@ modparam("auth_db", "domain_column", "domain")
 
 3.4. password_column (string)
 
-   This is the name of the column holding passwords. Passwords can be
+   This  is  the  name  of the column holding passwords. Passwords can be
    either stored as plain text or pre-calculated HA1 strings. HA1 strings
-   are MD5 hashes of username, password, and realm. HA1 strings are more
-   safe because the server doesn't need to know plaintext passwords and
+   are  MD5 hashes of username, password, and realm. HA1 strings are more
+   safe  because  the server doesn't need to know plaintext passwords and
    they cannot be obtained from HA1 strings.
 
-   Default value is “ha1�.
+   Default value is "ha1".
 
    Example 1.4. password_column parameter usage
 ...
@@ -203,9 +207,9 @@ modparam("auth_db", "password_column", "password")
 
 3.5. password_column_2 (string)
 
-   As described in the previous section this parameter contains name of
-   column holding pre-calculated HA1 string that were calculated including
-   the domain in the username. This parameter is used only when
+   As  described  in the previous section this parameter contains name of
+   column   holding   pre-calculated  HA1  string  that  were  calculated
+   including the domain in the username. This parameter is used only when
    calculate_ha1 is set to 0 and user agent send a credentials containing
    the domain in the username.
 
@@ -222,23 +226,23 @@ modparam("auth_db", "password_column_2", "ha1_2")
    HA1 string or plaintext passwords for authentification.
 
    If the parameter is set to 0 and the username parameter of credentials
-   contains also “@domain� (some user agents append the domain to the
-   username parameter), then the server will use the HA1 values from the
-   column specified in the “password_column_2� parameter. If the username
+   contains  also  "@domain"  (some  user agents append the domain to the
+   username  parameter), then the server will use the HA1 values from the
+   column specified in the "password_column_2" parameter. If the username
    parameter doesn't contain a domain, the server will use the HA1 values
-   from the column given in the “password_column�parameter.
+   from the column given in the "password_column"parameter.
 
-   If the parameter is set to 1 then the HA1 value will be calculated from
-   the column specified in the “password_column� parameter.
+   If  the  parameter  is  set to 1 then the HA1 value will be calculated
+   from the column specified in the "password_column" parameter.
 
-   The “password_column_2�column contain also HA1 strings but they should
-   be calculated including the domain in the username parameter (as
-   opposed to password_column which (when containing HA1 strings) should
+   The "password_column_2"column contain also HA1 strings but they should
+   be  calculated  including  the  domain  in  the username parameter (as
+   opposed  to password_column which (when containing HA1 strings) should
    always contains HA1 strings calculated without domain in username.
 
-   This ensures that the authentication will always work when using
-   pre-calculated HA1 strings, not depending on the presence of the domain
-   in username.
+   This  ensures  that  the  authentication  will  always work when using
+   pre-calculated  HA1  strings,  not  depending  on  the presence of the
+   domain in username.
 
    Default value of this parameter is 0.
 
@@ -249,15 +253,15 @@ modparam("auth_db", "calculate_ha1", 1)
 
 3.7. use_domain (integer)
 
-   If true (not 0), domain will be also used when looking up in the
-   subscriber table. If you have a multi-domain setup, it is strongly
-   recommended to turn on this parameter to avoid username overlapping
+   If  true  (not  0),  domain  will  be also used when looking up in the
+   subscriber  table.  If  you  have a multi-domain setup, it is strongly
+   recommended  to  turn  on this parameter to avoid username overlapping
    between domains.
 
-   IMPORTANT: before turning on this parameter, be sure that the domain
+   IMPORTANT:  before  turning on this parameter, be sure that the domain
    column in subscriber table is properly populated.
 
-   Default value is “0 (false)�.
+   Default value is "0 (false)".
 
    Example 1.7. use_domain parameter usage
 ...
@@ -268,15 +272,15 @@ modparam("auth_db", "use_domain", 1)
 
    This parameter specifies of credentials to be fetch from database when
    the authentication is performed. The loaded credentials will be stored
-   in AVPs. If the AVP name is not specificaly given, it will be used a
+   in  AVPs.  If the AVP name is not specificaly given, it will be used a
    NAME AVP with the same name as the column name.
 
    Parameter syntax:
-     * load_credentials = credential (';' credential)*
-     * credential = (avp_specification '=' column_name) | (column_name)
-     * avp_specification = '$avp(' + 'i:'ID | 's:'NAME | alias + ')'
+     * load_credentials = credential (';' credential)* 
+     * credential = (avp_specification '=' column_name) | (column_name) 
+     * avp_specification = '$avp(' + 'i:'ID | 's:'NAME | alias + ')' 
 
-   Default value of this parameter is “rpid�.
+   Default value of this parameter is "rpid".
 
    Example 1.8. load_credentials parameter usage
 ...
@@ -287,10 +291,10 @@ modparam("auth_db", "load_credentials", "$avp(i:123)=rpid;email_address")
 
 3.9. version_table (integer)
 
-   If set to 0, the module will skip checking the version for subscriber
+   If  set to 0, the module will skip checking the version for subscriber
    table.
 
-   Default value is “1 (check for table version)�.
+   Default value is "1 (check for table version)".
 
    Example 1.9. version_table parameter usage
 ...
@@ -299,43 +303,45 @@ modparam("auth_db", "version_table", 0)
 
 4. Functions
 
-   4.1. www_authenticate(realm, table [, method])
-   4.2. www_authorize(realm, table)
-   4.3. proxy_authenticate(realm, table)
-   4.4. proxy_authorize(realm, table)
-   4.5. auth_check(realm, table, flags)
-   4.6. is_subscriber(uri, dbtable, flags)
+   4.1. www_authenticate(realm, table [, method]) 
+   4.2. www_authorize(realm, table) 
+   4.3. proxy_authenticate(realm, table) 
+   4.4. proxy_authorize(realm, table) 
+   4.5. auth_check(realm, table, flags) 
+   4.6. is_subscriber(uri, dbtable, flags) 
 
 4.1.  www_authenticate(realm, table [, method])
 
    Name alias: www_authorize(realm, table)
 
-   The function verifies credentials according to RFC2617. If the
-   credentials are verified successfully then the function will succeed
-   and mark the credentials as authorized (marked credentials can be later
-   used by some other functions). If the function was unable to verify the
-   credentials for some reason then it will fail and the script should
-   call www_challenge which will challenge the user again.
+   The  function  verifies  credentials  according  to  RFC2617.  If  the
+   credentials  are  verified successfully then the function will succeed
+   and  mark  the  credentials  as  authorized (marked credentials can be
+   later  used  by  some  other functions). If the function was unable to
+   verify  the  credentials  for  some  reason  then it will fail and the
+   script should call www_challenge which will challenge the user again.
 
    Negative codes may be interpreted as follows:
-     * -1 (generic error) - some generic error occurred and no reply was
+     * -1  (generic error) - some generic error occurred and no reply was
        sent out;
      * -2 (invalid password) - valid user, but wrong password;
      * -3 (invalid user) - authentication user does not exist.
 
    Meaning of the parameters is as follows:
-     * realm - Realm is a opaque string that the user agent should present
-       to the user so he can decide what username and password to use.
-       Usually this is domain of the host the server is running on.
-       It must not be empty string “�. In case of REGISTER requests To
+     * realm  -  Realm  is  a  opaque  string  that the user agent should
+       present to the user so he can decide what username and password to
+       use. Usually this is domain of the host the server is running on.
+       It  must  not  be empty string "". In case of REGISTER requests To
        header field domain (e.g., variable $td) can be used (because this
-       header field represents the user being registered), for all other
-       messages From header field domain can be used (e.g., variable $fd).
+       header  field represents the user being registered), for all other
+       messages  From  header  field  domain  can be used (e.g., variable
+       $fd).
        The string may contain pseudo variables.
-     * table - Table to be used to lookup usernames and passwords (usually
-       subscribers table).
-     * method - the method to be used for authentication. This parameter
-       is optional and if not set is the first "word" on the request-line.
+     * table  -  Table  to  be  used  to  lookup  usernames and passwords
+       (usually subscribers table).
+     * method  - the method to be used for authentication. This parameter
+       is   optional   and  if  not  set  is  the  first  "word"  on  the
+       request-line.
 
    This function can be used from REQUEST_ROUTE.
 
@@ -348,34 +354,35 @@ if (!www_authorize("kamailio.org", "subscriber")) {
 
 4.2.  www_authorize(realm, table)
 
-   It is same function as www_authenticate(realm, table). This name is
-   kept for backward compatibility, since it was named this way first time
-   by it actually does user authentication.
+   It  is  same  function as www_authenticate(realm, table). This name is
+   kept  for  backward  compatibility,  since it was named this way first
+   time by it actually does user authentication.
 
 4.3.  proxy_authenticate(realm, table)
 
    Name alias: proxy_authorize(realm, table)
 
-   The function verifies credentials according to RFC2617. If the
-   credentials are verified successfully then the function will succeed
-   and mark the credentials as authorized (marked credentials can be later
-   used by some other functions). If the function was unable to verify the
-   credentials for some reason then it will fail and the script should
-   call proxy_challenge which will challenge the user again.
+   The  function  verifies  credentials  according  to  RFC2617.  If  the
+   credentials  are  verified successfully then the function will succeed
+   and  mark  the  credentials  as  authorized (marked credentials can be
+   later  used  by  some  other functions). If the function was unable to
+   verify  the  credentials  for  some  reason  then it will fail and the
+   script  should  call  proxy_challenge  which  will  challenge the user
+   again.
 
    Negative return codes have the same meaning as for www_authenticate().
 
    Meaning of the parameters is as follows:
-     * realm - Realm is a opaque string that the user agent should present
-       to the user so he can decide what username and password to use.
-       Usually this is domain of the host the server is running on.
-       It must not be empty string “�. Apart of a static string, typical
+     * realm  -  Realm  is  a  opaque  string  that the user agent should
+       present to the user so he can decide what username and password to
+       use. Usually this is domain of the host the server is running on.
+       It  must not be empty string "". Apart of a static string, typical
        value is From header field domain (e.g., variable $fd).
-       If an empty string “� is used then the server will generate it from
-       the request. From header field domain will be used as realm.
+       If  an  empty  string  "" is used then the server will generate it
+       from the request. From header field domain will be used as realm.
        The string may contain pseudo variables.
-     * table - Table to be used to lookup usernames and passwords (usually
-       subscribers table).
+     * table  -  Table  to  be  used  to  lookup  usernames and passwords
+       (usually subscribers table).
 
    This function can be used from REQUEST_ROUTE.
 
@@ -388,39 +395,39 @@ if (!proxy_authorize("$fd", "subscriber)) {
 
 4.4.  proxy_authorize(realm, table)
 
-   It is same function as proxy_authenticate(realm, table). This name is
-   kept for backward compatibility, since it was named this way first time
-   but it actually does user authentication.
+   It  is same function as proxy_authenticate(realm, table). This name is
+   kept  for  backward  compatibility,  since it was named this way first
+   time but it actually does user authentication.
 
 4.5.  auth_check(realm, table, flags)
 
-   The function combines the functionalities of www_authenticate and
-   proxy_authenticate, first being exectuted if the SIP request is a
+   The  function  combines  the  functionalities  of www_authenticate and
+   proxy_authenticate,  first  being  exectuted  if  the SIP request is a
    REGISTER, the second for the rest.
 
    In addition, a matter of flags parameter value, the function checks if
-   authentication username matches From/To header username, and
+   authentication   username   matches   From/To   header  username,  and
    Request-URI in case of PUBLISH.
 
    Meaning of the parameters is as follows:
-     * realm - Realm is a opaque string that the user agent should present
-       to the user so he can decide what username and password to use.
-       Usually this is domain of the host the server is running on.
-       It must not be empty string “�. Apart of a static string, typical
+     * realm  -  Realm  is  a  opaque  string  that the user agent should
+       present to the user so he can decide what username and password to
+       use. Usually this is domain of the host the server is running on.
+       It  must not be empty string "". Apart of a static string, typical
        value is From header field domain (e.g., variable $fd).
        The string may contain pseudo variables.
-     * table - Table to be used to lookup usernames and passwords (usually
-       subscribers table).
+     * table  -  Table  to  be  used  to  lookup  usernames and passwords
+       (usually subscribers table).
        The string may contain pseudo variables.
-     * flags - set of flags to control the behaviour of the function. If
+     * flags  - set of flags to control the behaviour of the function. If
        it is 1, then the function will check to see if the authentication
-       username matches either To or From header username. REGISTER
-       requests: From and To must match the authentication user. PUBLISH
-       requests: From, To and Request-URI must match the authentication
-       user. All other requests: From header must match the authentication
-       user.
-       Additionally all domains in the checked URIs and the realm in the
-       authentication header will be checked to match the provided realm
+       username  matches  either  To  or  From  header username. REGISTER
+       requests:  From and To must match the authentication user. PUBLISH
+       requests:  From,  To and Request-URI must match the authentication
+       user.   All   other   requests:   From   header   must  match  the
+       authentication user.
+       Additionally  all domains in the checked URIs and the realm in the
+       authentication  header will be checked to match the provided realm
        parameter.
        The string may contain pseudo variables.
 
@@ -436,22 +443,22 @@ if (!auth_check("$fd", "subscriber", "1")) {
 
 4.6.  is_subscriber(uri, dbtable, flags)
 
-   The function checks if there is a subscriber corresponding to the AoR
-   in uri parameter. It uses same database connection as for
+   The  function checks if there is a subscriber corresponding to the AoR
+   in   uri   parameter.   It   uses  same  database  connection  as  for
    authentication functions.
 
-   In addition, if the subscriber record is found, then the
+   In   addition,   if   the   subscriber   record  is  found,  then  the
    load_credentials attributes are loaded. An use case can be loading the
    credential attributes for callee.
 
    Meaning of the parameters is as follows:
      * uri - a valid SIP URI value to identify the subscriber. The string
        may contain pseudo variables.
-     * dbtable - Table to be used to lookup username and domain from URI
-       (usually subscriber table). The string may contain pseudo
+     * dbtable  - Table to be used to lookup username and domain from URI
+       (usually   subscriber   table).  The  string  may  contain  pseudo
        variables.
-     * flags - set of flags to control the behaviour of the function. If
-       it is 1, then the function will use the domain part of the URI to
+     * flags  - set of flags to control the behaviour of the function. If
+       it  is 1, then the function will use the domain part of the URI to
        perform the database table search.
        The parameter may be a pseudo variable.
 

+ 52 - 51
modules/auth_ephemeral/README

@@ -1,3 +1,4 @@
+
 Auth_ephemeral Module
 
 Peter Dunkley
@@ -5,8 +6,8 @@ Peter Dunkley
    Crocodile RCS Ltd
    <[email protected]>
 
-   Copyright © 2013 Crocdile RCS Ltd
-     __________________________________________________________________
+   Copyright © 2013 Crocodile RCS Ltd
+     _________________________________________________________________
 
    Table of Contents
 
@@ -30,14 +31,14 @@ Peter Dunkley
 
         4. Functions
 
-              4.1. autheph_proxy(realm)
-              4.2. autheph_www(realm[, method])
-              4.3. autheph_check(realm)
+              4.1. autheph_proxy(realm) 
+              4.2. autheph_www(realm[, method]) 
+              4.3. autheph_check(realm) 
 
    List of Examples
 
-   1.1.
-   1.2.
+   1.1. Request example
+   1.2. Response example
    1.3. secret parameter usage
    1.4. autheph_proxy usage
    1.5. autheph_www usage
@@ -65,9 +66,9 @@ Chapter 1. Admin Guide
 
    4. Functions
 
-        4.1. autheph_proxy(realm)
-        4.2. autheph_www(realm[, method])
-        4.3. autheph_check(realm)
+        4.1. autheph_proxy(realm) 
+        4.2. autheph_www(realm[, method]) 
+        4.3. autheph_check(realm) 
 
 1. Overview
 
@@ -76,25 +77,25 @@ Chapter 1. Admin Guide
         1.1.1. Request
         1.1.2. Response
 
-   This module contains all authentication related functions that can work
-   with ephemeral credentials. This module should be used together with
-   the auth module - it cannot be used independently because it depends on
-   the auth module. Use this module if you want to use ephemeral
-   credentials instead of ordinary usernames and passwords.
+   This  module  contains  all  authentication related functions that can
+   work  with  ephemeral credentials. This module should be used together
+   with  the  auth  module  -  it cannot be used independently because it
+   depends  on  the  auth  module.  Use  this  module  if you want to use
+   ephemeral credentials instead of ordinary usernames and passwords.
 
 1.1. How ephemeral credentials work
 
-   Ephemeral credentials are generated by a web-service and enforced on
-   Kamailio. This usage of ephemeral credentials ensures that access to
-   Kamailio is controlled even if the credentials cannot be kept secret,
+   Ephemeral  credentials  are generated by a web-service and enforced on
+   Kamailio.  This  usage of ephemeral credentials ensures that access to
+   Kamailio  is controlled even if the credentials cannot be kept secret,
    as can be the case in WebRTC where the credentials may be specified in
    Javascript.
 
-   To use this mechanism, the only interaction needed between the
+   To  use  this  mechanism,  the  only  interaction  needed  between the
    web-service and Kamailio is to share a secret key.
 
    Typically, credentials will be requested from the web-service using an
-   HTTP GET and provided in a JSON response. To prevent unauthorised use
+   HTTP  GET and provided in a JSON response. To prevent unauthorised use
    the HTTP requests can be ACLd by various means.
 
    This mechanism is based on the Google proposal for a "TURN Server REST
@@ -108,27 +109,27 @@ Chapter 1. Admin Guide
      * ttl - an optional TTL request for the lifetime of the credentials,
        in seconds.
 
-   Example 1.1.
+   Example 1.1. Request example
 GET /?service=sip&username=foobar;&ttl=86400;
 
 1.1.2. Response
 
    The response should include the following parameters:
-     * username - the username to use with the service, which is a
-       combination of the username parameter from the request and a
+     * username  -  the  username  to  use  with  the service, which is a
+       combination  of  the  username  parameter  from  the request and a
        timestamp in time_t format, colon-separated. If a username was not
-       included in the request this parameter will just include the
+       included  in  the  request  this  parameter  will just include the
        timestamp.
-     * password - the password to use; this value is computed from the
-       secret key and the returned username value, by performing
+     * password  -  the  password to use; this value is computed from the
+       secret   key  and  the  returned  username  value,  by  performing
        base64(hmac-sha1(secret key, returned username)).
-     * ttl - the duration for which the username and password are valid,
-       in seconds. This number will be less than or equal to the requested
-       TTL.
-     * uris - an array of URIs indicating servers that the username and
+     * ttl  - the duration for which the username and password are valid,
+       in  seconds.  This  number  will  be  less  than  or  equal to the
+       requested TTL.
+     * uris  -  an array of URIs indicating servers that the username and
        password are valid for.
 
-   Example 1.2.
+   Example 1.2. Response example
 {
   "username" : "foobar:1234567890",
   "password" : "asdfghjklauio=",
@@ -161,8 +162,8 @@ GET /?service=sip&username=foobar;&ttl=86400;
 
 3.1. secret (string)
 
-   The shared secret to use for generating credentials. This parameter can
-   be set multiple times - this enables the secret used for new
+   The  shared  secret  to use for generating credentials. This parameter
+   can  be  set  multiple  times  -  this enables the secret used for new
    credentials to be changed without causing existing credentials to stop
    working. The last secret set is the first that will be tried.
 
@@ -173,20 +174,20 @@ modparam("auth_ephemeral", "secret", "kamailio_rules")
 
 4. Functions
 
-   4.1. autheph_proxy(realm)
-   4.2. autheph_www(realm[, method])
-   4.3. autheph_check(realm)
+   4.1. autheph_proxy(realm) 
+   4.2. autheph_www(realm[, method]) 
+   4.3. autheph_check(realm) 
 
 4.1.  autheph_proxy(realm)
 
    This function performs proxy authentication. the rest.
 
    The meaning of the parameters are as follows:
-     * realm - Realm is an opaque string that the user agent should
-       present to the user so that he can decide what username and
-       password to use. Usually this is domain of the host the server is
+     * realm  -  Realm  is  an  opaque  string that the user agent should
+       present  to  the  user  so  that  he  can decide what username and
+       password  to use. Usually this is domain of the host the server is
        running on.
-       It must not be an empty string “�. Apart from a static string, a
+       It  must  not be an empty string "". Apart from a static string, a
        typical value is the From-URI domain (i.e., $fd).
        The string may contain pseudo variables.
 
@@ -205,14 +206,14 @@ if (!autheph_proxy("$fd")) {
    This function performs WWW digest authentication.
 
    The meaning of the parameters are as follows:
-     * realm - Realm is an opaque string that the user agent should
-       present to the user so that he can decide what username and
-       password to use. Usually this is domain of the host the server is
+     * realm  -  Realm  is  an  opaque  string that the user agent should
+       present  to  the  user  so  that  he  can decide what username and
+       password  to use. Usually this is domain of the host the server is
        running on.
-       It must not be an empty string “�. Apart from a static string, a
+       It  must  not be an empty string "". Apart from a static string, a
        typical value is the From-URI domain (i.e., $fd).
        The string may contain pseudo variables.
-     * method - the method to be used for authentication. This parameter
+     * method  - the method to be used for authentication. This parameter
        is optional and if not set the first "word" on the request-line is
        used.
 
@@ -228,16 +229,16 @@ if (!autheph_www("$fd")) {
 
 4.3.  autheph_check(realm)
 
-   This function combines the functionalities of autheph_www and
-   autheph_proxy, the first being exectuted if the SIP request is a
+   This   function   combines  the  functionalities  of  autheph_www  and
+   autheph_proxy,  the  first  being  exectuted  if  the SIP request is a
    REGISTER, the second for the rest.
 
    The meaning of the parameters are as follows:
-     * realm - Realm is an opaque string that the user agent should
-       present to the user so that he can decide what username and
-       password to use. Usually this is domain of the host the server is
+     * realm  -  Realm  is  an  opaque  string that the user agent should
+       present  to  the  user  so  that  he  can decide what username and
+       password  to use. Usually this is domain of the host the server is
        running on.
-       It must not be an empty string “�. Apart from a static string, a
+       It  must  not be an empty string "". Apart from a static string, a
        typical value is the From-URI domain (i.e., $fd).
        The string may contain pseudo variables.
 

+ 183 - 76
modules/auth_identity/README

@@ -1,38 +1,145 @@
-The Auth_identity module
+
+SIP Authenticated Identity Module
 
 Gergely Kovacs
 
    Iptel.org
 
    Copyright © 2007 Iptel.org
-     __________________________________________________________________
+     _________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+        2. Dependencies
+        3. Compilation
+        4. Installation And Running
+        5. Parameters
+
+              5.1. privatekey_path (string)
+              5.2. certificate_path (string)
+              5.3. certificate_url (string)
+              5.4. msg_timeout (integer)
+              5.5. auth_validity_time (integer)
+              5.6. callid_cache_limit (integer)
+              5.7. certificate_cache_limit (integer)
+              5.8. cainfo_path (string)
+              5.9. accept_pem_certs ([0|1])
+
+        6. Functions
+
+              6.1. auth_date_proc() 
+
+                    6.1.1. Dependencies
+
+              6.2. auth_add_identity() 
+
+                    6.2.1. Dependencies
+
+              6.3. vrfy_check_date() 
+
+                    6.3.1. Dependencies
+
+              6.4. vrfy_get_certificate() 
+
+                    6.4.1. Dependencies
+
+              6.5. vrfy_check_certificate() 
+
+                    6.5.1. Dependencies
+
+              6.6. vrfy_check_msgvalidity() 
+
+                    6.6.1. Dependencies
+
+              6.7. vrfy_check_callid() 
+
+                    6.7.1. Dependencies
+
+        7. Authorizer service examples
+        8. Verifier service examples
 
    List of Examples
 
-   1. Set privatekey_path parameter
-   2. Set certificate_path parameter
-   3. Set certificate_url parameter
-   4. Set msg_timeout parameter
-   5. Set auth_validity_time parameter
-   6. Set auth_validity_time parameter
-   7. Set certificate_cache_limit parameter
-   8. Set cainfo_path parameter
-   9. Set accept_pem_certs parameter
+   1.1. Set privatekey_path parameter
+   1.2. Set certificate_path parameter 
+   1.3. Set certificate_url parameter 
+   1.4. Set msg_timeout parameter 
+   1.5. Set auth_validity_time parameter 
+   1.6. Set auth_validity_time parameter 
+   1.7. Set certificate_cache_limit parameter 
+   1.8. Set cainfo_path parameter 
+   1.9. Set accept_pem_certs parameter 
+
+Chapter 1. Admin Guide
+
+   Table of Contents
+
+   1. Overview
+   2. Dependencies
+   3. Compilation
+   4. Installation And Running
+   5. Parameters
+
+        5.1. privatekey_path (string)
+        5.2. certificate_path (string)
+        5.3. certificate_url (string)
+        5.4. msg_timeout (integer)
+        5.5. auth_validity_time (integer)
+        5.6. callid_cache_limit (integer)
+        5.7. certificate_cache_limit (integer)
+        5.8. cainfo_path (string)
+        5.9. accept_pem_certs ([0|1])
+
+   6. Functions
+
+        6.1. auth_date_proc() 
+
+              6.1.1. Dependencies
+
+        6.2. auth_add_identity() 
+
+              6.2.1. Dependencies
+
+        6.3. vrfy_check_date() 
+
+              6.3.1. Dependencies
+
+        6.4. vrfy_get_certificate() 
+
+              6.4.1. Dependencies
+
+        6.5. vrfy_check_certificate() 
+
+              6.5.1. Dependencies
+
+        6.6. vrfy_check_msgvalidity() 
+
+              6.6.1. Dependencies
+
+        6.7. vrfy_check_callid() 
+
+              6.7.1. Dependencies
+
+   7. Authorizer service examples
+   8. Verifier service examples
 
 1. Overview
 
    Auth Identity module provides functionalities for securely identifying
-   originators of SIP messages. It implements the SIP Identity standard
-   where a SIP proxy signs messages that is sent to other domains. This
+   originators  of  SIP messages. It implements the SIP Identity standard
+   where  a  SIP proxy signs messages that is sent to other domains. This
    module has two basic services:
-     * authorizer - authorizes a message and adds Identity and
+     * authorizer   -   authorizes   a  message  and  adds  Identity  and
        Identity-Info headers
      * verifier - verifies an authorized message
 
    Known limitations in this version:
      * authorizer and verifier support all SIP requests except for CANCEL
        and REGISTER
-     * verifier does not support the subjectAltName extension of
+     * verifier   does   not  support  the  subjectAltName  extension  of
        certificates
 
 2. Dependencies
@@ -45,16 +152,16 @@ Gergely Kovacs
      * OpenSSL (version 0.9.8 or higher) for cryptographic functions
      * libcurl for HTTP, HTTPS functions
 
-   If you'd like to use TLS module too then use the corresponding LIB line
-   in auth_identity's Makefile
+   If  you'd  like  to  use TLS module too then use the corresponding LIB
+   line in auth_identity's Makefile
 
 4. Installation And Running
 
    the Authorizer service needs to make the public key, which conveyed in
-   a certificate, available over HTTPS or HTTP for verifiers. The domain
-   the authorizer is responsible for and the domain part of the URL of the
-   certificate must be the same. This service needs access to the private
-   key too.
+   a  certificate, available over HTTPS or HTTP for verifiers. The domain
+   the  authorizer  is  responsible for and the domain part of the URL of
+   the  certificate  must  be  the same. This service needs access to the
+   private key too.
 
 5. Parameters
 
@@ -77,7 +184,7 @@ Gergely Kovacs
 
    This parameter is required by authentication service.
 
-   Example 1. Set privatekey_path parameter
+   Example 1.1. Set privatekey_path parameter
 ...
 modparam("auth_identity","privatekey_path","/etc/ssl/private/key.pem")
 ...
@@ -91,7 +198,7 @@ modparam("auth_identity","privatekey_path","/etc/ssl/private/key.pem")
 
    This parameter is required by authentication service.
 
-   Example 2. Set certificate_path parameter
+   Example 1.2. Set certificate_path parameter 
 ...
 modparam("auth_identity","certificate_path","/var/www/ssl/mycert.pem")
 ...
@@ -100,13 +207,13 @@ modparam("auth_identity","certificate_path","/var/www/ssl/mycert.pem")
 
    Note: this parameter is for authorizer service.
 
-   The url where certificate is available for other verifier services.
-   (value of Identity-info header) The certificate should be in DER
+   The  url  where  certificate is available for other verifier services.
+   (value  of  Identity-info  header)  The  certificate  should be in DER
    format.
 
    This parameter is required by authentication service.
 
-   Example 3. Set certificate_url parameter
+   Example 1.3. Set certificate_url parameter 
 ...
 modparam("auth_identity","certificate_url","https://foo.bar/mycert.der")
 ...
@@ -115,13 +222,13 @@ modparam("auth_identity","certificate_url","https://foo.bar/mycert.der")
 
    Note: this parameter is for authorizer service.
 
-   If the Date header of message which is needed to be authenticated
-   contains a time different by more than this seconds from the current
+   If  the  Date  header  of  message which is needed to be authenticated
+   contains  a  time different by more than this seconds from the current
    time noted by the authentication service then it rejects the message.
 
    This parameter is optional. The default value is "600".
 
-   Example 4. Set msg_timeout parameter
+   Example 1.4. Set msg_timeout parameter 
 ...
 modparam("auth_identity","msg_timeout",600)
 ...
@@ -130,13 +237,13 @@ modparam("auth_identity","msg_timeout",600)
 
    Note: this parameter is for verifier service.
 
-   The validity time of an authenticated message. The message will be
+   The  validity  time  of  an authenticated message. The message will be
    refused if it contains a time different by more than this seconds from
    the current time noted by the verification service.
 
    This parameter is optional. The default value is "3600".
 
-   Example 5. Set auth_validity_time parameter
+   Example 1.5. Set auth_validity_time parameter 
 ...
 modparam("auth_identity","auth_validity_time",3600)
 ...
@@ -145,15 +252,15 @@ modparam("auth_identity","auth_validity_time",3600)
 
    Note: this parameter is for verifier service.
 
-   The number of Call-IDs stored in order to recognize call replay
-   attacks. A Call-ID is stored auth_validity_time long and uses
+   The  number  of  Call-IDs  stored  in  order  to recognize call replay
+   attacks.   A  Call-ID  is  stored  auth_validity_time  long  and  uses
    approximately 100 bytes memory.
 
-   This parameter is optional. The default value is "32768". (you should
-   increase the size of shared memory with -m command line switch if you
+   This  parameter is optional. The default value is "32768". (you should
+   increase  the size of shared memory with -m command line switch if you
    liked to store more callid than 10000)
 
-   Example 6. Set auth_validity_time parameter
+   Example 1.6. Set auth_validity_time parameter 
 ...
 modparam("auth_identity","callid_cache_limit",32768)
 ...
@@ -163,12 +270,12 @@ modparam("auth_identity","callid_cache_limit",32768)
    Note: this parameter is for verifier service.
 
    The number of certificates stored in order to avoid needless download.
-   A certificate is stored until its expiration date and uses
+   A   certificate   is   stored  until  its  expiration  date  and  uses
    approximately 600 bytes memory.
 
    This parameter is optional. The default value is "4096".
 
-   Example 7. Set certificate_cache_limit parameter
+   Example 1.7. Set certificate_cache_limit parameter 
 ...
 modparam("auth_identity","certificate_cache_limit",4096)
 ...
@@ -177,13 +284,13 @@ modparam("auth_identity","certificate_cache_limit",4096)
 
    Note: this parameter is for verifier service.
 
-   A file of trusted certificates. The file should contain multiple
-   certificates in PEM format concatenated together. It could be useful
+   A  file  of  trusted  certificates.  The  file should contain multiple
+   certificates  in  PEM format concatenated together. It could be useful
    for verifying a certificate signed by a private CA.
 
    This parameter is optional. It has not got default value.
 
-   Example 8. Set cainfo_path parameter
+   Example 1.8. Set cainfo_path parameter 
 ...
 modparam("auth_identity","cainfo_path","/etc/ssl/certs/ca-certificates.crt")
 ...
@@ -196,38 +303,38 @@ modparam("auth_identity","cainfo_path","/etc/ssl/certs/ca-certificates.crt")
 
    This parameter is optional. The default value is "0".
 
-   Example 9. Set accept_pem_certs parameter
+   Example 1.9. Set accept_pem_certs parameter 
 ...
 modparam("auth_identity","accept_pem_certs",1)
 ...
 
 6. Functions
 
-   6.1. auth_date_proc()
+   6.1. auth_date_proc() 
 
         6.1.1. Dependencies
 
-   6.2. auth_add_identity()
+   6.2. auth_add_identity() 
 
         6.2.1. Dependencies
 
-   6.3. vrfy_check_date()
+   6.3. vrfy_check_date() 
 
         6.3.1. Dependencies
 
-   6.4. vrfy_get_certificate()
+   6.4. vrfy_get_certificate() 
 
         6.4.1. Dependencies
 
-   6.5. vrfy_check_certificate()
+   6.5. vrfy_check_certificate() 
 
         6.5.1. Dependencies
 
-   6.6. vrfy_check_msgvalidity()
+   6.6. vrfy_check_msgvalidity() 
 
         6.6.1. Dependencies
 
-   6.7. vrfy_check_callid()
+   6.7. vrfy_check_callid() 
 
         6.7.1. Dependencies
 
@@ -235,12 +342,12 @@ modparam("auth_identity","accept_pem_certs",1)
 
    Note: this function is for authorizer service.
 
-   If a message, the auth service should authorize, contains Date header
-   then this function checks whether it falls in message timeout (set by
-   msg_timeout parameter). If there is not any Date header then the module
-   adds one. This function also checks whether the certificate of the
-   authentication service (set by certificate_path parameter) has been
-   expired.
+   If  a message, the auth service should authorize, contains Date header
+   then  this function checks whether it falls in message timeout (set by
+   msg_timeout  parameter).  If  there  is  not  any Date header then the
+   module  adds one. This function also checks whether the certificate of
+   the  authentication  service  (set  by certificate_path parameter) has
+   been expired.
 
 6.1.1. Dependencies
 
@@ -250,17 +357,17 @@ modparam("auth_identity","accept_pem_certs",1)
 
    Note: this function is for authorizer service.
 
-   Assembles digest-string from the message, calculates its SHA1 hash,
+   Assembles  digest-string  from  the message, calculates its SHA1 hash,
    encrypts it with the private key (set by privatekey_path parameter) of
-   the authorizer service, base64 encodes it and adds to the outgoing
-   message as the value of Identity header. This function also adds
-   Identity-Info header which contains an URI (set by certificate_url
+   the  authorizer  service,  base64  encodes it and adds to the outgoing
+   message  as  the  value  of  Identity  header. This function also adds
+   Identity-Info  header  which  contains  an URI (set by certificate_url
    parameter) from which the certificate of auth service can be acquired.
 
-   Note: this function needs the final outgoing message for authorization,
-   so no module may modify any digest string related headers (From, To,
-   Call-ID, CSeq, Date, Contact) and body after auth_add_identity()'s been
-   called
+   Note:   this   function   needs   the   final   outgoing  message  for
+   authorization,  so  no  module  may  modify  any digest string related
+   headers  (From,  To,  Call-ID,  CSeq,  Date,  Contact)  and body after
+   auth_add_identity()'s been called
 
 6.2.1. Dependencies
 
@@ -270,7 +377,7 @@ modparam("auth_identity","accept_pem_certs",1)
 
    Note: this function is for verifier service.
 
-   Checks Date header of the incoming message whether falls in validity
+   Checks  Date  header of the incoming message whether falls in validity
    time (set by auth_validity_time parameter)
 
 6.3.1. Dependencies
@@ -281,9 +388,9 @@ modparam("auth_identity","accept_pem_certs",1)
 
    Note: this function is for verifier service.
 
-   Tries to get certificate defined by the value of Identity-info header
-   from certificate table (which size is set by certificate_cache_limit
-   parameter). If the required certificate is not found there then this
+   Tries  to get certificate defined by the value of Identity-info header
+   from  certificate  table (which size is set by certificate_cache_limit
+   parameter).  If  the required certificate is not found there then this
    function downloads it.
 
 6.4.1. Dependencies
@@ -294,9 +401,9 @@ modparam("auth_identity","accept_pem_certs",1)
 
    Note: this function is for verifier service.
 
-   Checks whether the downloaded certificate is valid (is not expired, its
-   subject and the domain part of the URL are the same) and adds it to
-   certificate table.
+   Checks  whether  the  downloaded certificate is valid (is not expired,
+   its  subject  and the domain part of the URL are the same) and adds it
+   to certificate table.
 
 6.5.1. Dependencies
 
@@ -306,22 +413,22 @@ modparam("auth_identity","accept_pem_certs",1)
 
    Note: this function is for verifier service.
 
-   Assembles digest-string from the message, create SHA1 hash and compares
-   it with the decrypted value of Identity header.
+   Assembles  digest-string  from  the  message,  create  SHA1  hash  and
+   compares it with the decrypted value of Identity header.
 
 6.6.1. Dependencies
 
-   vrfy_get_certificate() must be called before and
+   vrfy_get_certificate()      must      be     called     before     and
    vrfy_check_certificate() should be called before
 
 6.7.  vrfy_check_callid()
 
    Note: this function is for verifier service.
 
-   Checks whether the current call's been already processed in validity
-   time (set by auth_validity_time) to recognize call replay attacks. If
+   Checks  whether  the current call's been already processed in validity
+   time  (set by auth_validity_time) to recognize call replay attacks. If
    this call (identified by Call-id, Cseq, and tag of From header triple)
-   has not been replayed then adds it to callid table (which size is set
+   has  not been replayed then adds it to callid table (which size is set
    by callid_cache_limit parameter).
 
 6.7.1. Dependencies

+ 208 - 131
modules/avp/README

@@ -1,3 +1,4 @@
+
 The AVP module
 
 Jiri Kuthan
@@ -11,35 +12,109 @@ Michal Matyska
    <[email protected]>
 
    Copyright © 2004, 2005, 2006 FhG FOKUS, iptelorg GmbH
-     __________________________________________________________________
+     _________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+        2. Functions
+
+              2.1. set_iattr(attribute,value)
+              2.2. flags2attr("$avp")
+              2.3. set_sattr(attribute,value)
+              2.4. print_attr($attribute)
+              2.5. attr2uri($attribute[,uri-part])
+              2.6. attr_exists(attribute)
+              2.7. attr_equals(attribute, value)
+              2.8. attr_equals_xl(attribute, xl_format)
+              2.9. dump_attrs()
+              2.10. xlset_attr($attribute, xl_format)
+              2.11. xlfix_attr($attribute)
+              2.12. insert_attr_hf(name)
+              2.13. insert_attr_hf(header_name, $avp_name)
+              2.14. append_attr_hf(name)
+              2.15. append_attr_hf(header_name, $avp_name)
+              2.16. replace_attr_hf(name)
+              2.17. replace_attr_hf(header_name, $avp_name)
+              2.18. attr_to_reply(name)
+              2.19. attr_to_reply(header_name, $avp_name)
+              2.20. attr_destination($avp_name)
+              2.21. xlset_destination(xl_format)
+              2.22. subst_attr($avp_name, subst_re)
+              2.23. del_attr($avp_name)
+              2.24. hdr_body2attrs(headername, prefix)
+              2.25. hdr_body2attrs2(headername, prefix)
+
+        3. Parameters
+
+              3.1. xlbuf_size (integer)
 
    List of Examples
 
-   1. set_iattr usage
-   2. flags2attr usage
-   3. set_sattr usage
-   4. attr_exists usage
-   5. attr_equals_xl usage
-   6. insert_attr_hf usage
-   7. attr_to_reply usage
-   8. attr_destination usage
-   9. xlset_destination usage
-   10. subst_attr usage
-   11. del_attr usage
-   12. hdr_body2attrs and hdr_body2attrs2 usage
-   13. Set xlbuf_size parameter
+   1.1. set_iattr usage
+   1.2. flags2attr usage
+   1.3. set_sattr usage
+   1.4. attr_exists usage
+   1.5. attr_equals_xl usage
+   1.6. insert_attr_hf usage
+   1.7. attr_to_reply usage
+   1.8. attr_destination usage
+   1.9. xlset_destination usage
+   1.10. subst_attr usage
+   1.11. del_attr usage
+   1.12. hdr_body2attrs and hdr_body2attrs2 usage
+   1.13. Set xlbuf_size parameter
+
+Chapter 1. Admin Guide
+
+   Table of Contents
+
+   1. Overview
+   2. Functions
+
+        2.1. set_iattr(attribute,value)
+        2.2. flags2attr("$avp")
+        2.3. set_sattr(attribute,value)
+        2.4. print_attr($attribute)
+        2.5. attr2uri($attribute[,uri-part])
+        2.6. attr_exists(attribute)
+        2.7. attr_equals(attribute, value)
+        2.8. attr_equals_xl(attribute, xl_format)
+        2.9. dump_attrs()
+        2.10. xlset_attr($attribute, xl_format)
+        2.11. xlfix_attr($attribute)
+        2.12. insert_attr_hf(name)
+        2.13. insert_attr_hf(header_name, $avp_name)
+        2.14. append_attr_hf(name)
+        2.15. append_attr_hf(header_name, $avp_name)
+        2.16. replace_attr_hf(name)
+        2.17. replace_attr_hf(header_name, $avp_name)
+        2.18. attr_to_reply(name)
+        2.19. attr_to_reply(header_name, $avp_name)
+        2.20. attr_destination($avp_name)
+        2.21. xlset_destination(xl_format)
+        2.22. subst_attr($avp_name, subst_re)
+        2.23. del_attr($avp_name)
+        2.24. hdr_body2attrs(headername, prefix)
+        2.25. hdr_body2attrs2(headername, prefix)
+
+   3. Parameters
+
+        3.1. xlbuf_size (integer)
 
 1. Overview
 
-   This module contains several functions that can be used to manipulate
-   the contents of AVPs (Attribute-Value pairs). The AVPs are variables
-   attached to the SIP message being processed. Each variable has its name
-   and value. AVPs can be used to store arbitrary data or as a means of
-   inter-module communication.
+   This  module contains several functions that can be used to manipulate
+   the  contents  of AVPs (Attribute-Value pairs). The AVPs are variables
+   attached  to  the  SIP  message being processed. Each variable has its
+   name and value. AVPs can be used to store arbitrary data or as a means
+   of inter-module communication.
 
-   You may also want to check the avpops module which is more flexible and
-   contains more functions. In future Kamailio releases the avp module
-   will be probably deprecated in favor of avpops module.
+   You  may  also  want to check the avpops module which is more flexible
+   and  contains  more  functions.  In  future  Kamailio releases the avp
+   module will be probably deprecated in favor of avpops module.
 
 2. Functions
 
@@ -77,7 +152,7 @@ Michal Matyska
      * attribute - The name of the AVP to be created.
      * value - Integer value of the AVP.
 
-   Example 1. set_iattr usage
+   Example 1.1. set_iattr usage
 ...
 set_iattr("fr_inv_timer", "60")
 ...
@@ -86,7 +161,7 @@ set_iattr("fr_inv_timer", "60")
 
    Store the current state of Kamailio flags into the specified AVP.
 
-   Example 2. flags2attr usage
+   Example 1.2. flags2attr usage
 ...
 flags2attr("$msg_flags")
 ...
@@ -99,7 +174,7 @@ flags2attr("$msg_flags")
      * attribute - The name of the AVP to be created.
      * value - String value of the AVP.
 
-   Example 3. set_sattr usage
+   Example 1.3. set_sattr usage
 ...
 set_sattr("called_number", "1234")
 ...
@@ -113,31 +188,31 @@ set_sattr("called_number", "1234")
 
 2.5. attr2uri($attribute[,uri-part])
 
-   Rewrite the whole Request-URI of the message being processed with the
-   value of an AVP, or if an uri-part is specified, rewrite only that
+   Rewrite  the whole Request-URI of the message being processed with the
+   value  of  an  AVP,  or if an uri-part is specified, rewrite only that
    specific part.
 
    Meaning of the parameter is as follows:
      * $attribute - The name of the AVP.
      * uri-part - The name of the part of the uri that will be rewritten.
-       The supported values are: "prefix", "uri", "username", "user",
-       "usernamepassword", "userpass", "domain", "host", "domainport",
-       "hostport", "port", "strip", "strip_tail". "prefix" will add the
-       AVP as a prefix to the username (equivalent to prefix("string")),
-       "strip" and "strip_tail" expect a number in the AVP and they will
-       remove the specified number of characters from the beginning,
-       respective the end of the username part of the uri. The rest of the
-       uri-part values names are self-explaining.
+       The  supported  values  are:  "prefix", "uri", "username", "user",
+       "usernamepassword",  "userpass",  "domain",  "host", "domainport",
+       "hostport",  "port",  "strip", "strip_tail". "prefix" will add the
+       AVP  as a prefix to the username (equivalent to prefix("string")),
+       "strip"  and "strip_tail" expect a number in the AVP and they will
+       remove  the  specified  number  of  characters from the beginning,
+       respective  the  end  of the username part of the uri. The rest of
+       the uri-part values names are self-explaining.
 
 2.6. attr_exists(attribute)
 
-   Test for the existence of AVP with given name. The function returns 1
+   Test  for the existence of AVP with given name. The function returns 1
    if given AVP exists and -1 if not.
 
    Meaning of the parameter is as follows:
      * attribute - The name of the AVP.
 
-   Example 4. attr_exists usage
+   Example 1.4. attr_exists usage
 ...
 if (attr_exists("saved_ruri")) {
     attr2uri("saved_uri");
@@ -148,9 +223,9 @@ if (attr_exists("saved_ruri")) {
 
 2.7. attr_equals(attribute, value)
 
-   Test whether an AVP with given name and value exists. The function
-   returns 1 if the AVP with given name and value exists and -1 if not.
-   The value of the AVP is compared string-wise. The comparison is case
+   Test  whether  an  AVP  with given name and value exists. The function
+   returns  1  if the AVP with given name and value exists and -1 if not.
+   The  value  of the AVP is compared string-wise. The comparison is case
    sensitive.
 
    Meaning of the parameter is as follows:
@@ -159,20 +234,20 @@ if (attr_exists("saved_ruri")) {
 
 2.8. attr_equals_xl(attribute, xl_format)
 
-   Test whether an AVP with given name and value exists. The function
-   returns 1 if the AVP with given name and value exists and -1 if not.
-   The value of the AVP is compared string-wise to the result of xprint
+   Test  whether  an  AVP  with given name and value exists. The function
+   returns  1  if the AVP with given name and value exists and -1 if not.
+   The  value  of the AVP is compared string-wise to the result of xprint
    formatting call. The comparison is case sensitive.
 
    Meaning of the parameter is as follows:
      * attribute - The name of the AVP.
-     * xl_format - The xprint formatting string, result of which is looked
-       for in AVP.
+     * xl_format  -  The  xprint  formatting  string,  result of which is
+       looked for in AVP.
 
-   Note: You must ensure, that the xprint module is loaded to be able to
+   Note:  You must ensure, that the xprint module is loaded to be able to
    use this function.
 
-   Example 5. attr_equals_xl usage
+   Example 1.5. attr_equals_xl usage
 ...
 if (attr_equals_xl("my_avp", "%ct")) {
   # my_avp has value equal to current Contact header field
@@ -189,15 +264,15 @@ if (attr_equals_xl("my_avp", "%ct")) {
 
 2.10. xlset_attr($attribute, xl_format)
 
-   Creates new AVP identified by attribute and assigns the result string
+   Creates  new AVP identified by attribute and assigns the result string
    of xprint formatting rules as its value.
 
    Meaning of the parameter is as follows:
      * $attribute - The name of the AVP.
-     * xl_format - String used for xprint formatting. For detailed info
+     * xl_format  -  String used for xprint formatting. For detailed info
        see documentation of xprint module.
 
-   Note: You must ensure, that the xprint module is loaded to be able to
+   Note:  You must ensure, that the xprint module is loaded to be able to
    use this function.
 
 2.11. xlfix_attr($attribute)
@@ -209,33 +284,33 @@ if (attr_equals_xl("my_avp", "%ct")) {
 
 2.12. insert_attr_hf(name)
 
-   Inserts new header into the request, which is beeing forwarded. The AVP
-   name is the name of the header field. If you need to insert header with
-   name which differs from the AVP name use insert_attr_hf(header_name,
-   $avp_name) instead.
+   Inserts  new  header  into the request, which is beeing forwarded. The
+   AVP name is the name of the header field. If you need to insert header
+   with     name    which    differs    from    the    AVP    name    use
+   insert_attr_hf(header_name, $avp_name) instead.
 
-   Inserting means putting the header to the beginning of the request,
+   Inserting  means  putting  the header to the beginning of the request,
    before any others.
 
    Meaning of the parameter is as follows:
-     * name - The name of the header field which is inserted into
-       forwarded request as well as name of AVP which's value is put as
+     * name  -  The  name  of  the  header  field  which is inserted into
+       forwarded  request  as well as name of AVP which's value is put as
        the header field value.
 
 2.13. insert_attr_hf(header_name, $avp_name)
 
    Inserts new header into the request, which is beeing forwarded.
 
-   Inserting means putting the header to the beginning of the request,
+   Inserting  means  putting  the header to the beginning of the request,
    before any others.
 
    Meaning of the parameter is as follows:
-     * header_name - The name of the header field which is inserted into
+     * header_name  - The name of the header field which is inserted into
        forwarded request.
-     * $avp_name - The name of AVP which's value is put as the header
+     * $avp_name  -  The  name  of AVP which's value is put as the header
        field value.
 
-   Example 6. insert_attr_hf usage
+   Example 1.6. insert_attr_hf usage
 ...
 set_sattr("my_route","<sip:user@host:port;lr>");
 insert_attr_hf("Route", "$my_route");
@@ -243,86 +318,87 @@ insert_attr_hf("Route", "$my_route");
 
 2.14. append_attr_hf(name)
 
-   Appends new header into the request, which is beeing forwarded. The AVP
-   name is the name of the header field. If you need to append header with
-   name which differs from the AVP name use append_attr_hf(header_name,
-   $avp_name) instead.
+   Appends  new  header  into the request, which is beeing forwarded. The
+   AVP name is the name of the header field. If you need to append header
+   with     name    which    differs    from    the    AVP    name    use
+   append_attr_hf(header_name, $avp_name) instead.
 
-   Appending means putting the header to the end of the request, after any
-   others.
+   Appending  means  putting  the header to the end of the request, after
+   any others.
 
    Meaning of the parameter is as follows:
-     * name - The name of the header field which is appended into
-       forwarded request as well as name of AVP which's value is put as
+     * name  -  The  name  of  the  header  field  which is appended into
+       forwarded  request  as well as name of AVP which's value is put as
        the header field value.
 
 2.15. append_attr_hf(header_name, $avp_name)
 
    Appends new header into the request, which is beeing forwarded.
 
-   Appending means putting the header to the end of the request, after any
-   others.
+   Appending  means  putting  the header to the end of the request, after
+   any others.
 
    Meaning of the parameter is as follows:
-     * header_name - The name of the header field which is appended into
+     * header_name  - The name of the header field which is appended into
        forwarded request.
-     * $avp_name - The name of AVP which's value is put as the header
+     * $avp_name  -  The  name  of AVP which's value is put as the header
        field value.
 
 2.16. replace_attr_hf(name)
 
-   Replaces header in the request, which is beeing forwarded. The AVP name
-   is the same as the name of the header field. If you need to replace
-   header with name which differs from the AVP name use
+   Replaces  header  in  the  request, which is beeing forwarded. The AVP
+   name  is  the  same  as  the  name of the header field. If you need to
+   replace  header  with  name  which  differs  from  the  AVP  name  use
    replace_attr_hf(header_name, $avp_name) instead.
 
-   Replacing means removing all the headers with specified name and
+   Replacing  means  removing  all  the  headers  with specified name and
    appending new one at the end, with the value from AVP.
 
    Meaning of the parameter is as follows:
      * name - The name of the header field which is replaced in forwarded
-       request as well as name of AVP which's value is put as the header
+       request  as well as name of AVP which's value is put as the header
        field value.
 
 2.17. replace_attr_hf(header_name, $avp_name)
 
    Replaces header in the request, which is beeing forwarded.
 
-   Replacing means removing all the headers with specified name and
+   Replacing  means  removing  all  the  headers  with specified name and
    appending new one at the end, with the value from AVP.
 
    Meaning of the parameter is as follows:
-     * header_name - The name of the header field which is replaced in
+     * header_name  -  The  name of the header field which is replaced in
        forwarded request.
-     * $avp_name - The name of AVP which's value is put as the header
+     * $avp_name  -  The  name  of AVP which's value is put as the header
        field value.
 
 2.18. attr_to_reply(name)
 
-   Appends new header into the reply at the request time processing. The
+   Appends  new header into the reply at the request time processing. The
    AVP name is the name of the header field. If you need to append header
-   with name which differs from the AVP name use
+   with     name    which    differs    from    the    AVP    name    use
    attr_to_reply(header_name, $avp_name) instead.
 
-   If you need to append headers during reply processing you can use
+   If  you  need  to  append  headers during reply processing you can use
    insert_attr_hf and append_attr_hf. This function stores data and waits
    for the reply being created.
 
    Meaning of the parameter is as follows:
-     * name - The name of the header field which is appended into reply as
-       well as name of AVP which's value is put as the header field value.
+     * name  -  The name of the header field which is appended into reply
+       as  well  as  name of AVP which's value is put as the header field
+       value.
 
 2.19. attr_to_reply(header_name, $avp_name)
 
    Appends new header into the reply at the request time processing.
 
    Meaning of the parameter is as follows:
-     * header_name - The name of the header field which is appended into
+     * header_name  - The name of the header field which is appended into
        reply.
-     * $avp_name - The name of AVP which's value is put as the header
+     * $avp_name  -  The  name  of AVP which's value is put as the header
        field value.
 
-   Example 7. attr_to_reply usage
+   Example 1.7. attr_to_reply usage
 ...
 xlset_attr("$my_route","<sip:%Hf:5080;lr>";
 attr_to_reply("P-Hint-Route", "my_route");
@@ -330,15 +406,15 @@ attr_to_reply("P-Hint-Route", "my_route");
 
 2.20. attr_destination($avp_name)
 
-   Sets the destination of the forwarded request to the value of AVP,
-   which must be either a SIP URI or a string in nameaddr format (e.g.
+   Sets  the  destination  of  the forwarded request to the value of AVP,
+   which  must  be  either a SIP URI or a string in nameaddr format (e.g.
    "Foo Bar" <sip:uri>).
 
    Meaning of the parameter is as follows:
-     * $avp_name - The name of AVP which's value is used for further
+     * $avp_name  -  The  name  of  AVP which's value is used for further
        request forwarding.
 
-   Example 8. attr_destination usage
+   Example 1.8. attr_destination usage
 ...
 xlset_attr("$my_route","<sip:%<next_host>:%<next_port>;myparam=a123;lr>");
 insert_attr_hf("Route", "$my_route");
@@ -348,17 +424,18 @@ t_relay();
 
 2.21. xlset_destination(xl_format)
 
-   Sets the destination of the forwarded request to the value of result of
-   xprint formatted string. Either SIP URI or nameaddr format is allowed.
+   Sets  the  destination of the forwarded request to the value of result
+   of  xprint  formatted  string.  Either  SIP  URI or nameaddr format is
+   allowed.
 
    Meaning of the parameter is as follows:
-     * xl_format - xprint module formatting string, the result is used for
-       request forwarding.
+     * xl_format  -  xprint  module formatting string, the result is used
+       for request forwarding.
 
-   Note: You must ensure, that the xprint module is loaded to be able to
+   Note:  You must ensure, that the xprint module is loaded to be able to
    use this function.
 
-   Example 9. xlset_destination usage
+   Example 1.9. xlset_destination usage
 ...
 xlset_destination("%<next_host>:%<next_port>");
 t_relay();
@@ -366,16 +443,16 @@ t_relay();
 
 2.22. subst_attr($avp_name, subst_re)
 
-   The value of the AVP identified by $avp_name name is matched and
-   substitued according to the subst_re sed like expression. Result of the
-   substitution is then stored in the original AVP.
+   The  value  of  the  AVP  identified  by $avp_name name is matched and
+   substitued  according  to  the subst_re sed like expression. Result of
+   the substitution is then stored in the original AVP.
 
    Meaning of the parameter is as follows:
-     * $avp_name - Name of the AVP which will be used for the
+     * $avp_name   -  Name  of  the  AVP  which  will  be  used  for  the
        substitution.
      * subst_re - SED like match&replace regullar expression.
 
-   Example 10. subst_attr usage
+   Example 1.10. subst_attr usage
 ...
 subst_attr("$uri","/tel:[0-9]*/sip:\[email protected];user=phone/");
 ...
@@ -387,7 +464,7 @@ subst_attr("$uri","/tel:[0-9]*/sip:\[email protected];user=phone/");
    Meaning of the parameter is as follows:
      * $avp_name - Name of the AVP which will be deleted.
 
-   Example 11. del_attr usage
+   Example 1.11. del_attr usage
 ...
 failure_route[1] {
         if (status=~4[0-9][0-9]) {
@@ -402,48 +479,48 @@ failure_route[1] {
 
 2.24. hdr_body2attrs(headername, prefix)
 
-   Function parses a header body content scans for fld1=val1,fld2=val2,...
-   and creates bunch of avps prefixfld1:= val1, prefixfld2:= val2, .... If
-   possible stores values as integers.
+   Function     parses     a    header    body    content    scans    for
+   fld1=val1,fld2=val2,...  and  creates bunch of avps prefixfld1:= val1,
+   prefixfld2:= val2, .... If possible stores values as integers.
 
    Meaning of the parameter is as follows:
-     * headername - The header name, which will be scanned for the
+     * headername  -  The  header  name,  which  will  be scanned for the
        name=value pairs.
-       If you want to create only AVPs with integer value use "/i" postfix
-       to the header name.
+       If  you  want  to  create  only  AVPs  with integer value use "/i"
+       postfix to the header name.
        If you want to create only AVPs with string value use "/s" postfix
        to the header name.
-     * prefix - The prefix, which is added before the name parsed from the
-       header body.
+     * prefix  -  The  prefix, which is added before the name parsed from
+       the header body.
 
 2.25. hdr_body2attrs2(headername, prefix)
 
-   Function parses a header body content scans for
-   fld1=val1,val2;fld2=val3,... and creates bunch of avps prefixfld1#1:=
-   val1, prefixfld1#2:= val2, prefixfld2:=val3 .... If possible stores
+   Function     parses     a    header    body    content    scans    for
+   fld1=val1,val2;fld2=val3,...  and creates bunch of avps prefixfld1#1:=
+   val1,  prefixfld1#2:=  val2,  prefixfld2:=val3 .... If possible stores
    values as integers.
 
    Meaning of the parameter is as follows:
-     * headername - The header name, which will be scanned for the
+     * headername  -  The  header  name,  which  will  be scanned for the
        name=value pairs.
-       If you want to create only AVPs with integer value use "/i" postfix
-       to the header name.
+       If  you  want  to  create  only  AVPs  with integer value use "/i"
+       postfix to the header name.
        If you want to create only AVPs with string value use "/s" postfix
        to the header name.
-     * prefix - The prefix, which is added before the name parsed from the
-       header body.
+     * prefix  -  The  prefix, which is added before the name parsed from
+       the header body.
 
-   Example 12. hdr_body2attrs and hdr_body2attrs2 usage
+   Example 1.12. hdr_body2attrs and hdr_body2attrs2 usage
 if (method=="BYE") {
         # QoS reporting
         if (search("^User-Agent: AVM FRITZ!Box Fon*")) {
                 hdr_body2attrs2("X-RTP-Stat/i", "QoS_");
-                xplog("L_INFO", "QoS: %Ts, %fu, %tu, %ci, %{User-Agent}, %{X-RTP
--Stat}\n");
+                xplog("L_INFO", "QoS: %Ts, %fu, %tu, %ci, %{User-Agent}, %{X-RT
+P-Stat}\n");
         } else if (search("^User-Agent: Sipura/*")) {
                 hdr_body2attrs("P-RTP-Stat/i", "QoS_");
-                xplog("L_INFO", "QoS: %Ts, %fu, %tu, %ci, %{User-Agent}, %{P-RTP
--Stat}\n");
+                xplog("L_INFO", "QoS: %Ts, %fu, %tu, %ci, %{User-Agent}, %{P-RT
+P-Stat}\n");
         }
 }
 # AVP QoS_xx now contain the values from appropriate header
@@ -455,14 +532,14 @@ if (method=="BYE") {
 
 3.1. xlbuf_size (integer)
 
-   Defines size of internal buffer for all xprint formatting calls. If you
-   don't use xprint formatting calls, you can set it to 0 to preserve some
-   memory, if you get errors while formatting due to buffer size, you can
-   enlarge it.
+   Defines  size  of  internal buffer for all xprint formatting calls. If
+   you don't use xprint formatting calls, you can set it to 0 to preserve
+   some  memory,  if  you get errors while formatting due to buffer size,
+   you can enlarge it.
 
    Default value is 256.
 
-   Example 13. Set xlbuf_size parameter
+   Example 1.13. Set xlbuf_size parameter
 ...
 modparam("avp", "xlbuf_size", 1024)
 ...

+ 72 - 39
modules/blst/README

@@ -1,3 +1,4 @@
+
 Blst Module - Blacklist Management
 
 Andrei Pelinescu-Onciul
@@ -5,16 +6,48 @@ Andrei Pelinescu-Onciul
    iptelorg GmbH
 
    Copyright © 2007 iptelorg GmbH
-     __________________________________________________________________
+     _________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+        2. Functions
+
+              2.1. blst_add([timeout]) 
+              2.2. blst_add_retry_after(min, max) 
+              2.3. blst_del() 
+              2.4. blst_is_blacklisted() 
+              2.5. blst_set_ignore([flags]) 
+              2.6. blst_rpl_set_ignore([flags]) 
+              2.7. blst_clear_ignore([flags]) 
+              2.8. blst_rpl_clear_ignore([flags]) 
 
    List of Examples
 
-   1. blst_add usage
-   2. blst_add_retry_after usage
-   3. blst_del usage
-   4. blst_is_blacklisted usage
-   5. blst_set_ignore usage
-   6. blst_clear_ignore usage
+   1.1. blst_add usage
+   1.2. blst_add_retry_after usage
+   1.3. blst_del usage
+   1.4. blst_is_blacklisted usage
+   1.5. blst_set_ignore usage
+   1.6. blst_clear_ignore usage
+
+Chapter 1. Admin Guide
+
+   Table of Contents
+
+   1. Overview
+   2. Functions
+
+        2.1. blst_add([timeout]) 
+        2.2. blst_add_retry_after(min, max) 
+        2.3. blst_del() 
+        2.4. blst_is_blacklisted() 
+        2.5. blst_set_ignore([flags]) 
+        2.6. blst_rpl_set_ignore([flags]) 
+        2.7. blst_clear_ignore([flags]) 
+        2.8. blst_rpl_clear_ignore([flags]) 
 
 1. Overview
 
@@ -22,22 +55,22 @@ Andrei Pelinescu-Onciul
 
 2. Functions
 
-   2.1. blst_add([timeout])
-   2.2. blst_add_retry_after(min, max)
-   2.3. blst_del()
-   2.4. blst_is_blacklisted()
-   2.5. blst_set_ignore([flags])
-   2.6. blst_rpl_set_ignore([flags])
-   2.7. blst_clear_ignore([flags])
-   2.8. blst_rpl_clear_ignore([flags])
+   2.1. blst_add([timeout]) 
+   2.2. blst_add_retry_after(min, max) 
+   2.3. blst_del() 
+   2.4. blst_is_blacklisted() 
+   2.5. blst_set_ignore([flags]) 
+   2.6. blst_rpl_set_ignore([flags]) 
+   2.7. blst_clear_ignore([flags]) 
+   2.8. blst_rpl_clear_ignore([flags]) 
 
 2.1.  blst_add([timeout])
 
-   Adds the source of the current message to the blacklist for timeout
-   seconds. If timeout is missing or 0 it uses the default blacklist
+   Adds  the  source  of the current message to the blacklist for timeout
+   seconds.  If  timeout  is  missing  or 0 it uses the default blacklist
    timeout (dst_blacklist_expire).
 
-   Example 1. blst_add usage
+   Example 1.1. blst_add usage
 ...
 if (src_ip==10.0.0.0/9)
     blst_add(30); # 30 s
@@ -47,14 +80,14 @@ else
 
 2.2.  blst_add_retry_after(min, max)
 
-   Adds the source of the current message to the blacklist for the time
-   interval specified in the Retry-After header. If the Retry-After header
-   is missing, it will fail (returns false). If the Retry-After value is
-   less than min, then min seconds will be used instead. If the
-   Retry-After value is greater than max, then max seconds will be used
+   Adds  the  source of the current message to the blacklist for the time
+   interval  specified  in  the  Retry-After  header.  If the Retry-After
+   header  is  missing,  it will fail (returns false). If the Retry-After
+   value  is less than min, then min seconds will be used instead. If the
+   Retry-After  value  is greater than max, then max seconds will be used
    instead.
 
-   Example 2. blst_add_retry_after usage
+   Example 1.2. blst_add_retry_after usage
 ...
 # on_reply route
 if (msg_status==503){ # blacklist 503 source for Retry-After seconds
@@ -65,11 +98,11 @@ if (msg_status==503){ # blacklist 503 source for Retry-After seconds
 
 2.3.  blst_del()
 
-   Removes the source of the current message from the blacklist. If the
-   address is not present in the blacklist at the time of the call it
+   Removes  the  source of the current message from the blacklist. If the
+   address  is  not  present  in the blacklist at the time of the call it
    returns false.
 
-   Example 3. blst_del usage
+   Example 1.3. blst_del usage
 ...
     blst_del();
 ...
@@ -78,7 +111,7 @@ if (msg_status==503){ # blacklist 503 source for Retry-After seconds
 
    Returns true if the source of the current message is blacklisted.
 
-   Example 4. blst_is_blacklisted usage
+   Example 1.4. blst_is_blacklisted usage
 ...
     if (blst_is_blacklisted()){
         log("message from a blacklisted source");
@@ -88,24 +121,24 @@ if (msg_status==503){ # blacklist 503 source for Retry-After seconds
 
 2.5.  blst_set_ignore([flags])
 
-   Set errors that will not be taken into account when deciding whether to
-   blacklist a destination for the current message or a local reply to the
-   current message.
+   Set  errors  that will not be taken into account when deciding whether
+   to blacklist a destination for the current message or a local reply to
+   the current message.
 
-   blst_set_ignore(..) works for forwarding the current message and
-   blst_rpl_set_ignore(...) works for local replies to the current
+   blst_set_ignore(..)  works  for  forwarding  the  current  message and
+   blst_rpl_set_ignore(...)  works  for  local  replies  to  the  current
    message.
 
-   The variants of these functions with no parameters will ignore
+   The  variants  of  these  functions  with  no  parameters  will ignore
    everything (equivalent to passing 0xff).
 
-   The flags are stored internally as a bitmask, and are applied by
+   The  flags  are  stored  internally  as  a bitmask, and are applied by
    bitwise ANDing them together. The following flags are available:
      * 0x02 - generic send error (send denied/ failed).
      * 0x04 - connect failed (TCP, TLS or SCTP).
      * 0x08 - ICMP error (not currently used).
      * 0x10 - SIP transaction timeout.
-     * 0x20 - 503 reply (statefull mode only). For more details see
+     * 0x20  -  503  reply  (statefull  mode  only). For more details see
        tmblst_503.
 
 Note
@@ -114,7 +147,7 @@ Note
    per message. The connection blacklist ignore flags are inherithed from
    the message that caused the connection establishment.
 
-   Example 5. blst_set_ignore usage
+   Example 1.5. blst_set_ignore usage
     blst_set_ignore(6); # ignore send and connect errors
 
 2.6.  blst_rpl_set_ignore([flags])
@@ -123,12 +156,12 @@ Note
 
 2.7.  blst_clear_ignore([flags])
 
-   Clears blacklist ignore flags previously set by the corresponding
+   Clears  blacklist  ignore  flags  previously  set by the corresponding
    blst_set_ignore(...) or blst_rpl_set_ignore(...) functions.
 
    See also blst_set_ignore.
 
-   Example 6. blst_clear_ignore usage
+   Example 1.6. blst_clear_ignore usage
     blst_clear_ignore(4); # ignore connect errors
 
 2.8.  blst_rpl_clear_ignore([flags])

+ 67 - 38
modules/cfg_db/README

@@ -1,3 +1,4 @@
+
 The configuration database module - cfg_db
 
 Tomas Mandys
@@ -5,40 +6,68 @@ Tomas Mandys
    Iptel.org
 
    Copyright © 2008 Tomas Mandys
-     __________________________________________________________________
+     _________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+        2. Dependencies
+        3. Parameters
+
+              3.1. db_url (string)
+              3.2. transl_tbl (string) := "cfg_transl"
+              3.3. custom_tbl (string) := "cfg_custom"
+
+        4. Examples
 
    List of Examples
 
-   1. Example db_url
-   2. Content of tables
+   1.1. Example db_url
+   1.2. Content of tables
+
+Chapter 1. Admin Guide
+
+   Table of Contents
+
+   1. Overview
+   2. Dependencies
+   3. Parameters
+
+        3.1. db_url (string)
+        3.2. transl_tbl (string) := "cfg_transl"
+        3.3. custom_tbl (string) := "cfg_custom"
+
+   4. Examples
 
 1. Overview
 
-   The module implements a database driver for the configuration
-   parameters API. When configuration parameters are being declared
-   (typically when starting) API then driver is notified and has chance to
-   set value (of any parameter) based on value taken from database. It's
-   primarily targeted for interfacing with 3rd party software which is
-   aware of the Kamailio configuration.
-
-   A parameter is uniquely identified by a group_name plus a name, which
-   is used by the driver to check if a value can be found. Because
-   configuration parameters may be spread in many tables, a translation
-   table is used to indicate where to start searching. Multiple look-up
+   The   module  implements  a  database  driver  for  the  configuration
+   parameters  API.  When  configuration  parameters  are  being declared
+   (typically  when  starting) API then driver is notified and has chance
+   to  set  value  (of any parameter) based on value taken from database.
+   It's  primarily targeted for interfacing with 3rd party software which
+   is aware of the Kamailio configuration.
+
+   A  parameter is uniquely identified by a group_name plus a name, which
+   is  used  by  the  driver  to  check  if a value can be found. Because
+   configuration  parameters  may be spread in many tables, a translation
+   table  is  used to indicate where to start searching. Multiple look-up
    tables may be defined for single parameter, tables are searched in the
    first round by exact match until parameter is found, all tables listed
-   with wildcard (asterisk) in group name are searched in the second
+   with  wildcard  (asterisk)  in  group  name are searched in the second
    round. If a parameter is not found then its value is left unchanged.
 
-   Configuration parameters are normally declared in C code and this
+   Configuration  parameters  are  normally  declared  in C code and this
    module additionally supports also declaring custom parameters in extra
-   table. Such parameters may be used typically in script only. All
-   parameters listed in the table are declared in the first step, values
-   are initialized in the second step using the same procedure as C-code
+   table.  Such  parameters  may  be  used  typically in script only. All
+   parameters  listed in the table are declared in the first step, values
+   are  initialized in the second step using the same procedure as C-code
    parameters.
 
-   The module does not reflect changes made in parameters when SER is
-   running. It just declares variables and assigns values when SER is
+   The  module  does  not  reflect changes made in parameters when SER is
+   running.  It  just  declares  variables and assigns values when SER is
    starting. That's all.
 
 2. Dependencies
@@ -58,7 +87,7 @@ Tomas Mandys
    The format is:
                 db_url = database
 
-   Example 1. Example db_url
+   Example 1.1. Example db_url
 loadmodule("mysql.so");
 loadmodule("cfg_db.so");
 ...
@@ -67,33 +96,33 @@ modparam("cfg_db", "db_url", "mysql://SER:[email protected]:12345/SER");
 
 3.2. transl_tbl (string) := "cfg_transl"
 
-   Name of table used for pointing group_name+name into configuration
-   table. If empty/null field values are found then default values will be
-   used. The default values are declared in record having group_name
-   called <default>. The C-code "absolutely" default values ("cfg_var",
-   "group_name", "name", "value"). The other keyword is asterisk * which
-   matches all parameters and will be used if parameter is not explicitely
-   mentioned.
+   Name  of  table  used  for pointing group_name+name into configuration
+   table.  If  empty/null field values are found then default values will
+   be  used.  The default values are declared in record having group_name
+   called  <default>.  The C-code "absolutely" default values ("cfg_var",
+   "group_name",  "name", "value"). The other keyword is asterisk * which
+   matches   all  parameters  and  will  be  used  if  parameter  is  not
+   explicitely mentioned.
 
 3.3. custom_tbl (string) := "cfg_custom"
 
-   Name of table used for extra param declaration (group_name, name, type,
-   min/max value, description).
+   Name  of  table  used  for  extra param declaration (group_name, name,
+   type, min/max value, description).
 
 4. Examples
 
-   Example 2. Content of tables
+   Example 1.2. Content of tables
         cfg_transl table:
-        group_name|name|cfg_table|cfg_table_group_name_field|cfg_table_name_fiel
-d|cfg_table_value_field
+        group_name|name|cfg_table|cfg_table_group_name_field|cfg_table_name_fie
+ld|cfg_table_value_field
         core|use_dst_blacklist|cfg_dns|||
         core|dst_blacklist_mem|cfg_dns|||
         core|dst_blacklist_expire|||
-        my|route_addr|cfg_my|my_group_name|my_name|my_value     ; overrides <def
-ault> values
+        my|route_addr|cfg_my|my_group_name|my_name|my_value     ; overrides <de
+fault> values
         my|use_rtp_proxy|cfg_my|my_group_name|my_name|my_value
-        *|*|||| ; matches all param ids, points to tables defined in row <defaul
-t>
+        *|*|||| ; matches all param ids, points to tables defined in row <defau
+lt>
         <default>||cfg_var|group_name|name|value  ; default cfg_table* values
 
         cfg_custom table:

+ 173 - 108
modules/cfg_rpc/README

@@ -1,195 +1,260 @@
-1. cfg_rpc Module
+
+cfg_rpc Module
 
 Miklos Tirpak
 
    <[email protected]>
 
    Copyright © 2007 iptelorg GmbH
-     __________________________________________________________________
-
-   1.1. Overview
-   1.2. Dependencies
-
-        1.2.1. SIP Router Modules
-        1.2.2. External Libraries or Applications
-
-   1.3. RPC Interface
-
-        1.3.1. cfg.list
-        1.3.2. cfg.get
-        1.3.3. cfg.seti
-        1.3.4. cfg.set_now_int
-        1.3.5. cfg.sets
-        1.3.6. cfg.set_now_string
-        1.3.7. cfg.set
-        1.3.8. cfg.del
-        1.3.9. cfg.set_delayed_int
-        1.3.10. cfg.set_delayed_string
-        1.3.11. cfg.set_delayed
-        1.3.12. cfg.del_delayed
-        1.3.13. cfg.commit
-        1.3.14. cfg.rollback
-        1.3.15. cfg.help
-        1.3.16. cfg.diff
-        1.3.17. cfg.add_group_inst
-        1.3.18. cfg.del_group_inst
-
-1.1. Overview
-
-   The module implements RPC commands to set and get configuration
-   variables on-the-fly, that are declared by SIP Router core and by the
+     _________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+        2. Dependencies
+
+              2.1. SIP Router Modules
+              2.2. External Libraries or Applications
+
+        3. RPC Interface
+
+              3.1. cfg.list
+              3.2. cfg.get
+              3.3. cfg.seti
+              3.4. cfg.set_now_int
+              3.5. cfg.sets
+              3.6. cfg.set_now_string
+              3.7. cfg.set
+              3.8. cfg.del
+              3.9. cfg.set_delayed_int
+              3.10. cfg.set_delayed_string
+              3.11. cfg.set_delayed
+              3.12. cfg.del_delayed
+              3.13. cfg.commit
+              3.14. cfg.rollback
+              3.15. cfg.help
+              3.16. cfg.diff
+              3.17. cfg.add_group_inst
+              3.18. cfg.del_group_inst
+
+   List of Examples
+
+   1.1. Use cfg.get RPC command
+   1.2. Use cfg.get RPC command
+   1.3. Use cfg.seti RPC command
+
+Chapter 1. Admin Guide
+
+   Table of Contents
+
+   1. Overview
+   2. Dependencies
+
+        2.1. SIP Router Modules
+        2.2. External Libraries or Applications
+
+   3. RPC Interface
+
+        3.1. cfg.list
+        3.2. cfg.get
+        3.3. cfg.seti
+        3.4. cfg.set_now_int
+        3.5. cfg.sets
+        3.6. cfg.set_now_string
+        3.7. cfg.set
+        3.8. cfg.del
+        3.9. cfg.set_delayed_int
+        3.10. cfg.set_delayed_string
+        3.11. cfg.set_delayed
+        3.12. cfg.del_delayed
+        3.13. cfg.commit
+        3.14. cfg.rollback
+        3.15. cfg.help
+        3.16. cfg.diff
+        3.17. cfg.add_group_inst
+        3.18. cfg.del_group_inst
+
+1. Overview
+
+   The  module  implements  RPC  commands  to  set  and get configuration
+   variables  on-the-fly, that are declared by SIP Router core and by the
    modules.
 
-   For example, it can be used to fine-tune values for global parameters
-   such as debug, tcp/sctp/dns attributes, a.s.o. without the need of
+   For  example, it can be used to fine-tune values for global parameters
+   such  as  debug,  tcp/sctp/dns  attributes, a.s.o. without the need of
    restart.
 
-   RPC connector modules, such as "ctl" or "xmlrpc", although not a
-   dependecy, should be loaded in order to execute the RPC commands
-   exported by this module. When ctl module is loaded, the tool 'kamcmd'
+   RPC  connector  modules,  such  as  "ctl"  or "xmlrpc", although not a
+   dependecy,  should  be  loaded  in  order  to execute the RPC commands
+   exported  by this module. When ctl module is loaded, the tool 'kamcmd'
    can be used to execute the RPC commands implemented in this module.
 
-1.2. Dependencies
+2. Dependencies
+
+   2.1. SIP Router Modules
+   2.2. External Libraries or Applications
 
-1.2.1. SIP Router Modules
+2.1. SIP Router Modules
 
    The following modules must be loaded before this module:
      * No dependencies on other SIP Router modules.
 
-1.2.2. External Libraries or Applications
+2.2. External Libraries or Applications
 
-   The following libraries or applications must be installed before
+   The  following  libraries  or  applications  must  be installed before
    running SIP Router with this module loaded:
      * None.
 
-1.3. RPC Interface
-
-   The module implements the RPC commands documented in the next sections.
-
-1.3.1. cfg.list
-
-   cfg.list - List the configuration variables. The function has one
+3. RPC Interface
+
+   3.1. cfg.list
+   3.2. cfg.get
+   3.3. cfg.seti
+   3.4. cfg.set_now_int
+   3.5. cfg.sets
+   3.6. cfg.set_now_string
+   3.7. cfg.set
+   3.8. cfg.del
+   3.9. cfg.set_delayed_int
+   3.10. cfg.set_delayed_string
+   3.11. cfg.set_delayed
+   3.12. cfg.del_delayed
+   3.13. cfg.commit
+   3.14. cfg.rollback
+   3.15. cfg.help
+   3.16. cfg.diff
+   3.17. cfg.add_group_inst
+   3.18. cfg.del_group_inst
+
+   The  module  implements  the  RPC  commands  documented  in  the  next
+   sections.
+
+3.1. cfg.list
+
+   cfg.list  -  List  the  configuration  variables. The function has one
    optional parameter: group name.
 
-   Example 1. Use cfg.get RPC command
+   Example 1.1. Use cfg.get RPC command
 ...
 # kamcmd cfg.list
 ...
 
-1.3.2. cfg.get
+3.2. cfg.get
 
-   cfg.get - Get the value of a configuration variable. The function
-   accepts two parameters: group name, variable name. The group name can
+   cfg.get  -  Get  the  value  of a configuration variable. The function
+   accepts  two parameters: group name, variable name. The group name can
    optionally contain the group instance id, for example foo[5].
 
-   Example 2. Use cfg.get RPC command
+   Example 1.2. Use cfg.get RPC command
 ...
 # kamcmd cfg.get core debug
 ...
 
-1.3.3. cfg.seti
+3.3. cfg.seti
 
-   cfg.seti - Set the value of a configuration variable and commit the
+   cfg.seti  -  Set  the value of a configuration variable and commit the
    change immediately. The function accepts three parameters: group name,
-   variable name, integer value. The group name can optionally contain the
-   group instance id, for example foo[5].
+   variable  name,  integer  value. The group name can optionally contain
+   the group instance id, for example foo[5].
 
-   Example 3. Use cfg.seti RPC command
+   Example 1.3. Use cfg.seti RPC command
 ...
 # kamcmd cfg.seti core debug 1
 ...
 
-1.3.4. cfg.set_now_int
+3.4. cfg.set_now_int
 
    cfg.set_now_int - This is an alias to the command cfg.seti.
 
-1.3.5. cfg.sets
+3.5. cfg.sets
 
-   cfg.sets - Set the value of a configuration variable and commit the
+   cfg.sets  -  Set  the value of a configuration variable and commit the
    change immediately. The function accepts three parameters: group name,
    variable name, string value. The group name can optionally contain the
    group instance id, for example foo[5].
 
-1.3.6. cfg.set_now_string
+3.6. cfg.set_now_string
 
    cfg.set_now_string - This is an alias to the command cfg.sets.
 
-1.3.7. cfg.set
+3.7. cfg.set
 
-   cfg.set - Set the value of a configuration variable and commit the
-   change immediately. This is a wrapper command for cfg.set_now_int and
-   cfg.set_now_string depending on the type of the value provided. The
-   function accepts three parameters: group name, variable name,
-   int/string value. The group name can optionally contain the group
+   cfg.set  -  Set  the  value of a configuration variable and commit the
+   change  immediately. This is a wrapper command for cfg.set_now_int and
+   cfg.set_now_string  depending  on  the type of the value provided. The
+   function   accepts   three  parameters:  group  name,  variable  name,
+   int/string  value.  The  group  name  can optionally contain the group
    instance id, for example foo[5].
 
-1.3.8. cfg.del
+3.8. cfg.del
 
-   cfg.del - Delete the value of a configuration variable from a group
-   instance and commit the change immediately. The value is reset to the
+   cfg.del  -  Delete  the value of a configuration variable from a group
+   instance  and commit the change immediately. The value is reset to the
    default value and it follows the changes of that. The function accepts
    two parameters: group name, variable name. The group name must contain
    the group instance id, for example foo[5].
 
-1.3.9. cfg.set_delayed_int
+3.9. cfg.set_delayed_int
 
-   cfg.set_delayed_int - Prepare the change of a configuration variable,
-   but does not commit the new value yet. The function accepts three
-   parameters: group name, variable name, integer value. The group name
+   cfg.set_delayed_int  - Prepare the change of a configuration variable,
+   but  does  not  commit  the  new value yet. The function accepts three
+   parameters:  group  name, variable name, integer value. The group name
    can optionally contain the group instance id, for example foo[5].
 
-1.3.10. cfg.set_delayed_string
+3.10. cfg.set_delayed_string
 
-   cfg.set_delayed_string - Prepare the change of a configuration
-   variable, but does not commit the new value yet. The function accepts
-   three parameters: group name, variable name, string value. The group
+   cfg.set_delayed_string   -  Prepare  the  change  of  a  configuration
+   variable,  but does not commit the new value yet. The function accepts
+   three  parameters:  group name, variable name, string value. The group
    name can optionally contain the group instance id, for example foo[5].
 
-1.3.11. cfg.set_delayed
+3.11. cfg.set_delayed
 
-   cfg.set_delayed - Prepare the change of a configuration variable, but
-   does not commit the new value yet. This is a wrapper command for
-   cfg.set_delayed_int and cfg.set_delayed_string depending on the type of
-   the value provided. The function accepts three parameters: group name,
-   variable name, int/string value. The group name can optionally contain
-   the group instance id, for example foo[5].
+   cfg.set_delayed  - Prepare the change of a configuration variable, but
+   does  not  commit  the  new  value  yet. This is a wrapper command for
+   cfg.set_delayed_int  and  cfg.set_delayed_string depending on the type
+   of  the  value  provided. The function accepts three parameters: group
+   name,  variable  name, int/string value. The group name can optionally
+   contain the group instance id, for example foo[5].
 
-1.3.12. cfg.del_delayed
+3.12. cfg.del_delayed
 
    cfg.del_delayed - Prepare the deletion of the value of a configuration
-   variable from a group instance, but does not commit the change yet. The
-   value is reset to the default value and it follows the changes of that.
-   The function accepts two parameters: group name, variable name. The
-   group name must contain the group instance id, for example foo[5].
+   variable  from  a  group instance, but does not commit the change yet.
+   The  value is reset to the default value and it follows the changes of
+   that.  The function accepts two parameters: group name, variable name.
+   The group name must contain the group instance id, for example foo[5].
 
-1.3.13. cfg.commit
+3.13. cfg.commit
 
    cfg.commit - Commit the previously prepared configuration changes. The
    function does not have any parameters.
 
-1.3.14. cfg.rollback
+3.14. cfg.rollback
 
-   cfg.rollback - Drop the prepared configuration changes. The function
+   cfg.rollback  -  Drop the prepared configuration changes. The function
    does not have any parameters.
 
-1.3.15. cfg.help
+3.15. cfg.help
 
-   cfg.help - Print the description of a configuration variable. The
+   cfg.help  -  Print  the  description  of a configuration variable. The
    function accepts two parameters: group name, variable name.
 
-1.3.16. cfg.diff
+3.16. cfg.diff
 
-   cfg.diff - List the pending configuration changes that have not been
+   cfg.diff  -  List the pending configuration changes that have not been
    committed yet. The function does not have any parameters.
 
-1.3.17. cfg.add_group_inst
+3.17. cfg.add_group_inst
 
-   cfg.add_group_inst - Add a new instance to an existing configuration
-   group. The function accepts one parameter: group name[instance id], for
-   example foo[5].
+   cfg.add_group_inst  -  Add a new instance to an existing configuration
+   group.  The  function  accepts one parameter: group name[instance id],
+   for example foo[5].
 
-1.3.18. cfg.del_group_inst
+3.18. cfg.del_group_inst
 
-   cfg.del_group_inst - Delete an instance of an existing configuration
-   group. The function accepts one parameter: group name[instance id], for
-   example foo[5].
+   cfg.del_group_inst  -  Delete an instance of an existing configuration
+   group.  The  function  accepts one parameter: group name[instance id],
+   for example foo[5].

+ 98 - 47
modules/counters/README

@@ -1,3 +1,4 @@
+
 Counters Module
 
 Andrei Pelinescu-Onciul
@@ -5,25 +6,75 @@ Andrei Pelinescu-Onciul
    iptelorg GmbH
 
    Copyright © 2010 iptelorg GmbH
-     __________________________________________________________________
+     _________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+        2. Parameters
+
+              2.1. script_counter
+              2.2. script_cnt_grp_name
+
+        3. Functions
+
+              3.1. cnt_inc([group.]name) 
+              3.2. cnt_add([group.]name, number) 
+              3.3. cnt_reset([group.]name) 
+
+        4. counters RPC Functions
+
+              4.1. cnt.get group counter_name
+              4.2. cnt.reset group counter_name
+              4.3. cnt.grps_list
+              4.4. cnt.var_list group
+              4.5. cnt.grp_get_all
+              4.6. cnt.help group counter_name
 
    List of Examples
 
-   1. Create a new script_counter
-   2. Set script_cnt_grp_name in the config file
-   3. cnt_inc usage
-   4. cnt_add usage
-   5. cnt_reset usage
-   6. cnt.get grp counter_name usage
-   7. cnt.reset grp name usage
-   8. cnt.grps_list usage
-   9. cnt.var_list group usage
-   10. cnt.var_list group usage
-   11. cnt.help grp name usage
+   1.1. Create a new script_counter 
+   1.2. Set script_cnt_grp_name in the config file 
+   1.3. cnt_inc usage
+   1.4. cnt_add usage
+   1.5. cnt_reset usage
+   1.6. cnt.get grp counter_name usage
+   1.7. cnt.reset grp name usage
+   1.8. cnt.grps_list usage
+   1.9. cnt.var_list group usage
+   1.10. cnt.var_list group usage
+   1.11. cnt.help grp name usage
+
+Chapter 1. Admin Guide
+
+   Table of Contents
+
+   1. Overview
+   2. Parameters
+
+        2.1. script_counter
+        2.2. script_cnt_grp_name
+
+   3. Functions
+
+        3.1. cnt_inc([group.]name) 
+        3.2. cnt_add([group.]name, number) 
+        3.3. cnt_reset([group.]name) 
+
+   4. counters RPC Functions
+
+        4.1. cnt.get group counter_name
+        4.2. cnt.reset group counter_name
+        4.3. cnt.grps_list
+        4.4. cnt.var_list group
+        4.5. cnt.grp_get_all
+        4.6. cnt.help group counter_name
 
 1. Overview
 
-   This module exports counters/statistics manipulating script functions
+   This  module exports counters/statistics manipulating script functions
    and RPCs.
 
 2. Parameters
@@ -34,15 +85,15 @@ Andrei Pelinescu-Onciul
 2.1. script_counter
 
    Define a new counter that can be used from the script. The declaration
-   might include a group in front of the counter name, separated with '.'.
-   It might also include a counter description string (help message),
-   separated from the name with a ' ' or ':'. If the group is missing, the
-   group defined in the script_cnt_grp_name module parameter will be used
-   (the default is "script"). If the description is missing, the default
-   is "custom script counter". The format of the declaration is:
-   [group.]name[( |:)description].
-
-   Example 1.  Create a new script_counter
+   might  include  a  group  in front of the counter name, separated with
+   '.'.  It  might  also  include  a  counter  description  string  (help
+   message),  separated  from the name with a ' ' or ':'. If the group is
+   missing, the group defined in the script_cnt_grp_name module parameter
+   will be used (the default is "script"). If the description is missing,
+   the  default is "custom script counter". The format of the declaration
+   is: [group.]name[( |:)description].
+
+   Example 1.1.  Create a new script_counter 
 modparam("counters", "script_counter", "foo")  # script.foo
 modparam("counters", "script_counter", "test.bar")  # test.bar
 modparam("counters", "script_counter", "baz example counter")  # script.baz
@@ -50,27 +101,27 @@ modparam("counters", "script_counter", "test.x:another example") # test.x
 
 2.2. script_cnt_grp_name
 
-   Group name that will be used for the counters defined via the
+   Group  name  that  will  be  used  for  the  counters  defined via the
    script_counter module parameter which do not have a specified group.
 
    Default: "script".
 
-   Example 2.  Set script_cnt_grp_name in the config file
+   Example 1.2.  Set script_cnt_grp_name in the config file 
 modparam("counters", "script_cnt_grp_name", "my_counters")
 
 3. Functions
 
-   3.1. cnt_inc([group.]name)
-   3.2. cnt_add([group.]name, number)
-   3.3. cnt_reset([group.]name)
+   3.1. cnt_inc([group.]name) 
+   3.2. cnt_add([group.]name, number) 
+   3.3. cnt_reset([group.]name) 
 
 3.1.  cnt_inc([group.]name)
 
-   Increments the counter group.name. The counter must be defined using
+   Increments  the  counter group.name. The counter must be defined using
    the script_counter module parameter. If the group name is missing, the
    group specified by the script_cnt_grp_name modparam will be used.
 
-   Example 3. cnt_inc usage
+   Example 1.3. cnt_inc usage
 ...
 modparam("counters", "script_counter", "reqs")
 modparam("counters", "script_counter", "out.reqs  forwarded requests")
@@ -84,11 +135,11 @@ route {
 
 3.2.  cnt_add([group.]name, number)
 
-   Adds number the counter group.name. The counter must be defined using
+   Adds  number the counter group.name. The counter must be defined using
    the script_counter module parameter. If the group name is missing, the
    group specified by the script_cnt_grp_name modparam will be used.
 
-   Example 4. cnt_add usage
+   Example 1.4. cnt_add usage
 ...
 modparam("counters", "script_counter", "reqs10  reqs times 10")
 ...
@@ -99,11 +150,11 @@ route {
 
 3.3.  cnt_reset([group.]name)
 
-   Resets the counter group.name. The counter must be defined using the
-   script_counter module parameter. If the group name is missing, the
+   Resets  the  counter group.name. The counter must be defined using the
+   script_counter  module  parameter.  If  the group name is missing, the
    group specified by the script_cnt_grp_name modparam will be used.
 
-   Example 5. cnt_reset usage
+   Example 1.5. cnt_reset usage
 ...
 modparam("counters", "script_counter", "reqs")
 ...
@@ -126,41 +177,41 @@ route {
 
    Get the value of the counter identified by group.counter_name.
 
-   Example 6. cnt.get grp counter_name usage
- $ sercmd cnt.get script foo
+   Example 1.6. cnt.get grp counter_name usage
+ $ kamcmd cnt.get script foo
 
 4.2.  cnt.reset group counter_name
 
    Resets the counter identified by group.counter_name.
 
-   Example 7. cnt.reset grp name usage
- $ sercmd cnt.reset script foo
+   Example 1.7. cnt.reset grp name usage
+ $ kamcmd cnt.reset script foo
 
 4.3.  cnt.grps_list
 
    Lists all the declared counter groups.
 
-   Example 8. cnt.grps_list usage
- $ sercmd cnt.grps_list
+   Example 1.8. cnt.grps_list usage
+ $ kamcmd cnt.grps_list
 
 4.4.  cnt.var_list group
 
-   Lists all the names of all the counters belonging to the specified
+   Lists  all  the  names  of all the counters belonging to the specified
    group.
 
-   Example 9. cnt.var_list group usage
- $ sercmd cnt.var_list script
+   Example 1.9. cnt.var_list group usage
+ $ kamcmd cnt.var_list script
 
 4.5.  cnt.grp_get_all
 
    Lists all the counter names and their values in the specified group.
 
-   Example 10. cnt.var_list group usage
- $ sercmd cnt.grp_get_all script
+   Example 1.10. cnt.var_list group usage
+ $ kamcmd cnt.grp_get_all script
 
 4.6.  cnt.help group counter_name
 
    Displays the counter description.
 
-   Example 11. cnt.help grp name usage
- $ sercmd cnt.help script foo
+   Example 1.11. cnt.help grp name usage
+ $ kamcmd cnt.help script foo

+ 110 - 61
modules/ctl/README

@@ -1,3 +1,4 @@
+
 The Ctl Module
 
 Andrei Pelinescu-Onciul
@@ -5,41 +6,88 @@ Andrei Pelinescu-Onciul
    iptelorg GmbH
 
    Copyright © 2009 iptelorg GmbH
-     __________________________________________________________________
+     _________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+        2. BINRPC
+        3. Parameters
+
+              3.1. binrpc (string)
+              3.2. mode (integer)
+              3.3. user (integer or string)
+              3.4. group (integer or string)
+              3.5. fifo (integer)
+              3.6. autoconversion (integer)
+              3.7. binrpc_max_body_size (integer)
+              3.8. binrpc_struct_max_body_size (integer)
+
+        4. SIP-router RPC Functions
+
+              4.1. ctl.listen
+              4.2. ctl.connections
+              4.3. ctl.who
 
    List of Examples
 
-   1. sercmd example usage
-   2. Set binrpc parameter
-   3. Set mode parameter
-   4. Set user parameter
-   5. Set group parameter
-   6. Set fifo parameter
-   7. Set the autoconversion parameter
-   8. Set the binrpc_max_body_size parameter
-   9. Set the binrpc_struct_max_body_size parameter
-   10. print usage
-   11. ctl.connections usage
-   12. ctl.who usage
+   1.1. kamcmd example usage
+   1.2. Set binrpc parameter
+   1.3. Set mode parameter
+   1.4. Set user parameter
+   1.5. Set group parameter
+   1.6. Set fifo parameter
+   1.7. Set the autoconversion parameter 
+   1.8. Set the binrpc_max_body_size parameter 
+   1.9. Set the binrpc_struct_max_body_size parameter 
+   1.10. print usage
+   1.11. ctl.connections usage
+   1.12. ctl.who usage
+
+Chapter 1. Admin Guide
+
+   Table of Contents
+
+   1. Overview
+   2. BINRPC
+   3. Parameters
+
+        3.1. binrpc (string)
+        3.2. mode (integer)
+        3.3. user (integer or string)
+        3.4. group (integer or string)
+        3.5. fifo (integer)
+        3.6. autoconversion (integer)
+        3.7. binrpc_max_body_size (integer)
+        3.8. binrpc_struct_max_body_size (integer)
+
+   4. SIP-router RPC Functions
+
+        4.1. ctl.listen
+        4.2. ctl.connections
+        4.3. ctl.who
 
 1. Overview
 
-   This module implements the binrpc transport interface for Kamailio
+   This  module  implements  the  binrpc transport interface for Kamailio
    RPCs. It supports various transports over which it speaks binrpc: Unix
    datagram sockets, Unix stream sockets, UDP and TCP. It also supports a
-   backward compatible FIFO interface (using the old Kamailio FIFO
+   backward  compatible  FIFO  interface  (using  the  old  Kamailio FIFO
    protocol).
 
    By default (if no parameters are changed in the config file) it uses a
-   Unix stream socket under /tmp: /tmp/ser_ctl. This socket is also the
-   default for sercmd.
+   Unix  stream  socket under /tmp: /tmp/ser_ctl. This socket is also the
+   default for kamcmd.
 
-   In general it's used in conjunction with sercmd. sercmd is a Unix tool
-   for invoking Kamailio RPC functions. It can be used both in interactive
-   mode (supports tab-completion and history) or command line mode.
+   In general it's used in conjunction with kamcmd. kamcmd is a Unix tool
+   for   invoking  Kamailio  RPC  functions.  It  can  be  used  both  in
+   interactive mode (supports tab-completion and history) or command line
+   mode.
 
-   Example 1. sercmd example usage
-$ sercmd ps
+   Example 1.1. kamcmd example usage
+$ kamcmd ps
 11262   attendant
 11268   udp receiver child=0 sock=127.0.0.1:5060
 11269   udp receiver child=1 sock=127.0.0.1:5060
@@ -52,15 +100,15 @@ $ sercmd ps
 11276   tcp receiver child=1
 11277   tcp main process
 
-   See utils/sercmd/EXAMPLES for more examples.
+   See utils/kamcmd/EXAMPLES for more examples.
 
 2. BINRPC
 
-   binrpc is a ser proprietary binary protocol for invoking rpcs. It was
-   designed such that it would minimize the packet sizes and it would be
+   binrpc  is a ser proprietary binary protocol for invoking rpcs. It was
+   designed  such that it would minimize the packet sizes and it would be
    very fast to parse (as opposed to XML-rpc).
 
-   The binrpc encoding format is fully documented inside
+   The    binrpc    encoding    format   is   fully   documented   inside
    modules/ctl/binrpc.h.
 
 3. Parameters
@@ -76,19 +124,19 @@ $ sercmd ps
 
 3.1. binrpc (string)
 
-   Specifies the transport used for the binrpc protocol. The following
-   transport protocol are supported: Unix datagram sockets, Unix stream
+   Specifies  the  transport  used for the binrpc protocol. The following
+   transport  protocol  are supported: Unix datagram sockets, Unix stream
    sockets, UDP and TCP.
 
    The format is: [ protocol:] address_port|path .
 
      * For Unix sockets: [unixd|unixs|unix]:path where "unixd" means Unix
-       datagram sockets and "unix" "unixs" mean Unix stream sockets.
-       Examples: "unixd:/tmp/unix_dgram", "unixs:/tmp/unix_stream",
+       datagram  sockets  and  "unix"  "unixs"  mean Unix stream sockets.
+       Examples:    "unixd:/tmp/unix_dgram",    "unixs:/tmp/unix_stream",
        "unix:/tmp/unix_stream".
-     * For UDP or TCP sockets: [udp|tcp]:address:port. If the address is
+     * For  UDP or TCP sockets: [udp|tcp]:address:port. If the address is
        "*" or missing, it will bind to all the local addresses (0.0.0.0).
-       Examples: "udp:localhost:2046", "tcp:localhost:2046", "tcp:3012",
+       Examples:  "udp:localhost:2046", "tcp:localhost:2046", "tcp:3012",
        "udp:*:3012".
 
    If the protocol part is missing and the address/path part looks like a
@@ -97,13 +145,13 @@ $ sercmd ps
      * "/tmp/unix_test" - equivalent to "unixs:/tmp/unix_test".
      * "localhost:3000" - equivalent to "udp:localhost:3000".
 
-   Multiple transports / listen addresses can be specified, just by
+   Multiple  transports  /  listen  addresses  can  be specified, just by
    setting the parameter multiple times.
 
    Default:"unix:/tmp/ser_ctl" (Unix stream socket). The default value is
    used only if no binrpc parameter is found in the config file.
 
-   Example 2. Set binrpc parameter
+   Example 1.2. Set binrpc parameter
 loadmodule "ctl"
 # optional listen addresses, if no one is specified,
 # ctl will listen on unixs:/tmp/ser_ctl
@@ -125,7 +173,7 @@ modparam("ctl", "binrpc", "udp:*:3012")             # udp any , port 3012
 
    Default: 0600.
 
-   Example 3. Set mode parameter
+   Example 1.3. Set mode parameter
 modparam("ctl", "mode", 0600) # permissions
 
 3.3. user (integer or string)
@@ -134,7 +182,7 @@ modparam("ctl", "mode", 0600) # permissions
 
    Default: not set (the user under which SER runs).
 
-   Example 4. Set user parameter
+   Example 1.4. Set user parameter
 modparam("ctl", "user", "andrei")
 
 3.4. group (integer or string)
@@ -143,22 +191,23 @@ modparam("ctl", "user", "andrei")
 
    Default: not set (the group under which SER runs).
 
-   Example 5. Set group parameter
+   Example 1.5. Set group parameter
 modparam("ctl", "group", 100)
 
 3.5. fifo (integer)
 
    fifo used for the obsolete fifo protocol. The fifo protocol can be run
-   over a real fifo, over UDP or over TCP. Format:
-   [protocol:]path|address. If no protocol is specified the default is
-   "fifo". Examples: "fifo:/tmp/ser_fifo", "/tmp/ser_fifo2", "udp:*:2050",
-   "tcp:localhost:2050". For more details on the UDP and TCP formats see
-   binrpc. Multiple fifos or fifo transports can be used in the same time
-   (just by setting the fifo parameter multiple times in the config).
+   over    a    real    fifo,    over    UDP   or   over   TCP.   Format:
+   [protocol:]path|address.  If  no  protocol is specified the default is
+   "fifo".      Examples:     "fifo:/tmp/ser_fifo",     "/tmp/ser_fifo2",
+   "udp:*:2050",  "tcp:localhost:2050".  For  more details on the UDP and
+   TCP  formats see binrpc. Multiple fifos or fifo transports can be used
+   in the same time (just by setting the fifo parameter multiple times in
+   the config).
 
    Default: not set (no fifo will be used).
 
-   Example 6. Set fifo parameter
+   Example 1.6. Set fifo parameter
 # old fifo support
 modparam("ctl", "fifo", "fifo:/tmp/ser_fifo")      # clasic fifo
 modparam("ctl", "fifo", "/tmp/ser_fifo2")
@@ -167,8 +216,8 @@ modparam("ctl", "fifo", "tcp:*:2050")              # fifo over tcp
 
 3.6. autoconversion (integer)
 
-   Enable or disable automatic type conversion globally, for all the
-   methods parameters. If on, a type mismatch in a method parameter will
+   Enable  or  disable  automatic  type  conversion globally, for all the
+   methods  parameters. If on, a type mismatch in a method parameter will
    not cause a fault if it is possible to automatically convert it to the
    expected type.
 
@@ -176,30 +225,30 @@ modparam("ctl", "fifo", "tcp:*:2050")              # fifo over tcp
 
    It is recommended to leave this parameter to its default off value and
    fix instead the client application (which should use the proper types)
-   or to modify the target rpc to accept any type (see the rpc scan '.'
+   or  to  modify the target rpc to accept any type (see the rpc scan '.'
    modifier).
 
-   Example 7. Set the autoconversion parameter
+   Example 1.7. Set the autoconversion parameter 
 modparam("ctl", "autoconversion", 1)
 
 3.7. binrpc_max_body_size (integer)
 
-   Set the size of binrpc buffer for RPC reply. Value represents
+   Set  the  size  of  binrpc  buffer  for  RPC  reply.  Value represents
    kilobytes.
 
    Default: 4 (meaning 4KB);
 
-   Example 8. Set the binrpc_max_body_size parameter
+   Example 1.8. Set the binrpc_max_body_size parameter 
 modparam("ctl", "binrpc_max_body_size", 10)
 
 3.8. binrpc_struct_max_body_size (integer)
 
-   Set the size of binrpc structure buffer for RPC reply. Value represents
-   kilobytes.
+   Set  the  size  of  binrpc  structure  buffer  for  RPC  reply.  Value
+   represents kilobytes.
 
    Default: 1 (meaning 1KB);
 
-   Example 9. Set the binrpc_struct_max_body_size parameter
+   Example 1.9. Set the binrpc_struct_max_body_size parameter 
 modparam("ctl", "binrpc_struct_max_body_size", 3)
 
 4. SIP-router RPC Functions
@@ -212,26 +261,26 @@ modparam("ctl", "binrpc_struct_max_body_size", 3)
 
    List all the sockets on which the ctl module listens.
 
-   Example 10. print usage
- $ sercmd -f"[%v] %v:%v %v\n" ctl.listen
+   Example 1.10. print usage
+ $ kamcmd -f"[%v] %v:%v %v\n" ctl.listen
 [binrpc] unix_stream:/tmp/ser_ctl
 
-# note: the above command is equivalent with sercmd listen
+# note: the above command is equivalent with kamcmd listen
 
 4.2.  ctl.connections
 
    Returns the number of open binrpc connections (to the ctl module).
 
-   Example 11. ctl.connections usage
- $ sercmd ctl.connections
+   Example 1.11. ctl.connections usage
+ $ kamcmd ctl.connections
 1
 
 4.3.  ctl.who
 
    List open binrpc connections (to the ctl module).
 
-   Example 12. ctl.who usage
- $ sercmd -f"[%v] %v: %v %v -> %v %v\n" ctl.who
+   Example 1.12. ctl.who usage
+ $ kamcmd -f"[%v] %v: %v %v -> %v %v\n" ctl.who
 [binrpc] unix_stream: <anonymous unix socket>  -> /tmp/ser_ctl
 
-# note the above command is equivalent to sercmd who
+# note the above command is equivalent to kamcmd who

+ 90 - 62
modules/db2_ldap/README

@@ -1,75 +1,100 @@
-1. db2_ldap module
+
+db2_ldap module
 
 Jan Janak
 
    Iptel.org
 
    Copyright © 2008 Iptel.org GmBH
-     __________________________________________________________________
+     _________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+        2. Dependencies
+        3. Parameters
+
+              3.1. config (string)
+              3.2. reconnect_attempt (integer)
+
+        4. Functions
 
-   1.1. Overview
-   1.2. Dependencies
-   1.3. Parameters
+   List of Examples
 
-        1.3.1. config (string)
-        1.3.2. reconnect_attempt (integer)
+   1.1. URI example
+   1.2. Example config
+   1.3. Configuration file example
+   1.4. Example reconnect_attempt
 
-   1.4. Functions
+Chapter 1. Admin Guide
 
-1.1. Overview
+   Table of Contents
 
-   The LDAP module is database driver, i.e. it implements DBv2 API
-   functions. The goal is map database query defined by table, matching
-   fields and result fields to LDAP search in sub-tree defined by root,
-   object class, attributes and pass it to the OpenLDAP which communicates
-   with the LDAP server.
+   1. Overview
+   2. Dependencies
+   3. Parameters
 
-   This procedure is sometimes tricky because the LDAP does not support
-   all database features or supports them in different manner. Here we
+        3.1. config (string)
+        3.2. reconnect_attempt (integer)
+
+   4. Functions
+
+1. Overview
+
+   The  LDAP  module  is  database  driver,  i.e.  it implements DBv2 API
+   functions.  The  goal is map database query defined by table, matching
+   fields  and  result fields to LDAP search in sub-tree defined by root,
+   object   class,   attributes   and  pass  it  to  the  OpenLDAP  which
+   communicates with the LDAP server.
+
+   This  procedure  is sometimes tricky because the LDAP does not support
+   all  database  features  or supports them in different manner. Here we
    must express especially filtering and multi-values. The multi-value is
-   de facto array of single values. If the LDAP module get a multi-value
-   field then generates record for every single value, respectively for
+   de  facto array of single values. If the LDAP module get a multi-value
+   field  then  generates record for every single value, respectively for
    every combination in case the more fields contain multi-value.
 
-   The LDAP supports natively "AND", "OR", "NOT" logical operators and
-   "equal", "non-equal", "less-or-equal" and "greater-or-equal" comparison
-   operators. Therefore "less" and "greater" operators are mapped as
-   "less/greater-or-equal-AND-not-equal". It's important realize it when
-   the attribute which will be used for filtering may contain multi-value.
-   The LDAP server evaluates comparison operator on multi-value so that
-   the result for record is true if the condition is satisfied for any
-   single value. The single values not satisfying condition are not
-   truncated. It implies two cases for positive comparison, e.g. "equal",
-   the result contains values not satisfying the condition, the case may
-   be handled by additional filter in the LDAP module, the negative
-   comparison, e.g. "non-equal", does not return record at all. Because
-   the LDAP module cannot know if the LDAP attribute may logically contain
-   multi-value so there is introduced DB API option client_side_filtering
-   which forces filtering such fields in the LDAP module, i.e. the LDAP
-   server returns larger result set because the filtering condition is not
-   passed there.
-
-   The syntax of client_side_filtering value is comma delimited of field
-   names which won't be used for server-side filter if such a field
-   appears in a match condition. Instead records will be filtered out in
+   The  LDAP  supports  natively "AND", "OR", "NOT" logical operators and
+   "equal",    "non-equal",    "less-or-equal"   and   "greater-or-equal"
+   comparison  operators.  Therefore  "less"  and "greater" operators are
+   mapped   as   "less/greater-or-equal-AND-not-equal".   It's  important
+   realize  it  when  the  attribute which will be used for filtering may
+   contain  multi-value. The LDAP server evaluates comparison operator on
+   multi-value  so that the result for record is true if the condition is
+   satisfied  for  any  single  value.  The  single values not satisfying
+   condition  are  not  truncated.  It  implies  two  cases  for positive
+   comparison,  e.g.  "equal",  the result contains values not satisfying
+   the  condition,  the  case  may be handled by additional filter in the
+   LDAP  module,  the  negative  comparison,  e.g.  "non-equal", does not
+   return  record at all. Because the LDAP module cannot know if the LDAP
+   attribute  may logically contain multi-value so there is introduced DB
+   API option client_side_filtering which forces filtering such fields in
+   the  LDAP  module,  i.e.  the  LDAP  server  returns larger result set
+   because the filtering condition is not passed there.
+
+   The  syntax of client_side_filtering value is comma delimited of field
+   names  which  won't  be  used  for  server-side filter if such a field
+   appears  in a match condition. Instead records will be filtered out in
    module. It implies such fields MUST exist in result field list.
 
-   The necessary condition of successful filtering of particular attribute
-   at the LDAP server is correct attribute definition. The
-   "equal"/"non-equal" operator requires equality matching rule, the
+   The   necessary   condition  of  successful  filtering  of  particular
+   attribute  at  the  LDAP  server  is correct attribute definition. The
+   "equal"/"non-equal"  operator  requires  equality  matching  rule, the
    "greater"/"less" operator requires ordering matching rule. If required
    matching rule is missing the LDAP server silently returns empty result
-   set. In case of double filtering both at the LDAP servar and the LDAP
-   module, e.g. multi-value and equal comparison, check the LDAP server
-   matching rule satisfies your needs or use client_side_filtering
+   set.  In case of double filtering both at the LDAP servar and the LDAP
+   module,  e.g.  multi-value and equal comparison, check the LDAP server
+   matching  rule  satisfies  your  needs  or  use  client_side_filtering
    feature.
 
-   The LDAP server may be identified either complete specification of
-   host, user, password in URI or is specification reference to connection
-   section of config file. Note in the second case there is only one
-   slash.
+   The  LDAP  server  may  be identified either complete specification of
+   host,   user,  password  in  URI  or  is  specification  reference  to
+   connection  section  of  config file. Note in the second case there is
+   only one slash.
 
-   Example 1. URI example
+   Example 1.1. URI example
         ...
         modparam("auth", "db_url", "ldap://admin:[email protected]");
 
@@ -84,29 +109,32 @@ Jan Janak
      * optional referral chasing by OpenLDAP
      * optional reference chasing by OpenLDAP
 
-1.2. Dependencies
+2. Dependencies
 
    none
 
-1.3. Parameters
+3. Parameters
+
+   3.1. config (string)
+   3.2. reconnect_attempt (integer)
 
-1.3.1. config (string)
+3.1. config (string)
 
    Default value is ldap.cfg.
 
-   The filename (relatively to ser config file) of mapping database to
+   The  filename  (relatively  to ser config file) of mapping database to
    LDAP definition. It is the main configuration file for the LDAP module
-   in SER. The configuration file maps database table names used in SER to
-   LDAP directory sub-trees to be searched. In addition to that the
+   in  SER.  The configuration file maps database table names used in SER
+   to  LDAP  directory  sub-trees to be searched. In addition to that the
    configuration file also allows to configure the LDAP search filter and
    maps database field names to LDAP attribute names and vice versa.
 
-   Example 2. Example config
+   Example 1.2. Example config
         ...
         modparam("ldap", "config", "my-ldap.cfg");
         ...
 
-   Example 3. Configuration file example
+   Example 1.3. Configuration file example
 # Supported Attribute Type Names:
 #  * GeneralizedTime
 #  * Integer
@@ -212,18 +240,18 @@ field_map = type : (Integer) serAttrType
 field_map = value : serAttrValue
 field_map = flags : (BitString) serFlags
 
-1.3.2. reconnect_attempt (integer)
+3.2. reconnect_attempt (integer)
 
    Default value is 3.
 
-   Number of reconnect attempts when connection to the LDAP server is
+   Number  of  reconnect  attempts  when connection to the LDAP server is
    lost.
 
-   Example 4. Example reconnect_attempt
+   Example 1.4. Example reconnect_attempt
         ...
         modparam("ldap", "reconnect_attempt", "5");
         ...
 
-1.4. Functions
+4. Functions
 
    none

+ 247 - 165
modules/db2_ops/README

@@ -1,50 +1,110 @@
-1. db2_ops module
+
+db2_ops module
 
 Tomas Mandys
 
    Iptel.org
 
    Copyright © 2007 Tomas Mandys
-     __________________________________________________________________
-
-   1.1. Overview
-   1.2. Dependencies
-   1.3. ABNF syntax
-   1.4. Parameters
-
-        1.4.1. db_url (string)
-        1.4.2. declare_query (string)
-        1.4.3. declare_handle (string)
-
-   1.5. Functions
-
-        1.5.1. db_query(query | query_id [,handle] )
-        1.5.2. db_close(handle)
-        1.5.3. db_first(handle)
-        1.5.4. db_next(handle)
-        1.5.5. db_seek(handle, row_no)
-        1.5.6. db_foreach(handle, route)
-        1.5.7. db_proper()
-        1.5.8. @db.query.query_id
-        1.5.9. @db.query.query_id.count
-        1.5.10. @db.query.query_id.is_empty
-        1.5.11. @db.query.query_id.field[m]
-        1.5.12. @db.query.query_id.row[n]
-        1.5.13. @db.query.query_id.row[n].field[m]
-        1.5.14. @db.fetch.handle
-        1.5.15. @db.fetch.handle.row_no
-
-   1.6. Examples
-
-1.1. Overview
+     _________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+        2. Dependencies
+        3. ABNF syntax
+        4. Parameters
+
+              4.1. db_url (string)
+              4.2. declare_query (string)
+              4.3. declare_handle (string)
+
+        5. Functions
+
+              5.1. db_query(query | query_id [,handle] ) 
+              5.2. db_close(handle) 
+              5.3. db_first(handle) 
+              5.4. db_next(handle) 
+              5.5. db_seek(handle, row_no) 
+              5.6. db_foreach(handle, route) 
+              5.7. db_proper() 
+              5.8. @db.query.query_id 
+              5.9. @db.query.query_id.count 
+              5.10. @db.query.query_id.is_empty 
+              5.11. @db.query.query_id.field[m] 
+              5.12. @db.query.query_id.row[n] 
+              5.13. @db.query.query_id.row[n].field[m] 
+              5.14. @db.fetch.handle 
+              5.15. @db.fetch.handle.row_no 
+
+        6. Examples
+
+   List of Examples
+
+   1.1. Example db_url
+   1.2. Example declare_query
+   1.3. Example declare_handle
+   1.4. db_query usage
+   1.5. db_close usage
+   1.6. db_first usage
+   1.7. db_next usage
+   1.8. db_seek usage
+   1.9. db_foreach usage
+   1.10. db_proper usage
+   1.11. db.query.query_id usage
+   1.12. db.query.query_id.count usage
+   1.13. db.query.query_id.is_empty usage
+   1.14. db.query.query_id.field[m] usage
+   1.15. db.query.query_id.row[n] usage
+   1.16. db.query.query_id.row[n].field[m] usage
+   1.17. db.fetch.handle usage
+   1.18. db.fetch.handle.row_no usage
+   1.19. db_ops common example
+
+Chapter 1. Admin Guide
+
+   Table of Contents
+
+   1. Overview
+   2. Dependencies
+   3. ABNF syntax
+   4. Parameters
+
+        4.1. db_url (string)
+        4.2. declare_query (string)
+        4.3. declare_handle (string)
+
+   5. Functions
+
+        5.1. db_query(query | query_id [,handle] ) 
+        5.2. db_close(handle) 
+        5.3. db_first(handle) 
+        5.4. db_next(handle) 
+        5.5. db_seek(handle, row_no) 
+        5.6. db_foreach(handle, route) 
+        5.7. db_proper() 
+        5.8. @db.query.query_id 
+        5.9. @db.query.query_id.count 
+        5.10. @db.query.query_id.is_empty 
+        5.11. @db.query.query_id.field[m] 
+        5.12. @db.query.query_id.row[n] 
+        5.13. @db.query.query_id.row[n].field[m] 
+        5.14. @db.fetch.handle 
+        5.15. @db.fetch.handle.row_no 
+
+   6. Examples
+
+1. Overview
 
    The module introduces possibility to run SQL queries from script.
 
-1.2. Dependencies
+2. Dependencies
 
    none
 
-1.3. ABNF syntax
+3. ABNF syntax
 
         xltext = text_parsed_by_xl_lib
         database = type "://" user:psw "@" host "/" database_name
@@ -54,84 +114,104 @@ Tomas Mandys
         where = fields
         ops = op [ "," op ... ]
         order = field
-        type = "s" | "i" | "d" | "f" | "t" ; enables to force particular type wh
-en writing to db driver (string/int/double/float/datetime), valueable especially
- for datetime
+        type = "s" | "i" | "d" | "f" | "t" ; enables to force particular type w
+hen writing to db driver (string/int/double/float/datetime), valueable especial
+ly for datetime
         value = [type ":"] xltext
         values = value [ "," value ...]
         extra_op = name "=" [type ":"] text
         extra_ops = extra_op [ "," extra_op]
 
-        select = [database "/"] "select/" table "/" fields "/" where "/" ops "/"
- order "/" values [ "/" extra_ops ]
-        insert = [database "/"] "insert/" table "/" fields "/" values [ "/" extr
-a_ops ]
-        update = [database "/"] "update/" table "/" fields "/" where "/" ops "/"
- values [ "/" extra_ops ]
-        replace = [database "/"] "replace/" table "/" fields "/" values [ "/" ex
-tra_ops ]
-        delete = [database "/"] "delete/" table "/" where "/" ops "/" values [ "
-/" extra_ops ]
+        select = [database "/"] "select/" table "/" fields "/" where "/" ops "/
+" order "/" values [ "/" extra_ops ]
+        insert = [database "/"] "insert/" table "/" fields "/" values [ "/" ext
+ra_ops ]
+        update = [database "/"] "update/" table "/" fields "/" where "/" ops "/
+" values [ "/" extra_ops ]
+        replace = [database "/"] "replace/" table "/" fields "/" values [ "/" e
+xtra_ops ]
+        delete = [database "/"] "delete/" table "/" where "/" ops "/" values [
+"/" extra_ops ]
         raw_query = [database "/"] "select ...." | "insert ..." [[ / "values" [
-"/" extra_ops ]]  # not delimited by "/"
+ "/" extra_ops ]]  # not delimited by "/"
         query = (select | insert | update | replace | delete | raw_query)
         query_id = alphanum
         handle = alphanum  (plain text possible but alphanum recommended)
         declare_query_param = query_id "=" query
         declare_handle_param = handle
 
-1.4. Parameters
+4. Parameters
+
+   4.1. db_url (string)
+   4.2. declare_query (string)
+   4.3. declare_handle (string)
 
-1.4.1. db_url (string)
+4.1. db_url (string)
 
    Default database URL.
 
    The format is:
                         db_url = database
 
-   Example 1. Example db_url
+   Example 1.1. Example db_url
         ...
         modparam("db_ops", "db_url", "mysql://ser:[email protected]:12345/ser");
         ...
 
-1.4.2. declare_query (string)
+4.2. declare_query (string)
 
    Declare query_id for @db.query_id (see select syntax) or for reference
-   from db_query(query_id). Queries are pre-compiled therefore volatile
+   from  db_query(query_id).  Queries are pre-compiled therefore volatile
    stuff must be passed via parameters (AVP or so).
 
    The format is:
                         declare_query = declare_query_param
 
-   Example 2. Example declare_query
+   Example 1.2. Example declare_query
         ...
-        modparam("db_ops", "declare_query", "sel1=select/location/received/uid//
-/%$f.uid");
+        modparam("db_ops", "declare_query", "sel1=select/location/received/uid/
+//%$f.uid");
         ...
 
-1.4.3. declare_handle (string)
+4.3. declare_handle (string)
 
    Declare handle for fetching.
 
    The format is:
                         declare_handle = declare_handle_param
 
-   Example 3. Example declare_handle
+   Example 1.3. Example declare_handle
         ...
         modparam("db_ops", "declare_handle", "my_handle");
         ...
 
-1.5. Functions
-
-1.5.1. db_query(query | query_id [,handle] )
-
-   Executes query and in case of SELECT returns result via handle, seeks
+5. Functions
+
+   5.1. db_query(query | query_id [,handle] ) 
+   5.2. db_close(handle) 
+   5.3. db_first(handle) 
+   5.4. db_next(handle) 
+   5.5. db_seek(handle, row_no) 
+   5.6. db_foreach(handle, route) 
+   5.7. db_proper() 
+   5.8. @db.query.query_id 
+   5.9. @db.query.query_id.count 
+   5.10. @db.query.query_id.is_empty 
+   5.11. @db.query.query_id.field[m] 
+   5.12. @db.query.query_id.row[n] 
+   5.13. @db.query.query_id.row[n].field[m] 
+   5.14. @db.fetch.handle 
+   5.15. @db.fetch.handle.row_no 
+
+5.1.  db_query(query | query_id [,handle] )
+
+   Executes  query and in case of SELECT returns result via handle, seeks
    the first record and returns TRUE if table is not empty. The result is
-   accesible using @db.fetch select. See also declare_handle. Query_id
+   accesible  using  @db.fetch  select. See also declare_handle. Query_id
    references to query declared using declare_query, handle references to
    query declared using declare_handle.
 
-   Example 4. db_query usage
+   Example 1.4. db_query usage
         ...
         db_query("delete/silo///");
         if (db_query("select/silo/body/uid//inc_time/%$f.uid", my_handle)) {
@@ -142,58 +222,58 @@ tra_ops ]
 
         }
 
-1.5.2. db_close(handle)
+5.2.  db_close(handle)
 
-   Close table that has been opened using db_query. Note all close after
+   Close  table that has been opened using db_query. Note all close after
    script processing automatically.
 
-   Example 5. db_close usage
+   Example 1.5. db_close usage
         ...
         db_close(my_handle);
         ...
 
-1.5.3. db_first(handle)
+5.3.  db_first(handle)
 
-   Returns TRUE if table is not empty. Note that rewind might not be
+   Returns  TRUE  if  table  is  not empty. Note that rewind might not be
    supported by particular db driver.
 
-   Example 6. db_first usage
+   Example 1.6. db_first usage
         ...
         if (db_first(my_handle)) {
         ...
         }
         ...
 
-1.5.4. db_next(handle)
+5.4.  db_next(handle)
 
    Moves to the next record and returns TRUE if not EOF.
 
-   Example 7. db_next usage
+   Example 1.7. db_next usage
         ...
         if (db_next(my_handle)) {
         ...
         }
         ...
 
-1.5.5. db_seek(handle, row_no)
+5.5.  db_seek(handle, row_no)
 
-   Seeks at the row no (origin is zero) and Returns TRUE in case of
+   Seeks  at  the  row  no  (origin  is zero) and Returns TRUE in case of
    success. Backward seek might not be supported by db driver.
 
-   Example 8. db_seek usage
+   Example 1.8. db_seek usage
         ...
         if (db_seek(my_handle, $row_no)) {
         ...
         }
         ...
 
-1.5.6. db_foreach(handle, route)
+5.6.  db_foreach(handle, route)
 
    Call specific route for each row, loop is interrupted if route returns
    code <= 0. Return code of the last route call is returned as result of
    db_foreach (or -1 when no select is empty).
 
-   Example 9. db_foreach usage
+   Example 1.9. db_foreach usage
         route["print_row"] {
         ....
         }
@@ -204,86 +284,87 @@ tra_ops ]
         }
         ...
 
-1.5.7. db_proper()
+5.7.  db_proper()
 
-   Hack which enables using db_ops queries in failure route. Call it at
+   Hack  which  enables using db_ops queries in failure route. Call it at
    the beginning of failure_route block.
 
-   Example 10. db_proper usage
+   Example 1.10. db_proper usage
         failure_route["my_failure"] {
                 db_proper();
                 db_query(my_query, my_handle);
         ....
         }
 
-1.5.8. @db.query.query_id
+5.8.  @db.query.query_id
 
    Returns value of the first row and the first field.
 
-   Example 11. db.query.query_id usage
+   Example 1.11. db.query.query_id usage
         if (@db.query.my_query == "my") {
         ....
         }
 
-1.5.9. @db.query.query_id.count
+5.9.  @db.query.query_id.count
 
    Returns number of rows in select query.
 
-   Example 12. db.query.query_id.count usage
+   Example 1.12. db.query.query_id.count usage
         if (@db.query.my_query.count == "2") {
         ....
         }
 
-1.5.10. @db.query.query_id.is_empty
+5.10.  @db.query.query_id.is_empty
 
    Returns 1 if select query is empty.
 
-   Example 13. db.query.query_id.is_empty usage
+   Example 1.13. db.query.query_id.is_empty usage
         if (@db.query.my_query.is_query == "1") {
                 # query is empty
         }
 
-1.5.11. @db.query.query_id.field[m]
+5.11.  @db.query.query_id.field[m]
 
-   Returns value of the first row and the m-th field. @*.field supports
+   Returns  value  of the first row and the m-th field. @*.field supports
    select_any_uri and select_any_nameaddr.
 
-   Example 14. db.query.query_id.field[m] usage
+   Example 1.14. db.query.query_id.field[m] usage
         if (@db.query.my_query.field[2] == "xyz") {
                 ...
         }
 
-1.5.12. @db.query.query_id.row[n]
+5.12.  @db.query.query_id.row[n]
 
-   Returns value of the n-th row and the first field, negative values
+   Returns  value  of  the  n-th row and the first field, negative values
    count from the end (-1 == last row).
 
-   Example 15. db.query.query_id.row[n] usage
+   Example 1.15. db.query.query_id.row[n] usage
         if (@db.query.my_query.row[2] == "xyz") {
                 ...
         }
 
-1.5.13. @db.query.query_id.row[n].field[m]
+5.13.  @db.query.query_id.row[n].field[m]
 
-   Returns value of the n-th row and the m-th field. @*.field supports
+   Returns  value  of  the n-th row and the m-th field. @*.field supports
    select_any_uri and select_any_nameaddr.
 
-   Example 16. db.query.query_id.row[n].field[m] usage
+   Example 1.16. db.query.query_id.row[n].field[m] usage
         if (@db.query.my_query.row[2].field[1] == "xyz") {
                 ...
         }
 
-1.5.14. @db.fetch.handle
+5.14.  @db.fetch.handle
 
-   Similar functionality as @db.query selects with exception that
+   Similar   functionality  as  @db.query  selects  with  exception  that
    operation is performed at query has been opened by db_query.
 
-   @db.fetch.handle.count invalidates current record, do db_seek/db_first!
+   @db.fetch.handle.count      invalidates     current     record,     do
+   db_seek/db_first!
 
    Note all opened queries are closed in POST_SCRIPT callback not to leak
    memory.
 
-   Example 17. db.fetch.handle usage
+   Example 1.17. db.fetch.handle usage
         db_query(sel1, my_handle);
         if (@db.fetch.my_handle.is_empty == "0") {
                 if (@db.fetch.my_handle == "xyz") {
@@ -292,11 +373,11 @@ tra_ops ]
         }
         db_close(my_handle);
 
-1.5.15. @db.fetch.handle.row_no
+5.15.  @db.fetch.handle.row_no
 
    Returns current row number (origin is zero).
 
-   Example 18. db.fetch.handle.row_no usage
+   Example 1.18. db.fetch.handle.row_no usage
         db_query(sel1, my_handle);
         ...
         db_next(my_handle);
@@ -310,59 +391,60 @@ tra_ops ]
         if (@db.fetch.my_handle.count == "10") {
                 ...
         }
-        if (@db.fetch.my_handle.row_no == "1") {        # always false because .
-count has invalidated current record!
+        if (@db.fetch.my_handle.row_no == "1") {        # always false because
+.count has invalidated current record!
 
         }
         db_close(my_handle);
 
-1.6. Examples
-
-   Example 19. db_ops common example
-modparam("db_ops", "declare_query", "sel1=select/location/received/uid///%$f.uid
-");
-modparam("db_ops", "declare_query", "sel2=select/subscriber/email_address,greeti
-ng/uid,allow_find///%$uidparam,1");
-modparam("db_ops", "declare_query", "sel3=select/silo/body/uid//inc_time/%$f.uid
-");
-modparam("db_ops", "declare_query", "del1=delete from location where expires<now
-()"); # raw query
-
-# @db.query.sel1             ..  SELECT received FROM location WHERE uid = "%$f.
-uid"
-# @db.query.sel1.count       ..  SELECT count(*) FROM location WHERE uid = "%$f.
-uid"
+6. Examples
+
+   Example 1.19. db_ops common example
+modparam("db_ops", "declare_query", "sel1=select/location/received/uid///%$f.ui
+d");
+modparam("db_ops", "declare_query", "sel2=select/subscriber/email_address,greet
+ing/uid,allow_find///%$uidparam,1");
+modparam("db_ops", "declare_query", "sel3=select/silo/body/uid//inc_time/%$f.ui
+d");
+modparam("db_ops", "declare_query", "del1=delete from location where expires<no
+w()"); # raw query
+
+# @db.query.sel1             ..  SELECT received FROM location WHERE uid = "%$f
+.uid"
+# @db.query.sel1.count       ..  SELECT count(*) FROM location WHERE uid = "%$f
+.uid"
 # @db.query.sel2.field[0]    ..  SELECT email_address FROM subscriber WHERE uid
-= "%$f.uid" AND allow_find=1
-# @db.query.sel2.field[1]    ..  SELECT greeting FROM subscriber WHERE uid = "%$
-f.uid" AND allow_find=1
-# @db.query.sel3.count       ..  SELECT count(*) FROM silo WHERE uid = "%$f.uid"
+ = "%$f.uid" AND allow_find=1
+# @db.query.sel2.field[1]    ..  SELECT greeting FROM subscriber WHERE uid = "%
+$f.uid" AND allow_find=1
+# @db.query.sel3.count       ..  SELECT count(*) FROM silo WHERE uid = "%$f.uid
+"
 # @db.query.sel1.is_empty
 
 
 db_query("delete/silo///");     #  DELETE FROM silo
-db_query("delete/silo/expired/<=/%Ts");     #  DELETE FROM silo WHERE expired <=
- now;
-db_query("insert/foo/bar,rab,abr,rbs/%$f.id,'hello world %fu',1,2");  # INSERT I
-NTO foo(bar,rab,abr,rbs) VALUES ("%$f.id","hello world %fu",1,2)
-db_query("update/foo/rab,abr/bar//'hello world %f',1,2,%$f.id");      # UPDATE f
-oo SET rab="hello world %fu",rbs=45 WHERE bar="%$f.id"
+db_query("delete/silo/expired/<=/%Ts");     #  DELETE FROM silo WHERE expired <
+= now;
+db_query("insert/foo/bar,rab,abr,rbs/%$f.id,'hello world %fu',1,2");  # INSERT
+INTO foo(bar,rab,abr,rbs) VALUES ("%$f.id","hello world %fu",1,2)
+db_query("update/foo/rab,abr/bar//'hello world %f',1,2,%$f.id");      # UPDATE
+foo SET rab="hello world %fu",rbs=45 WHERE bar="%$f.id"
 
 db_query("mysql://pretorian:sandra@net/delete/fbi/identities//");
 
-if (db_query("select/silo/body/uid//inc_time/%$f.uid", my_handle)) { #  SELECT b
-ody FROM silo WHERE uid = "%$f.uid" ORDER BY inc_time
+if (db_query("select/silo/body/uid//inc_time/%$f.uid", my_handle)) { #  SELECT
+body FROM silo WHERE uid = "%$f.uid" ORDER BY inc_time
     @db.fetch.my_handle             ..  get first raw
     if (db_next(my_handle)) {
         @db.fetch.my_handle      ..  get second raw
     }
 }
 
-if (db_query("select/silo/src_addr,dest_addr,body/uid//inc_time/%$t.uid", my_nex
-t_handle)) { # SELECT src_addr,dest_addr,body FROM silo WHERE uid = "%$t.uid" OR
-DER BY inc_time
-    @db.fetch.my_next_handle.row[-1].field[1]   .. get last dest_addr, not suppo
-rted now!
+if (db_query("select/silo/src_addr,dest_addr,body/uid//inc_time/%$t.uid", my_ne
+xt_handle)) { # SELECT src_addr,dest_addr,body FROM silo WHERE uid = "%$t.uid"
+ORDER BY inc_time
+    @db.fetch.my_next_handle.row[-1].field[1]   .. get last dest_addr, not supp
+orted now!
 }
 db_close(my_handle);
 db_close(my_next_handle);
@@ -397,20 +479,20 @@ modparam("timer", "declare_timer", "timer_route,1000,,enable");
 
 modparam("db_ops", "db_url", "mysql://admin:[email protected]:12345/ser");
 
-modparam("db_ops", "declare_query", "q1=select/location/uid,aor,contact,received
-//////"); #key=location_key,key_omit=i:3");
-modparam("db_ops", "declare_query", "q2=select/location/uid,aor,contact,received
-/uid///%$f.uid/key=location_key,key_omit=i:1");
+modparam("db_ops", "declare_query", "q1=select/location/uid,aor,contact,receive
+d//////"); #key=location_key,key_omit=i:3");
+modparam("db_ops", "declare_query", "q2=select/location/uid,aor,contact,receive
+d/uid///%$f.uid/key=location_key,key_omit=i:1");
 # select raw query not yet supported
-modparam("db_ops", "declare_query", "q3=select uid,aor,contact,received from loc
-ation where uid=?/%$f.uid");
-modparam("db_ops", "declare_query", "q4=mysql://admin:[email protected]:12345/
-ser/replace/location/uid,aor,contact,received,expires,q,callid,cseq,user_agent,i
-nstance,path,service_route,assoc_uri,flags,nated_contact,term_toi/QWERTY,aor@qqq
-,1.2.3.4:5678,1.2.3.4:5678;proto=tcp,d:1000,0.8,CAALL,6543,bubak,INSTANCE@bubak,
-sip:path_to_localhost,,,0,1,,");
-modparam("db_ops", "declare_query", "q5=mysql://admin:[email protected]:12345/
-ser/delete from location where uid=?/s:QWERTY");
+modparam("db_ops", "declare_query", "q3=select uid,aor,contact,received from lo
+cation where uid=?/%$f.uid");
+modparam("db_ops", "declare_query", "q4=mysql://admin:[email protected]:12345
+/ser/replace/location/uid,aor,contact,received,expires,q,callid,cseq,user_agent
+,instance,path,service_route,assoc_uri,flags,nated_contact,term_toi/QWERTY,aor@
+qqq,1.2.3.4:5678,1.2.3.4:5678;proto=tcp,d:1000,0.8,CAALL,6543,bubak,INSTANCE@bu
+bak,sip:path_to_localhost,,,0,1,,");
+modparam("db_ops", "declare_query", "q5=mysql://admin:[email protected]:12345
+/ser/delete from location where uid=?/s:QWERTY");
 
 modparam("db_ops", "declare_handle", "h0");
 modparam("db_ops", "declare_handle", "h1");
@@ -419,18 +501,18 @@ route["print_count"] {
 # testing count
         xplog("L_INFO", "print count\n");
         db_query("q1", "h1");
-        xplog("L_INFO", "fetch: row_no: %@db.fetch.h1.row_no, count: %@db.fetch.
-h1.count, row_no: %@db.fetch.h1.row_no, is_empty: %@db.fetch.h1.is_empty, row_no
-: %@db.fetch.h1.row_no\n");
+        xplog("L_INFO", "fetch: row_no: %@db.fetch.h1.row_no, count: %@db.fetch
+.h1.count, row_no: %@db.fetch.h1.row_no, is_empty: %@db.fetch.h1.is_empty, row_
+no: %@db.fetch.h1.row_no\n");
 
-        xplog("L_INFO", "query: is_empty: %@db.query.q1.is_empty, count: %@db.qu
-ery.q1.count\n");
+        xplog("L_INFO", "query: is_empty: %@db.query.q1.is_empty, count: %@db.q
+uery.q1.count\n");
 }
 
 route["print_record"] {
-        xplog("L_INFO","row_no: %@db.fetch.h0.row_no, record: %@db.fetch.h0.fiel
-d[0], %@db.fetch.h0.field[1],  %@db.fetch.h0.field[2],  %@db.fetch.h0.field[3]\n
-");
+        xplog("L_INFO","row_no: %@db.fetch.h0.row_no, record: %@db.fetch.h0.fie
+ld[0], %@db.fetch.h0.field[1],  %@db.fetch.h0.field[2],  %@db.fetch.h0.field[3]
+\n");
 
 }
 
@@ -485,12 +567,12 @@ route["db_test"] {
         db_foreach("h0", "print_record");
 
         xplog("L_INFO", "query test\n");
-        xplog("L_INFO", "#0: %@db.query.q1.row[0].field[0], %@db.query.q1.row[0]
-.field[1], %@db.query.q1.row[0].field[2], %@db.query.q1.row[0].field[3]\n");
-        xplog("L_INFO", "#1: %@db.query.q1.row[1].field[0], %@db.query.q1.row[1]
-.field[1], %@db.query.q1.row[1].field[2], %@db.query.q1.row[1].field[3]\n");
-        xplog("L_INFO", "#3: %@db.query.q1.row[3].field[0], %@db.query.q1.row[3]
-.field[1], %@db.query.q1.row[3].field[2], %@db.query.q1.row[3].field[3]\n");
+        xplog("L_INFO", "#0: %@db.query.q1.row[0].field[0], %@db.query.q1.row[0
+].field[1], %@db.query.q1.row[0].field[2], %@db.query.q1.row[0].field[3]\n");
+        xplog("L_INFO", "#1: %@db.query.q1.row[1].field[0], %@db.query.q1.row[1
+].field[1], %@db.query.q1.row[1].field[2], %@db.query.q1.row[1].field[3]\n");
+        xplog("L_INFO", "#3: %@db.query.q1.row[3].field[0], %@db.query.q1.row[3
+].field[1], %@db.query.q1.row[3].field[2], %@db.query.q1.row[3].field[3]\n");
 
 
 }

+ 69 - 43
modules/db_flatstore/README

@@ -1,3 +1,4 @@
+
 Db_flatstore Module
 
 Jan Janak
@@ -6,61 +7,86 @@ Jan Janak
    <[email protected]>
 
    Copyright © 2004, 2005 FhG FOKUS
-     __________________________________________________________________
+     _________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+
+              1.1. Rotating Log Files
+
+        2. Parameters
+
+              2.1. flush (integer)
+
+Chapter 1. Admin Guide
+
+   Table of Contents
+
+   1. Overview
+
+        1.1. Rotating Log Files
+
+   2. Parameters
+
+        2.1. flush (integer)
 
 1. Overview
 
    1.1. Rotating Log Files
 
-   Db_flatstore is one of the SIP Router database modules. It does not
+   Db_flatstore  is  one  of the SIP Router database modules. It does not
    export any functions executable from the configuration scripts, but it
-   exports a subset of functions from the database API and thus other
-   modules can use it as a database driver, instead of, for example, the
+   exports  a  subset  of  functions from the database API and thus other
+   modules  can use it as a database driver, instead of, for example, the
    Mysql module.
 
-   The module does not implement all functions of the database API, it
-   supports only one function, insert. This means that the module is
-   limited but very fast. It is especially suitable for storing accounting
-   information on sites with extremely high traffic. If MySQL is too slow
-   or if you get a huge amount of accounting data then you can consider
-   using this module. Please note that the acc module is the only module
-   that was tested with the flastore module.
-
-   The format of the files produced by this module is plain text. Each
-   line consists of several fields, fields are separated by the "|"
-   character (vertical bar). New information is always appended at the end
-   of the file. Searching, deleting and updating of existing data is not
-   supported by the module.
-
-   The acc module can be configured to use db_flatstore module as database
-   backend using the db_url_parameter:
+   The  module  does  not implement all functions of the database API, it
+   supports  only  one  function,  insert.  This means that the module is
+   limited   but  very  fast.  It  is  especially  suitable  for  storing
+   accounting  information on sites with extremely high traffic. If MySQL
+   is  too  slow  or if you get a huge amount of accounting data then you
+   can consider using this module. Please note that the acc module is the
+   only module that was tested with the flastore module.
+
+   The  format  of  the files produced by this module is plain text. Each
+   line  consists  of  several  fields,  fields  are separated by the "|"
+   character  (vertical  bar).  New information is always appended at the
+   end  of the file. Searching, deleting and updating of existing data is
+   not supported by the module.
+
+   The  acc  module  can  be  configured  to  use  db_flatstore module as
+   database backend using the db_url_parameter:
 modparam("acc", "db_url", "flatstore:/var/log/acc")
 
-   This configuration option tells the acc module that it should use the
-   db_flatstore module and the db_flatstore module should create all files
-   in the /var/log/acc directory. The directory must exist and SIP Router
-   processes must have permissions to create files in that directory.
+   This  configuration option tells the acc module that it should use the
+   db_flatstore  module  and  the  db_flatstore  module should create all
+   files  in the /var/log/acc directory. The directory must exist and SIP
+   Router  processes  must  have  permissions  to  create  files  in that
+   directory.
 
    Name of files in that directory will follow the following pattern:
 <table_name>_<process_name>.log
 
-   For example, entries writen by the SIP Router process 8 into the acc
+   For  example,  entries writen by the SIP Router process 8 into the acc
    table would be written in file acc_8.log. For each table there will be
-   several files, one file for every SIP Router process that wrote some
-   data into that table. The main reason why there are several files for
-   each table is that it is much faster to have one file per process,
-   because it does not require any locking and thus SIP Router processes
-   will not block each other. To get the complete data for a table you can
-   simply concatenate the contents of files with the same table name but
-   different process id.
+   several  files,  one file for every SIP Router process that wrote some
+   data  into that table. The main reason why there are several files for
+   each  table  is  that  it is much faster to have one file per process,
+   because  it does not require any locking and thus SIP Router processes
+   will  not  block  each other. To get the complete data for a table you
+   can  simply concatenate the contents of files with the same table name
+   but different process id.
 
 1.1. Rotating Log Files
 
    The module implements a SIP Router management interface command called
-   flatstore.rotate. When SIP Router receives the command it will close
-   and reopen all files used by the db_flatstore module. The rotation
-   itself has to be done by another application (such as logrotate).
-   Follow these steps to rotate files generated by the db_flatstore
+   flatstore.rotate.  When  SIP Router receives the command it will close
+   and  reopen  all  files  used by the db_flatstore module. The rotation
+   itself  has  to  be  done  by another application (such as logrotate).
+   Follow  these  steps  to  rotate  files  generated by the db_flatstore
    module:
      * Rename the files that you want to rotate:
 cd /var/log/acc
@@ -68,16 +94,16 @@ mv acc_1.log acc_1.log.20050605
 mv acc_2.log acc_2.log.20050605
 mv acc_4.log acc_3.log.20050605
 ...
-       Note that at this point SIP Router will still be writing all data
+       Note  that at this point SIP Router will still be writing all data
        into the renamed files.
-     * Send SIP Router the management command to close and reopen the
+     * Send  SIP  Router  the  management command to close and reopen the
        renamed files:
-sercmd flatstore.rotate
+kamcmd flatstore.rotate
        This will force SIP Router to close the renamed files and open new
-       ones with original names, such as acc_1.log. New files will be open
-       at the point when SIP Router has some data to write. It is normal
-       that the files will be not created immediately if there is no
-       traffic on the SIP server.
+       ones  with  original  names,  such as acc_1.log. New files will be
+       open  at  the  point when SIP Router has some data to write. It is
+       normal  that the files will be not created immediately if there is
+       no traffic on the SIP server.
      * Move the renamed files somewhere else and process them.
 
 2. Parameters

+ 191 - 184
modules/iptrtpproxy/README

@@ -1,3 +1,4 @@
+
 The Iptrtpproxy module
 
 Tomas Mandys
@@ -5,11 +6,11 @@ Tomas Mandys
    Iptel.org
 
    Copyright © 2007 Tomas Mandys
-     __________________________________________________________________
+     _________________________________________________________________
 
    Table of Contents
 
-   1.
+   1. Admin Guide
 
         1. Overview
         2. Dependencies
@@ -24,32 +25,32 @@ Tomas Mandys
 
         4. Functions
 
-              4.1. iptrtpproxy_alloc(gate_a_to_b [, existing_sess_ids])
-              4.2. iptrtpproxy_update(gate_a_to_b, session_ids)
-              4.3. iptrtpproxy_adjust_timeout(gate_a_to_b, session_ids)
-              4.4. iptrtpproxy_delete(session_ids)
-              4.5. iptrtpproxy_authorize_media()
-              4.6. iptrtpproxy_set_param(param, value)
+              4.1. iptrtpproxy_alloc(gate_a_to_b [, existing_sess_ids]) 
+              4.2. iptrtpproxy_update(gate_a_to_b, session_ids) 
+              4.3. iptrtpproxy_adjust_timeout(gate_a_to_b, session_ids) 
+              4.4. iptrtpproxy_delete(session_ids) 
+              4.5. iptrtpproxy_authorize_media() 
+              4.6. iptrtpproxy_set_param(param, value) 
               4.7.
-                      iptrtpproxy_set_param("(aggregation/switchboard)_by_sip_
-                      ip_(a/b)", sip_ip)
+                      iptrtpproxy_set_param("(aggregation/switchboard)_by_sip
+                      _ip_(a/b)", sip_ip) 
 
               4.8. iptrtpproxy_set_param("protected_session_ids",
-                      sess_ids)
+                      sess_ids) 
 
-              4.9. iptrtpproxy_set_param("o_name", value)
-              4.10. iptrtpproxy_set_param("o_addr", value)
-              4.11. iptrtpproxy_set_param("codec_set", value)
-              4.12. iptrtpproxy_set_param("remove_codec_mask", value)
+              4.9. iptrtpproxy_set_param("o_name", value) 
+              4.10. iptrtpproxy_set_param("o_addr", value) 
+              4.11. iptrtpproxy_set_param("codec_set", value) 
+              4.12. iptrtpproxy_set_param("remove_codec_mask", value) 
 
         5. Selects
 
-              5.1. @iptrtpproxy.session_ids
-              5.2. @iptrtpproxy.sdp_ip
-              5.3. @iptrtpproxy.o_name
-              5.4. @iptrtpproxy.o_addr
-              5.5. @iptrtpproxy.auth_rights
-              5.6. @iptrtpproxy.active_media_num
+              5.1. @iptrtpproxy.session_ids 
+              5.2. @iptrtpproxy.sdp_ip 
+              5.3. @iptrtpproxy.o_name 
+              5.4. @iptrtpproxy.o_addr 
+              5.5. @iptrtpproxy.auth_rights 
+              5.6. @iptrtpproxy.active_media_num 
 
    List of Examples
 
@@ -61,6 +62,8 @@ Tomas Mandys
    1.6. iptrtpproxy_delete usage
    1.7. iptrtpproxy_authorize_media usage
 
+Chapter 1. Admin Guide
+
    Table of Contents
 
    1. Overview
@@ -76,55 +79,55 @@ Tomas Mandys
 
    4. Functions
 
-        4.1. iptrtpproxy_alloc(gate_a_to_b [, existing_sess_ids])
-        4.2. iptrtpproxy_update(gate_a_to_b, session_ids)
-        4.3. iptrtpproxy_adjust_timeout(gate_a_to_b, session_ids)
-        4.4. iptrtpproxy_delete(session_ids)
-        4.5. iptrtpproxy_authorize_media()
-        4.6. iptrtpproxy_set_param(param, value)
+        4.1. iptrtpproxy_alloc(gate_a_to_b [, existing_sess_ids]) 
+        4.2. iptrtpproxy_update(gate_a_to_b, session_ids) 
+        4.3. iptrtpproxy_adjust_timeout(gate_a_to_b, session_ids) 
+        4.4. iptrtpproxy_delete(session_ids) 
+        4.5. iptrtpproxy_authorize_media() 
+        4.6. iptrtpproxy_set_param(param, value) 
         4.7.
-                iptrtpproxy_set_param("(aggregation/switchboard)_by_sip_ip_(a/
-                b)", sip_ip)
+                iptrtpproxy_set_param("(aggregation/switchboard)_by_sip_ip_(a
+                /b)", sip_ip) 
 
-        4.8. iptrtpproxy_set_param("protected_session_ids", sess_ids)
-        4.9. iptrtpproxy_set_param("o_name", value)
-        4.10. iptrtpproxy_set_param("o_addr", value)
-        4.11. iptrtpproxy_set_param("codec_set", value)
-        4.12. iptrtpproxy_set_param("remove_codec_mask", value)
+        4.8. iptrtpproxy_set_param("protected_session_ids", sess_ids) 
+        4.9. iptrtpproxy_set_param("o_name", value) 
+        4.10. iptrtpproxy_set_param("o_addr", value) 
+        4.11. iptrtpproxy_set_param("codec_set", value) 
+        4.12. iptrtpproxy_set_param("remove_codec_mask", value) 
 
    5. Selects
 
-        5.1. @iptrtpproxy.session_ids
-        5.2. @iptrtpproxy.sdp_ip
-        5.3. @iptrtpproxy.o_name
-        5.4. @iptrtpproxy.o_addr
-        5.5. @iptrtpproxy.auth_rights
-        5.6. @iptrtpproxy.active_media_num
+        5.1. @iptrtpproxy.session_ids 
+        5.2. @iptrtpproxy.sdp_ip 
+        5.3. @iptrtpproxy.o_name 
+        5.4. @iptrtpproxy.o_addr 
+        5.5. @iptrtpproxy.auth_rights 
+        5.6. @iptrtpproxy.active_media_num 
 
 1. Overview
 
-   This module provides similar functionality as nathelper but
-   communicates with netfilter kernel xt_RTPPROXY module using the
-   libipt_RTPPROXY userspace library. All RTP streams are manipulated
-   directly in kernel space, no data is copied from kernel to userspace
+   This   module   provides   similar   functionality  as  nathelper  but
+   communicates  with  netfilter  kernel  xt_RTPPROXY  module  using  the
+   libipt_RTPPROXY  userspace  library.  All  RTP streams are manipulated
+   directly  in  kernel space, no data is copied from kernel to userspace
    and back, it reduces load and delay. See
    http://www.2p.cz/en/netfilter_rtp_proxy for more details.
 
-   This Kamailio module is written as a light-weight module, there is no
-   dialog managment as in Nathelper. The reason is that such an API should
-   be provided by core or a specialized dialog manager module. Because
-   such module is not in git, session information may be stored in extra
-   attributes of the avp_db module and the session id itself in record
-   route as cookie, see the rr module.
+   This  Kamailio module is written as a light-weight module, there is no
+   dialog  managment  as  in  Nathelper.  The  reason is that such an API
+   should  be  provided  by  core or a specialized dialog manager module.
+   Because  such  module is not in git, session information may be stored
+   in  extra attributes of the avp_db module and the session id itself in
+   record route as cookie, see the rr module.
 
-   It should be able to support all cases as re-invites when SIP client
-   offers media change in SDP and when number of medias in offer/answer
+   It  should  be able to support all cases as re-invites when SIP client
+   offers  media  change in SDP and when number of medias in offer/answer
    are different.
 
    Nathelper may be still used for testing if client is behind the NAT.
 
-   There is also support for media authorization. Number of codec sets may
-   be defined. When a message containing SDP offer/answer is being
+   There  is  also  support for media authorization. Number of codec sets
+   may  be  defined.  When a message containing SDP offer/answer is being
    processed then current codecs and streams may be inspected, removed or
    signallized according a codec set.
 
@@ -134,14 +137,14 @@ Tomas Mandys
 
 2. Dependencies
 
-   The following libraries or applications must be installed before
+   The  following  libraries  or  applications  must  be installed before
    running Kamailio with this module loaded:
-     * netfilter xt_RTPPROXY & libipt_RTPPROXY, see
+     * netfilter       xt_RTPPROXY       &      libipt_RTPPROXY,      see
        http://www.2p.cz/en/netfilter_rtp_proxy
 
 Note
 
-   The modules Makefile must be edited and iptdir setup to the directory
+   The  modules Makefile must be edited and iptdir setup to the directory
    with the iptable sources (if different from ~/iptables). Alternatively
    compile the module using:
                 make -C modules/iptrtpproxy iptdir=path_to_iptables_src
@@ -157,8 +160,8 @@ Note
 
 3.1. config (string)
 
-   References iptrtpproxy.cfg, see iptrtpproxy_helper. Default value is
-   /etc/iptrtpproxy.cfg. If only codec authorization is to be used then
+   References  iptrtpproxy.cfg,  see iptrtpproxy_helper. Default value is
+   /etc/iptrtpproxy.cfg.  If  only codec authorization is to be used then
    /dev/null may be used.
 
 3.2. switchboard (string)
@@ -170,25 +173,26 @@ Note
 
   name =  "aggregation" | "sip-addr-"
 
-   The name is the switchboard name as declared in config and will be used
-   by script functions and references switchboard. It's mandatory
+   The  name  is  the  switchboard name as declared in config and will be
+   used  by  script  functions and references switchboard. It's mandatory
    parameter. The special name * set values for all switchboards.
 
-   The sip-addr is address used by iptrtpproxy_ser_param(by_sip_ip) to
-   find a switchboard for particular connection. If not explicitly
-   configured then RTP switchboard gate address are used for this feature.
+   The  sip-addr  is  address used by iptrtpproxy_ser_param(by_sip_ip) to
+   find  a  switchboard  for  particular  connection.  If  not explicitly
+   configured  then  RTP  switchboard  gate  address  are  used  for this
+   feature.
 
-   The aggregation enables to aggregate more switchboards in cluster and
-   to widden bandwidth. Aggregation will take sip-addr from the first
+   The  aggregation enables to aggregate more switchboards in cluster and
+   to  widden  bandwidth.  Aggregation  will take sip-addr from the first
    switchboard of its.
 
    Example 1.1. Declare switchboard
         ...
         modparam("iptrtpproxy", "config", "/etc/iptrtpproxy.cfg");
-        modparam("iptrtpproxy", "switchboard", "name=my1;sip-addr-a=1.2.3.4;sip-
-addr-b=5.6.7.8");
-        modparam("iptrtpproxy", "switchboard", "name=my2;sip-addr-a=2.3.4.5;sip-
-addr-b=3.4.5.6;aggregation=my23");
+        modparam("iptrtpproxy", "switchboard", "name=my1;sip-addr-a=1.2.3.4;sip
+-addr-b=5.6.7.8");
+        modparam("iptrtpproxy", "switchboard", "name=my2;sip-addr-a=2.3.4.5;sip
+-addr-b=3.4.5.6;aggregation=my23");
         modparam("iptrtpproxy", "switchboard", "name=my3;aggregation=my23");
         modparam("iptrtpproxy", "switchboard", "name=*;aggregation=my123");
         ...
@@ -197,14 +201,14 @@ addr-b=3.4.5.6;aggregation=my23");
 
    Timeout in seconds used for rerequest remote RTP proxy via RPC command
    after preceeding error. In other words if a RPC server is unresponsive
-   at the moment then next attempt will be forced after this timeout.
+   at  the  moment  then  next attempt will be forced after this timeout.
    Default value is 30.
 
 3.4. hostname (string)
 
-   The hostname used by RPC to identify machine where Ser is running to
-   communicate which RTP proxy via local interface. Default value is taken
-   from system hostname.
+   The  hostname  used by RPC to identify machine where Ser is running to
+   communicate  which  RTP  proxy  via  local interface. Default value is
+   taken from system hostname.
 
 3.5. declare_codec (string)
 
@@ -213,110 +217,112 @@ addr-b=3.4.5.6;aggregation=my23");
 
 3.6. codec_set (string)
 
-   Declares new codec set. Codecs are declared for each media type
+   Declares  new  codec  set.  Codecs  are  declared  for each media type
    independently.
 
    The format is:
   "name=" value * ( ";" name "=" value )
 
   name =  "media_type" | "rights" | "codecs" | "max_streams" | ( "rtp" | "rtcp"
-) "_" ( "bytes" | "packets" )
+ ) "_" ( "bytes" | "packets" )
 
   media_types = "audio" | "video" | "application" | "text" | "message" | "data"
-| "control" | "?" | "*"
+ | "control" | "?" | "*"
 
    The name is the codec set name to be defined.
 
-   The media_type belongs to type at m= SDP line. Question mark means
+   The  media_type  belongs  to  type at m= SDP line. Question mark means
    "unknown media" type and asterisk "all media types".
 
-   The max_streams defines how many streams (m= lines) is allowed per
+   The  max_streams  defines  how  many streams (m= lines) is allowed per
    media type.
 
-   The rights defines if particular codec is allowed 0, disallowed, i.e.
-   will be removed if bit AND operation with remove_codec_mask is non-zero
-   or its presence will be signallized by @iptrtpproxy.auth_rights (any
-   other value).
+   The  rights defines if particular codec is allowed 0, disallowed, i.e.
+   will  be  removed  if  bit  AND  operation  with  remove_codec_mask is
+   non-zero     or     its    presence    will    be    signallized    by
+   @iptrtpproxy.auth_rights (any other value).
 
-   The codecs comma separated list of codecs. Previous media_type&rights
+   The  codecs comma separated list of codecs. Previous media_type&rights
    will be applied.
 
-   The rtp/rtcp_bytes/packets limits bandwidth per media_type (0 is
-   unlimited). It will override bandwidth limited by
+   The  rtp/rtcp_bytes/packets  limits  bandwidth  per  media_type  (0 is
+   unlimited).     It     will     override    bandwidth    limited    by
    iptrtpproxy_set_param("throttle_*").
 
    Example 1.2. Declare codec_set
         ...
         # enable all codecs, default state when codec is declared
-        modparam("iptrtpproxy", "codec_set", "name=cs1;media_type=*;max_streams=
-9999;rights=0;codecs=*");
+        modparam("iptrtpproxy", "codec_set", "name=cs1;media_type=*;max_streams
+=9999;rights=0;codecs=*");
         # allow only 2 audio and 1 video stream
-        modparam("iptrtpproxy", "codec_set", "name=cs2;media_type=*;max_streams=
-0;media_type=audio;max_streams=2;media_type=video;max_streams=1");
-        # dtto, allow only a few audio and video codecs, GSM codec is allowed bu
-t signallized
-        modparam("iptrtpproxy", "codec_set", "name=cs3;media_type=*;max_streams=
-0;rights=1;codecs=*;media_type=audio;max_streams=2;rights=0;codecs=PCMU,G729,G72
-8,parityfec,telephone-events;rights=2;codecs=GSM;media_type=video;max_streams=1;
-rights=0;codecs=jpeg,parityfec");
+        modparam("iptrtpproxy", "codec_set", "name=cs2;media_type=*;max_streams
+=0;media_type=audio;max_streams=2;media_type=video;max_streams=1");
+        # dtto, allow only a few audio and video codecs, GSM codec is allowed b
+ut signallized
+        modparam("iptrtpproxy", "codec_set", "name=cs3;media_type=*;max_streams
+=0;rights=1;codecs=*;media_type=audio;max_streams=2;rights=0;codecs=PCMU,G729,G
+728,parityfec,telephone-events;rights=2;codecs=GSM;media_type=video;max_streams
+=1;rights=0;codecs=jpeg,parityfec");
         # limit max. bandwidth for video¨
-        modparam("iptrtpproxy", "codec_set", "name=cs4;media_type=video;rtp_byte
-s=10000;rtcp_bytes=1000");
+        modparam("iptrtpproxy", "codec_set", "name=cs4;media_type=video;rtp_byt
+es=10000;rtcp_bytes=1000");
         ...
 
 4. Functions
 
-   4.1. iptrtpproxy_alloc(gate_a_to_b [, existing_sess_ids])
-   4.2. iptrtpproxy_update(gate_a_to_b, session_ids)
-   4.3. iptrtpproxy_adjust_timeout(gate_a_to_b, session_ids)
-   4.4. iptrtpproxy_delete(session_ids)
-   4.5. iptrtpproxy_authorize_media()
-   4.6. iptrtpproxy_set_param(param, value)
-   4.7. iptrtpproxy_set_param("(aggregation/switchboard)_by_sip_ip_(a/b)",
-          sip_ip)
-
-   4.8. iptrtpproxy_set_param("protected_session_ids", sess_ids)
-   4.9. iptrtpproxy_set_param("o_name", value)
-   4.10. iptrtpproxy_set_param("o_addr", value)
-   4.11. iptrtpproxy_set_param("codec_set", value)
-   4.12. iptrtpproxy_set_param("remove_codec_mask", value)
+   4.1. iptrtpproxy_alloc(gate_a_to_b [, existing_sess_ids]) 
+   4.2. iptrtpproxy_update(gate_a_to_b, session_ids) 
+   4.3. iptrtpproxy_adjust_timeout(gate_a_to_b, session_ids) 
+   4.4. iptrtpproxy_delete(session_ids) 
+   4.5. iptrtpproxy_authorize_media() 
+   4.6. iptrtpproxy_set_param(param, value) 
+   4.7.
+          iptrtpproxy_set_param("(aggregation/switchboard)_by_sip_ip_(a/b)",
+          sip_ip) 
+
+   4.8. iptrtpproxy_set_param("protected_session_ids", sess_ids) 
+   4.9. iptrtpproxy_set_param("o_name", value) 
+   4.10. iptrtpproxy_set_param("o_addr", value) 
+   4.11. iptrtpproxy_set_param("codec_set", value) 
+   4.12. iptrtpproxy_set_param("remove_codec_mask", value) 
 
 4.1.  iptrtpproxy_alloc(gate_a_to_b [, existing_sess_ids])
 
-   Parses SDP content and allocates for each RTP media stream one RTP
-   proxy session. SDP is updates to reflect allocated sessions.
-   Switchboard/aggregation is set using iptrtpproxy_set_param(by_sip_ip)
+   Parses  SDP  content  and  allocates for each RTP media stream one RTP
+   proxy   session.   SDP  is  updates  to  reflect  allocated  sessions.
+   Switchboard/aggregation  is set using iptrtpproxy_set_param(by_sip_ip)
    or iptrtpproxy_set_param("switchboard/aggregation").
 
-   Aggregation supports load balancing among more RTP proxies controlled
-   by RPC. The module try to allocate at machines/switchboards in
-   following order (priorities) not yet asked (or being heartbeated)
-   machines, responsive machines, switchboards having percentualy more
+   Aggregation  supports load balancing among more RTP proxies controlled
+   by  RPC.  The  module  try  to  allocate  at  machines/switchboards in
+   following  order  (priorities)  not  yet  asked (or being heartbeated)
+   machines,  responsive  machines,  switchboards having percentualy more
    free slots, non responsive machines.
 
-   Proxy may hide caller identity provided at o= line using
-   @iptrtpproxy.o_name/addr and iptrtpproxy_set_param(o_name/addr)
-   functions. But the script is responsible for rewritting to original
-   values in a response or a callee initiated re-INVITE. Therefore
+   Proxy   may   hide   caller   identity   provided  at  o=  line  using
+   @iptrtpproxy.o_name/addr     and    iptrtpproxy_set_param(o_name/addr)
+   functions.  But  the  script is responsible for rewritting to original
+   values  in  a  response  or  a  callee  initiated re-INVITE. Therefore
    original value need to be stored in-dialog.
-     * if gate_a_to_b bit 0 is set then SDP regards to gate-a to gate-b
+     * if  gate_a_to_b  bit 0 is set then SDP regards to gate-a to gate-b
        direction.
-     * protected_session_ids list of existing sessions enables reusing
-       already allocated sessions in re-INVITE without allocating new
-       sessions for each stream in SDP regardless a IP/port is required.
+     * protected_session_ids  list  of  existing sessions enables reusing
+       already  allocated  sessions  in  re-INVITE without allocating new
+       sessions  for each stream in SDP regardless a IP/port is required.
        It's mostly undesirable, typically "hold-on" is done via re-INVITE
        without any change. There is drawback because callee cannot change
-       IP:port in 200OK which is legal case in RFC3264. But because some
-       non-RFC3264 compliant phones dislike proactively changed IP:port at
-       RTP proxy it seems it's less evil.
-     * function returns true is a session was created, identifier is
+       IP:port  in 200OK which is legal case in RFC3264. But because some
+       non-RFC3264  compliant  phones dislike proactively changed IP:port
+       at RTP proxy it seems it's less evil.
+     * function  returns  true  is  a  session was created, identifier is
        available via select @iptrtpproxy.session_ids.
 
    Example 1.3. iptrtpproxy_alloc usage
         ...
-        if (!iptrtpproxy_set_param("aggregation_by_sip_ip_a", "@received.ip")) {
-                if (!iptrtpproxy_set_param("switchboard_by_sip_ip_a", "@received
-.ip")) {
+        if (!iptrtpproxy_set_param("aggregation_by_sip_ip_a", "@received.ip"))
+{
+                if (!iptrtpproxy_set_param("switchboard_by_sip_ip_a", "@receive
+d.ip")) {
                         t_reply("500", "RTP proxy error");
                         drop;
                 }
@@ -324,19 +330,19 @@ s=10000;rtcp_bytes=1000");
         eval_push("x:%@next_hop.src_ip");
         if (@eval.get[-1] == @received.ip) {
                 if (@iptrtpproxy.aggregation_a) {
-                        iptrtpproxy_set_param("aggregation_b", "@iptrtpproxy.agg
-regation_a");
+                        iptrtpproxy_set_param("aggregation_b", "@iptrtpproxy.ag
+gregation_a");
                 }
                 else {
-                        iptrtpproxy_set_param("switchboard_b", "@iptrtpproxy.swi
-tchboard_a");
+                        iptrtpproxy_set_param("switchboard_b", "@iptrtpproxy.sw
+itchboard_a");
                 }
         }
         else {
-                if (!iptrtpproxy_set_param("aggregation_by_sip_ip_b", "@eval.get
-[-1]")) {
-                        if (!iptrtpproxy_set_param("switchboard_by_sip_ip_b", "@
-eval.get[-1]")) {
+                if (!iptrtpproxy_set_param("aggregation_by_sip_ip_b", "@eval.ge
+t[-1]")) {
+                        if (!iptrtpproxy_set_param("switchboard_by_sip_ip_b", "
+@eval.get[-1]")) {
                                 t_reply("500", "RTP proxy error");
                                 drop;
                         }
@@ -353,20 +359,20 @@ eval.get[-1]")) {
 
 4.2.  iptrtpproxy_update(gate_a_to_b, session_ids)
 
-   Parses SDP content and updates sessions provided by session_ids and
-   updates SDP. If succesfull then session_ids may be changed (in case
-   e.g. media stream has port zero particular session is released), the
-   result of @iptrtpproxy.session_ids should be stored for future
+   Parses  SDP  content  and updates sessions provided by session_ids and
+   updates  SDP.  If  succesfull then session_ids may be changed (in case
+   e.g.  media  stream has port zero particular session is released), the
+   result   of  @iptrtpproxy.session_ids  should  be  stored  for  future
    in-dialog usage.
 
    The SDP contect is also affected by iptrtpproxy_set_param(o_name/addr)
-   functions. If a stream is deactivated in SDP then Sessions may be
+   functions.  If  a  stream  is  deactivated in SDP then Sessions may be
    deleted unless mentioned in protected_session_ids.
-     * if gate_a_to_b bit 0 is set then SDP regards to gate-a to gate-b
+     * if  gate_a_to_b  bit 0 is set then SDP regards to gate-a to gate-b
        direction.
-       if gate_a_to_b bit 1 is set then SDP is updated only, no RTP
-       session are affected. Should be used when handling retransmission
-       in onreply route, retransmission replies are not eaten be tm
+       if  gate_a_to_b  bit  1  is  set  then SDP is updated only, no RTP
+       session  are affected. Should be used when handling retransmission
+       in  onreply  route,  retransmission  replies  are  not eaten be tm
        module!
 
    Example 1.4. iptrtpproxy_update usage
@@ -380,9 +386,9 @@ eval.get[-1]")) {
 
 4.3.  iptrtpproxy_adjust_timeout(gate_a_to_b, session_ids)
 
-   Adjust timeout for particular gate. It's useful in "200 OK" decrease
+   Adjust  timeout  for particular gate. It's useful in "200 OK" decrease
    timeout to learning timeout if INVITE has set (long) ringing timeout.
-     * if gate_a_to_b bit 0 is set then it regards to gate-a to gate-b
+     * if  gate_a_to_b  bit  0 is set then it regards to gate-a to gate-b
        direction.
 
    Example 1.5. iptrtpproxy_adjust_timeout usage
@@ -400,9 +406,9 @@ eval.get[-1]")) {
 
 4.4.  iptrtpproxy_delete(session_ids)
 
-   Delete sessions identified by session_ids. May be used when dialog is
-   being destroyed (BYE) or when INVITE failed in failure route. If
-   protected_session_ids list is provided then this set is excluded from
+   Delete  sessions identified by session_ids. May be used when dialog is
+   being  destroyed  (BYE)  or  when  INVITE  failed in failure route. If
+   protected_session_ids  list is provided then this set is excluded from
    sessions to be deleted.
 
    Example 1.6. iptrtpproxy_delete usage
@@ -414,13 +420,13 @@ eval.get[-1]")) {
 4.5.  iptrtpproxy_authorize_media()
 
    Authorizes SDP media according currect codec_set. If bit AND operation
-   between rights in codec set and remove_codec_mask is non zero then such
-   a codec are to be removed. The result may be obtained from
-   @iptrtpproxy.auth_rights which returns max. right which has been
+   between  rights  in  codec  set and remove_codec_mask is non zero then
+   such  a  codec  are  to  be  removed.  The result may be obtained from
+   @iptrtpproxy.auth_rights  which  returns  max.  right  which  has been
    applied when processing all codecs of enabled streams.
 
-   The function MUST NOT be called after iptrtpproxy_alloc/update! But the
-   function may be called several times to authorize using more codec
+   The  function  MUST  NOT be called after iptrtpproxy_alloc/update! But
+   the function may be called several times to authorize using more codec
    sets.
 
    Example 1.7. iptrtpproxy_authorize_media usage
@@ -452,22 +458,22 @@ eval.get[-1]")) {
 4.6.  iptrtpproxy_set_param(param, value)
 
    Set particular parameter needed mainly by
-   iptrtpproxy_alloc/update/adjust_timeout. The paramter value is availble
-   via @iptrtpproxy.<param>.
-     * Supported parameters: expiration_timeout, ttl, learning_timeout,
-       always_learn, aggregation_a, aggregation_b, switchboard_a,
-       switchboard_b, throttle_mark, throttle_rtp_max_bytes,
-       throttle_rtp_max_packets, throttle_rtcp_max_bytes,
+   iptrtpproxy_alloc/update/adjust_timeout.   The   paramter   value   is
+   availble via @iptrtpproxy.<param>.
+     * Supported  parameters:  expiration_timeout, ttl, learning_timeout,
+       always_learn,    aggregation_a,    aggregation_b,   switchboard_a,
+       switchboard_b,        throttle_mark,       throttle_rtp_max_bytes,
+       throttle_rtp_max_packets,                 throttle_rtcp_max_bytes,
        throttle_rtcp_max_packets.
 
 4.7.  iptrtpproxy_set_param("(aggregation/switchboard)_by_sip_ip_(a/b)",
 sip_ip)
 
-   Find corresponding aggregation or switchboard and set
-   @iptrtpproxy.aggregation_a/b or @iptrtpproxy.switchboard_a/b.
-   Switchboards/aggregations are compared against sip-addr, it allow
+   Find    corresponding    aggregation    or    switchboard    and   set
+   @iptrtpproxy.aggregation_a/b      or     @iptrtpproxy.switchboard_a/b.
+   Switchboards/aggregations  are  compared  against  sip-addr,  it allow
    separate SIP and RTP traffic and RTP aggregation.
-     * sip_ip IP to be compared, typically @received.ip or
+     * sip_ip    IP   to   be   compared,   typically   @received.ip   or
        @next_hop.src_ip.
      * function returns true if switchboard/aggregation was found
 
@@ -478,8 +484,9 @@ sip_ip)
 
 4.9.  iptrtpproxy_set_param("o_name", value)
 
-   Username to be rewritten at o= line by iptrtpproxy_alloc/update to hide
-   caller identity. If value is blank then username is left unchanged.
+   Username  to  be  rewritten  at o= line by iptrtpproxy_alloc/update to
+   hide  caller  identity.  If  value  is  blank  then  username  is left
+   unchanged.
 
 4.10.  iptrtpproxy_set_param("o_addr", value)
 
@@ -488,7 +495,7 @@ sip_ip)
 
 4.11.  iptrtpproxy_set_param("codec_set", value)
 
-   Codec set for iptrtpproxy_authorize_media. Current codec set may be
+   Codec  set  for  iptrtpproxy_authorize_media. Current codec set may be
    obtained by @iptrtpproxy.codec_set.
 
 4.12.  iptrtpproxy_set_param("remove_codec_mask", value)
@@ -498,20 +505,20 @@ sip_ip)
 
 5. Selects
 
-   5.1. @iptrtpproxy.session_ids
-   5.2. @iptrtpproxy.sdp_ip
-   5.3. @iptrtpproxy.o_name
-   5.4. @iptrtpproxy.o_addr
-   5.5. @iptrtpproxy.auth_rights
-   5.6. @iptrtpproxy.active_media_num
+   5.1. @iptrtpproxy.session_ids 
+   5.2. @iptrtpproxy.sdp_ip 
+   5.3. @iptrtpproxy.o_name 
+   5.4. @iptrtpproxy.o_addr 
+   5.5. @iptrtpproxy.auth_rights 
+   5.6. @iptrtpproxy.active_media_num 
 
 5.1.  @iptrtpproxy.session_ids
 
    Returns sessions allocated/updated in iptrtpproxy_alloc/update.
 
    The format is:
-switchboard_name [ ":" [ session_id "/" created ] * ( "," session_id "/" created
- ) ] ]
+switchboard_name [ ":" [ session_id "/" created ] * ( "," session_id "/" create
+d ) ] ]
 session_id = * ( [0-9] )   ; empty when no session allocated
 created = timestamp
 
@@ -533,6 +540,6 @@ created = timestamp
 
 5.6.  @iptrtpproxy.active_media_num
 
-   Returns number of active media streams in SDP.
-   iptrtpproxy_authorize_media may disable some streams, i.e. returned
+   Returns     number     of     active    media    streams    in    SDP.
+   iptrtpproxy_authorize_media  may  disable  some streams, i.e. returned
    value may change after authorization.

+ 115 - 57
modules/malloc_test/README

@@ -1,3 +1,4 @@
+
 The malloc_test Module
 
 Andrei Pelinescu-Onciul
@@ -5,28 +6,84 @@ Andrei Pelinescu-Onciul
    iptelorg GmbH
 
    Copyright © 2010 iptelorg GmbH
-     __________________________________________________________________
+     _________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+        2. Parameters
+
+              2.1. check_content
+
+        3. Functions
+
+              3.1. mt_mem_alloc(size)
+              3.2. mt_mem_free()
+
+        4. malloc_test RPC Functions
+
+              4.1. mt.mem_alloc size [unit]
+              4.2. mt.mem_free [size] [unit]
+              4.3. mt.mem_used [unit]
+              4.4. mt.mem_rnd_alloc min max total [unit] 
+              4.5. mt.mem_test_start min max total min_int max_int
+                      total_time [unit] 
+
+              4.6. mt.mem_test_stop id
+              4.7. mt.mem_test_destroy id
+              4.8. mt.mem_test_destroy_all id
+              4.9. mt.mem_test_list [id] [unit]
 
    List of Examples
 
-   1. Set check_content in the config file
-   2. Set check_content at runtime via sercmd
-   3. men_alloc usage
-   4. mem_free usage
-   5. mt.mem_alloc usage
-   6. mt.mem_free usage
-   7. mt.mem_used usage
-   8. mt.mem_rnd_alloc usage
-   9. mt.mem_test_start usage
-   10. mt.mem_test_stop usage
-   11. mt.mem_test_destroy usage
-   12. mt.mem_test_destroy_all usage
-   13. mt.mem_test_list usage
+   1.1. Set check_content in the config file 
+   1.2. Set check_content at runtime via sercmd 
+   1.3. men_alloc usage
+   1.4. mem_free usage
+   1.5. mt.mem_alloc usage
+   1.6. mt.mem_free usage
+   1.7. mt.mem_used usage
+   1.8. mt.mem_rnd_alloc usage
+   1.9. mt.mem_test_start usage
+   1.10. mt.mem_test_stop usage
+   1.11. mt.mem_test_destroy usage
+   1.12. mt.mem_test_destroy_all usage
+   1.13. mt.mem_test_list usage
+
+Chapter 1. Admin Guide
+
+   Table of Contents
+
+   1. Overview
+   2. Parameters
+
+        2.1. check_content
+
+   3. Functions
+
+        3.1. mt_mem_alloc(size)
+        3.2. mt_mem_free()
+
+   4. malloc_test RPC Functions
+
+        4.1. mt.mem_alloc size [unit]
+        4.2. mt.mem_free [size] [unit]
+        4.3. mt.mem_used [unit]
+        4.4. mt.mem_rnd_alloc min max total [unit] 
+        4.5. mt.mem_test_start min max total min_int max_int total_time
+                [unit] 
+
+        4.6. mt.mem_test_stop id
+        4.7. mt.mem_test_destroy id
+        4.8. mt.mem_test_destroy_all id
+        4.9. mt.mem_test_list [id] [unit]
 
 1. Overview
 
-   This is a debugging/test module. It implements functions (both script
-   and rpcs) that can be used to stress the memory allocator or force
+   This  is a debugging/test module. It implements functions (both script
+   and  rpcs)  that  can  be used to stress the memory allocator or force
    memory leaks.
 
 Warning
@@ -39,7 +96,7 @@ Warning
 
 2.1. check_content
 
-   When doing the tests, check also for the possibility of the memory
+   When  doing  the  tests,  check also for the possibility of the memory
    being overwritten. When activated, the allocated memory will be filled
    with a special pattern, that will be checked on free.
 
@@ -47,11 +104,11 @@ Warning
 
    It can be changed also at runtime, via the rpc interface.
 
-   Example 1.  Set check_content in the config file
+   Example 1.1.  Set check_content in the config file 
 modparam("malloc_test", "check_content", 1)
 
-   Example 2.  Set check_content at runtime via sercmd
-$ sercmd cfg.set_now_int malloc_test check_content 1
+   Example 1.2.  Set check_content at runtime via sercmd 
+$ kamcmd cfg.set_now_int malloc_test check_content 1
 
 3. Functions
 
@@ -64,10 +121,10 @@ $ sercmd cfg.set_now_int malloc_test check_content 1
 
 Note
 
-   This is a debugging function for simulating memory leaks or stressing
+   This  is a debugging function for simulating memory leaks or stressing
    the memory allocator. It should not be used in production setups
 
-   Example 3. men_alloc usage
+   Example 1.3. men_alloc usage
 ...
 mem_alloc(1048576); # 1MB
 ...
@@ -78,10 +135,10 @@ mem_alloc(1048576); # 1MB
 
 Note
 
-   This is a debugging function for simulating memory leaks or stressing
+   This  is a debugging function for simulating memory leaks or stressing
    the memory allocator. It should not be used in production setups
 
-   Example 4. mem_free usage
+   Example 1.4. mem_free usage
 ...
 mem_free();
 ...
@@ -91,8 +148,9 @@ mem_free();
    4.1. mt.mem_alloc size [unit]
    4.2. mt.mem_free [size] [unit]
    4.3. mt.mem_used [unit]
-   4.4. mt.mem_rnd_alloc min max total [unit]
+   4.4. mt.mem_rnd_alloc min max total [unit] 
    4.5. mt.mem_test_start min max total min_int max_int total_time [unit]
+          
    4.6. mt.mem_test_stop id
    4.7. mt.mem_test_destroy id
    4.8. mt.mem_test_destroy_all id
@@ -100,19 +158,19 @@ mem_free();
 
 4.1.  mt.mem_alloc size [unit]
 
-   Allocates the specified number of bytes. unit is optional and can be
+   Allocates  the  specified number of bytes. unit is optional and can be
    one of:
      * b - bytes
      * k - KB
      * m - MB
      * g - GB
 
-   Example 5. mt.mem_alloc usage
- $ sercmd mt.mem_alloc 10 k
+   Example 1.5. mt.mem_alloc usage
+ $ kamcmd mt.mem_alloc 10 k
 
 4.2.  mt.mem_free [size] [unit]
 
-   Frees at least size bytes from the memory allocated by other
+   Frees  at  least  size  bytes  from  the  memory  allocated  by  other
    malloc_test functions (e.g. mt.mem_alloc).
 
    size is optional. If missing, everything will be freed.
@@ -123,12 +181,12 @@ mem_free();
      * m - MB
      * g - GB
 
-   Example 6. mt.mem_free usage
- $ sercmd mt.mem_free 1 m
+   Example 1.6. mt.mem_free usage
+ $ kamcmd mt.mem_free 1 m
 
 4.3.  mt.mem_used [unit]
 
-   Returns/displays how many bytes are allocated. The default unit is
+   Returns/displays  how  many  bytes  are allocated. The default unit is
    bytes (for all the possible units see above).
 
    unit is optional and can be one of:
@@ -137,69 +195,69 @@ mem_free();
      * m - MB
      * g - GB
 
-   Example 7. mt.mem_used usage
- $ sercmd mt.mem_used
+   Example 1.7. mt.mem_used usage
+ $ kamcmd mt.mem_used
 9221460
 
 4.4. mt.mem_rnd_alloc min max total [unit]
 
-   Allocates total_size memory, in pieces of random size between min ..
-   max (inclusive). unit is optional and represents the unit for all the
+   Allocates  total_size  memory, in pieces of random size between min ..
+   max  (inclusive). unit is optional and represents the unit for all the
    given sizes (see above).
 
-   Example 8. mt.mem_rnd_alloc usage
- $ sercmd mt.mem_rnd_alloc 1 64 10240 k
+   Example 1.8. mt.mem_rnd_alloc usage
+ $ kamcmd mt.mem_rnd_alloc 1 64 10240 k
 
 4.5.  mt.mem_test_start min max total min_int max_int total_time [unit]
 
-   Starts a malloc test that will take total_time to execute. Memory
-   allocations will be performed at intervals randomly chosen between
-   min_int and max_int (in ms). Each allocation will have a randomly
+   Starts  a  malloc  test  that  will take total_time to execute. Memory
+   allocations  will  be  performed  at intervals randomly chosen between
+   min_int  and  max_int  (in  ms).  Each allocation will have a randomly
    chosen size between min and max unit bytes. After total unit bytes are
-   allocated, everything is released/freed again and the allocations are
-   restarted. All the times are expressed in milliseconds. unit is
+   allocated,  everything is released/freed again and the allocations are
+   restarted.  All  the  times  are  expressed  in  milliseconds. unit is
    optional and represents the unit for all the given sizes (see above).
 
    Several tests can be run in parallel.
 
    Returns the test id.
 
-   Example 9. mt.mem_test_start usage
- $ sercmd mt.mem_test_start 15 64 25000 128 1500 3600000 k
+   Example 1.9. mt.mem_test_start usage
+ $ kamcmd mt.mem_test_start 15 64 25000 128 1500 3600000 k
 1
 
 4.6.  mt.mem_test_stop id
 
    Stops the test indentified by id.
 
-   Example 10. mt.mem_test_stop usage
- $ sercmd mt.mem_test_stop 1
+   Example 1.10. mt.mem_test_stop usage
+ $ kamcmd mt.mem_test_stop 1
 
 4.7.  mt.mem_test_destroy id
 
-   Destroys the test indentified by id (besides stopping it, it also frees
-   all the data, including the statistics).
+   Destroys  the  test  indentified  by  id (besides stopping it, it also
+   frees all the data, including the statistics).
 
-   Example 11. mt.mem_test_destroy usage
- $ sercmd mt.mem_test_destroy 1
+   Example 1.11. mt.mem_test_destroy usage
+ $ kamcmd mt.mem_test_destroy 1
 
 4.8.  mt.mem_test_destroy_all id
 
    Destroys all the running or stopped tests.
 
-   Example 12. mt.mem_test_destroy_all usage
- $ sercmd mt.mem_test_destroy_all
+   Example 1.12. mt.mem_test_destroy_all usage
+ $ kamcmd mt.mem_test_destroy_all
 
 4.9.  mt.mem_test_list [id] [unit]
 
-   Returns/displays data about the test identified by id, or if no id is
+   Returns/displays  data about the test identified by id, or if no id is
    specified, it lists all the tests (running or stopped).
 
-   unit is optional. The default is is bytes (for all the possible units
+   unit  is optional. The default is is bytes (for all the possible units
    see above).
 
-   Example 13. mt.mem_test_list usage
- $ sercmd mt.mem_test_list
+   Example 1.13. mt.mem_test_list usage
+ $ kamcmd mt.mem_test_list
 {
         ID           : 2
         run time (s) : 1471

+ 89 - 51
modules/mangler/README

@@ -1,3 +1,4 @@
+
 The Mangler Module - SDP mangling
 
 Gabriel Vasile
@@ -5,16 +6,50 @@ Gabriel Vasile
    FhG FOKUS
 
    Copyright © 2003 FhG FOKUS
-     __________________________________________________________________
+     _________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+        2. Parameters
+
+              2.1. contact_flds_separator (string)
+
+        3. Functions
+
+              3.1. sdp_mangle_ip(pattern, newip) 
+              3.2. sdp_mangle_port(offset) 
+              3.3. encode_contact(encoding_prefix) 
+              3.4. decode_contact() 
+              3.5. decode_contact_header() 
 
    List of Examples
 
-   1. Set db_url parameter
-   2. sdp_mangle_ip usage
-   3. sdp_mangle_port usage
-   4. encode_contact usage
-   5. decode_contact usage
-   6. decode_contact_header usage
+   1.1. Set db_url parameter
+   1.2. sdp_mangle_ip usage
+   1.3. sdp_mangle_port usage
+   1.4. encode_contact usage
+   1.5. decode_contact usage
+   1.6. decode_contact_header usage
+
+Chapter 1. Admin Guide
+
+   Table of Contents
+
+   1. Overview
+   2. Parameters
+
+        2.1. contact_flds_separator (string)
+
+   3. Functions
+
+        3.1. sdp_mangle_ip(pattern, newip) 
+        3.2. sdp_mangle_port(offset) 
+        3.3. encode_contact(encoding_prefix) 
+        3.4. decode_contact() 
+        3.5. decode_contact_header() 
 
 1. Overview
 
@@ -26,64 +61,66 @@ Gabriel Vasile
 
 2.1. contact_flds_separator (string)
 
-   First char of this parameter is used as separator for encoding/decoding
-   Contact header. If you set this parameter to "-", then an encoded uri
-   might look sip:user-password-ip-port-protocol@PublicIP
+   First   char   of   this   parameter   is   used   as   separator  for
+   encoding/decoding  Contact  header.  If you set this parameter to "-",
+   then an encoded uri might look
+   sip:user-password-ip-port-protocol@PublicIP
 
 Warning
 
-   First char of this field must be set to a value which is not used
-   inside username,password or other fields of contact.Otherwise it is
+   First  char  of  this  field  must be set to a value which is not used
+   inside  username,password  or  other fields of contact.Otherwise it is
    possible for the decoding step to fail/produce wrong results.
 
    Default value is "*".
 
-   Example 1. Set db_url parameter
+   Example 1.1. Set db_url parameter
 ...
 modparam("mangler", "contact_flds_separator", "-")
 ...
 
 3. Functions
 
-   3.1. sdp_mangle_ip(pattern, newip)
-   3.2. sdp_mangle_port(offset)
-   3.3. encode_contact(encoding_prefix)
-   3.4. decode_contact()
-   3.5. decode_contact_header()
+   3.1. sdp_mangle_ip(pattern, newip) 
+   3.2. sdp_mangle_port(offset) 
+   3.3. encode_contact(encoding_prefix) 
+   3.4. decode_contact() 
+   3.5. decode_contact_header() 
 
 3.1.  sdp_mangle_ip(pattern, newip)
 
-   Changes IP addresses inside SDP package in lines describing connections
-   like c=IN IP4 . Currently this function only changes IP4 addresses
-   since IP6 probably will not need to traverse NAT :)
+   Changes   IP   addresses   inside  SDP  package  in  lines  describing
+   connections  like  c=IN IP4 . Currently this function only changes IP4
+   addresses since IP6 probably will not need to traverse NAT :)
 
    The function returns negative on error, or number of replacements + 1.
 
    Meaning of the parameters is as follows:
      * pattern - A ip address/mask pair used to match IP's located inside
-       SDP package in lines c=IN IP4 ip. This line will only be changed if
-       located IP is in the network described by this pattern. Examples of
-       valid patterns are "10.0.0.0/255.0.0.0" or "10.0.0.0/8" etc.
-     * newip - A string representing the new IP to be put inside SDP
+       SDP  package  in lines c=IN IP4 ip. This line will only be changed
+       if  located  IP  is  in  the  network  described  by this pattern.
+       Examples   of   valid   patterns   are   "10.0.0.0/255.0.0.0"   or
+       "10.0.0.0/8" etc.
+     * newip  -  A  string  representing  the new IP to be put inside SDP
        package if old IP address matches pattern.
 
-   Example 2. sdp_mangle_ip usage
+   Example 1.2. sdp_mangle_ip usage
 ...
 sdp_mangle_ip("10.0.0.0/8","193.175.135.38");
 ...
 
 3.2.  sdp_mangle_port(offset)
 
-   Changes ports inside SDP package in lines describing media like m=audio
-   13451.
+   Changes  ports  inside  SDP  package  in  lines  describing media like
+   m=audio 13451.
 
    The function returns negative on error, or number of replacements + 1.
 
    Meaning of the parameters is as follows:
-     * offset - A string representing an integer which will be
+     * offset   -   A  string  representing  an  integer  which  will  be
        added/subtracted from the located port.
 
-   Example 3. sdp_mangle_port usage
+   Example 1.3. sdp_mangle_port usage
 ...
 sdp_mangle_port("-12000");
 ...
@@ -91,51 +128,52 @@ sdp_mangle_port("-12000");
 3.3.  encode_contact(encoding_prefix)
 
    This function will encode uri-s inside Contact header in the following
-   manner sip:username:password@ip:port;transport=protocol goes
-   sip:enc_pref*username*ip*port*protocol@public_ip. "*" (asterisk) is the
-   default separator.
+   manner      sip:username:password@ip:port;transport=protocol      goes
+   sip:enc_pref*username*ip*port*protocol@public_ip.  "*"  (asterisk)  is
+   the default separator.
 
    The function returns negative on error, 1 on success.
 
    Meaning of the parameters is as follows:
-     * encoding_prefix - Something to allow us to determine that a contact
-       is encoded public ip--a routable IP, most probably you should put
-       your external IP of your NAT box.
+     * encoding_prefix  -  Something  to  allow  us  to  determine that a
+       contact  is  encoded  public  ip--a routable IP, most probably you
+       should put your external IP of your NAT box.
 
-   Example 4. encode_contact usage
+   Example 1.4. encode_contact usage
 ...
 if (src_ip == 10.0.0.0/8) encode_contact("enc_prefix","193.175.135.38");
 ...
 
 3.4.  decode_contact()
 
-   This function will decode the URI in first line in packets which come
+   This  function will decode the URI in first line in packets which come
    with encoded URI in the following manner
-   sip:enc_pref*username*ip*port*protocol*src_ip*src_port*src_proto@public
-   _ip;parameters is converted to sip:username:password@ip:port;parameters
-   and will set destination URI to sip:src_ip:src_port;transport=src_proto
-   (so that the next forward() or t_relay() will send the message back to
-   src_ip:src_port using src_proto). It uses the default set parameter for
-   contact encoding separator.
+   sip:enc_pref*username*ip*port*protocol*src_ip*src_port*src_proto@publi
+   c_ip;parameters is converted to
+   sip:username:password@ip:port;parameters  and will set destination URI
+   to sip:src_ip:src_port;transport=src_proto (so that the next forward()
+   or  t_relay()  will  send  the  message  back to src_ip:src_port using
+   src_proto).  It  uses  the  default set parameter for contact encoding
+   separator.
 
    The function returns negative on error, 1 on success.
 
-   Example 5. decode_contact usage
+   Example 1.5. decode_contact usage
 ...
 if (uri =~ "^enc*") { decode_contact(); }
 ...
 
 3.5.  decode_contact_header()
 
-   This function will decode URIs inside Contact header in the same manner
-   as decode_contact(). The difference is that no dst_uri is set (src_ip,
-   src_port and src_proto are ignored) and instead of changing the request
-   uri, the Contact header URI is modified. It uses the default set
-   parameter for contact encoding separator.
+   This  function  will  decode  URIs  inside  Contact header in the same
+   manner  as  decode_contact(). The difference is that no dst_uri is set
+   (src_ip,  src_port  and src_proto are ignored) and instead of changing
+   the  request  uri,  the  Contact  header  URI is modified. It uses the
+   default set parameter for contact encoding separator.
 
    The function returns negative on error, 1 on success.
 
-   Example 6. decode_contact_header usage
+   Example 1.6. decode_contact_header usage
 ...
 if (uri =~ "^enc*") { decode_contact_header(); }
 ...

+ 66 - 21
modules/prefix_route/README

@@ -1,3 +1,4 @@
+
 prefix_route Module
 
 Alfred E. Heggestad
@@ -7,25 +8,69 @@ Alfred E. Heggestad
    Copyright © 2007 Alfred E. Heggestad
 
    Copyright © 2008 Telio Telecom AS
-     __________________________________________________________________
+     _________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+        2. Parameters
+
+              2.1. db_url (string)
+              2.2. db_table (string)
+              2.3. exit (int)
+
+        3. Functions
+
+              3.1. prefix_route([user])
+
+        4. RPC Commands
+
+              4.1. prefix_route.reload
+              4.2. prefix_route.dump
+
+        5. Database Structure
 
    List of Examples
 
-   1. Setting db_url parameter
-   2. Setting db_table parameter
-   3. Setting exit parameter
-   4. prefix_route() usage
-   5. Sample data
+   1.1. Setting db_url parameter
+   1.2. Setting db_table parameter
+   1.3. Setting exit parameter
+   1.4. prefix_route() usage
+   1.5. Sample data
+
+Chapter 1. Admin Guide
+
+   Table of Contents
+
+   1. Overview
+   2. Parameters
+
+        2.1. db_url (string)
+        2.2. db_table (string)
+        2.3. exit (int)
+
+   3. Functions
+
+        3.1. prefix_route([user])
+
+   4. RPC Commands
+
+        4.1. prefix_route.reload
+        4.2. prefix_route.dump
+
+   5. Database Structure
 
 1. Overview
 
-   The prefix_route module does routing based on a set of prefixes from
-   the database. The prefix rule-set is loaded from the database into a
-   binary tree in memory, either on startup or when issuing the
-   "prefix_route.reload" RPC command. When calling the "prefix_route()"
-   function from the ser.cfg configuration script, it will try to match
-   the user part of the request URI with the best matching route. If a
-   route is found, it will be used for further processing. If not found
+   The  prefix_route  module does routing based on a set of prefixes from
+   the  database.  The prefix rule-set is loaded from the database into a
+   binary  tree  in  memory,  either  on  startup  or  when  issuing  the
+   "prefix_route.reload"  RPC  command. When calling the "prefix_route()"
+   function  from  the ser.cfg configuration script, it will try to match
+   the  user  part  of the request URI with the best matching route. If a
+   route  is  found, it will be used for further processing. If not found
    normal processing will continue.
 
    Development was sponsored by Telio Telecom.
@@ -42,7 +87,7 @@ Alfred E. Heggestad
 
    Default value is "mysql://ser@localhost/ser"
 
-   Example 1. Setting db_url parameter
+   Example 1.1. Setting db_url parameter
 ...
 modparam("prefix_route", "db_url", "mysql://ser:pass@db_host/ser")
 ...
@@ -53,19 +98,19 @@ modparam("prefix_route", "db_url", "mysql://ser:pass@db_host/ser")
 
    Default value is "prefix_route".
 
-   Example 2. Setting db_table parameter
+   Example 1.2. Setting db_table parameter
 ...
 modparam("prefix_route", "db_table", "new_prefix_route")
 ...
 
 2.3. exit (int)
 
-   If set, exit the execution of the configuration file when a route block
-   is executed upon matching a prefix. Otherwise return 1 (true).
+   If  set,  exit  the  execution  of the configuration file when a route
+   block is executed upon matching a prefix. Otherwise return 1 (true).
 
    Default value is 1 (on).
 
-   Example 3. Setting exit parameter
+   Example 1.3. Setting exit parameter
 ...
 modparam("prefix_route", "exit", 0)
 ...
@@ -76,14 +121,14 @@ modparam("prefix_route", "exit", 0)
 
 3.1. prefix_route([user])
 
-   This function tries to find a route from the user part of the request
+   This  function tries to find a route from the user part of the request
    URI (if no parameter is provided), or from the value of the parameter.
    The parameter can contain config variables.
 
    If a route is found, it will be used for further processing. Otherwise
    the function will return false.
 
-   Example 4. prefix_route() usage
+   Example 1.4. prefix_route() usage
 ...
   if (!prefix_route()) {
       xlog("L_ERR", "prefix_route(): no matching routes\n");
@@ -116,7 +161,7 @@ modparam("prefix_route", "exit", 0)
      * route - varchar(64) - Route name
      * comment - varchar(64) - Free-form comment
 
-   Example 5. Sample data
+   Example 1.5. Sample data
 ...
    +--------+-------+---------------+
    | prefix | route | comment       |

+ 49 - 19
modules/print/README

@@ -1,62 +1,92 @@
-1. Print Module
+
+Print Module
 
 Andrei Pelinescu-Onciul
 
    FhG FOKUS
 
-   Copyright © 2003 FhG FOKUS
-     __________________________________________________________________
+   Copyright © 2003 FhG FOKUS
+     _________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+        2. Parameters
+
+              2.1. str_param (string)
+              2.2. int_param (integer)
+
+        3. Functions
+
+              3.1. print(txt) 
 
-   1.1. Overview
-   1.2. Parameters
+   List of Examples
 
-        1.2.1. str_param (string)
-        1.2.2. int_param (integer)
+   1.1. Set str_param parameter
+   1.2. Set int_param parameter
+   1.3. print usage
 
-   1.3. Functions
+Chapter 1. Admin Guide
 
-        1.3.1. print(txt)
+   Table of Contents
 
-1.1. Overview
+   1. Overview
+   2. Parameters
+
+        2.1. str_param (string)
+        2.2. int_param (integer)
+
+   3. Functions
+
+        3.1. print(txt) 
+
+1. Overview
 
    This is an example module. It implements only one function that prints
-   its string parameter to stdout (it won't work if ser is started in
+   its  string  parameter  to  stdout (it won't work if ser is started in
    daemon mode). It also shows how module parameters can be declared.
 
-1.2. Parameters
+2. Parameters
+
+   2.1. str_param (string)
+   2.2. int_param (integer)
 
-1.2.1. str_param (string)
+2.1. str_param (string)
 
    Not used, just an example
 
    Default value is NULL.
 
-   Example 1. Set str_param parameter
+   Example 1.1. Set str_param parameter
 ...
 modparam("print", "str_param", "foobar")
 ...
 
-1.2.2. int_param (integer)
+2.2. int_param (integer)
 
    Not used, just an example.
 
    Default value is 0.
 
-   Example 2. Set int_param parameter
+   Example 1.2. Set int_param parameter
 ...
 modparam("print", "int_param", 42)
 ...
 
-1.3. Functions
+3. Functions
+
+   3.1. print(txt) 
 
-1.3.1.  print(txt)
+3.1.  print(txt)
 
    Prints string to stdout.
 
    Meaning of the parameters is as follows:
      * txt - string to be printed.
 
-   Example 3. print usage
+   Example 1.3. print usage
 ...
 print("The answer is 42\n");
 ...

+ 32 - 12
modules/print_lib/README

@@ -1,34 +1,54 @@
-1. Print_lib Module
+
+Print_lib Module
 
 Andrei Pelinescu-Onciul
 
    FhG FOKUS
 
    Copyright © 2003 FhG FOKUS
-     __________________________________________________________________
+     _________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+        2. Functions
+
+              2.1. print_stderr(txt) 
 
-   1.1. Overview
-   1.2. Functions
+   List of Examples
 
-        1.2.1. print_stderr(txt)
+   1.1. print_stderr usage
 
-1.1. Overview
+Chapter 1. Admin Guide
+
+   Table of Contents
+
+   1. Overview
+   2. Functions
+
+        2.1. print_stderr(txt) 
+
+1. Overview
 
    This is an example module. It implements only one function that prints
-   its string parameter to stderr (it won't work if server is started in
-   daemon mode). Its prupose is to show how to link to an internal library
-   (lib/print).
+   its  string parameter to stderr (it won't work if server is started in
+   daemon  mode).  Its  prupose  is  to  show  how to link to an internal
+   library (lib/print).
+
+2. Functions
 
-1.2. Functions
+   2.1. print_stderr(txt) 
 
-1.2.1. print_stderr(txt)
+2.1.  print_stderr(txt)
 
    Prints string to stderr.
 
    Meaning of the parameters is as follows:
      * txt - string to be printed.
 
-   Example 1. print_stderr usage
+   Example 1.1. print_stderr usage
 ...
 print_stderr("The answer is 42\n");
 ...

+ 98 - 91
modules/sanity/README

@@ -1,3 +1,4 @@
+
 The Sanity Module - SIP syntax checking
 
 Nils Ohlmeier
@@ -5,22 +6,24 @@ Nils Ohlmeier
    iptelorg GmbH
 
    Copyright © 2006 iptelorg GmbH
-     __________________________________________________________________
+     _________________________________________________________________
 
    Table of Contents
 
-   1.
+   1. Admin Guide
 
-        1. Parameters
+        1. Overview
+        2. Dependencies
+        3. Parameters
 
-              1.1. default_checks (integer)
-              1.2. uri_checks (integer)
-              1.3. proxy_require (string)
-              1.4. autodrop (integer)
+              3.1. default_checks (integer)
+              3.2. uri_checks (integer)
+              3.3. proxy_require (string)
+              3.4. autodrop (integer)
 
-        2. Functions
+        4. Functions
 
-              2.1. sanity_check([msg_checks [, uri_checks]])
+              4.1. sanity_check([msg_checks [, uri_checks]]) 
 
    List of Examples
 
@@ -32,84 +35,88 @@ Nils Ohlmeier
    1.6. sanity_check usage with parameter
    1.7. sanity_check usage with two parameters
 
+Chapter 1. Admin Guide
+
+   Table of Contents
+
+   1. Overview
+   2. Dependencies
+   3. Parameters
+
+        3.1. default_checks (integer)
+        3.2. uri_checks (integer)
+        3.3. proxy_require (string)
+        3.4. autodrop (integer)
+
+   4. Functions
+
+        4.1. sanity_check([msg_checks [, uri_checks]]) 
+
 1. Overview
 
-   This module aims to implement several sanity checks on incoming
-   requests which are suggested or even required by a RFC, but are not
+   This  module  aims  to  implement  several  sanity  checks on incoming
+   requests  which  are  suggested or even required by a RFC, but are not
    available yet in the core of Kamailio.
 
-   These checks are not required by Kamailio itself for its functionality.
-   But on the other side it makes not much sence if a broken request
-   traverses through a SIP network if it is rejected sooner or later by a
-   SIP device any way. As every sanity check cost extra performance
-   because of additional parsing and evaluation it is with this module now
-   up to the Kamailio adminstrator which checks should be done on which
-   request.
+   These   checks   are   not   required   by  Kamailio  itself  for  its
+   functionality.  But  on  the  other  side it makes not much sence if a
+   broken  request  traverses  through  a  SIP  network if it is rejected
+   sooner  or  later  by a SIP device any way. As every sanity check cost
+   extra  performance  because of additional parsing and evaluation it is
+   with  this  module  now  up  to the Kamailio adminstrator which checks
+   should be done on which request.
 
    The following checks are available:
-     * ruri sip version - (1) - checks if the SIP version in the request
+     * ruri  sip version - (1) - checks if the SIP version in the request
        URI is supported, currently only 2.0.
      * ruri scheme - (2) - checks if the URI scheme of the request URI is
        supported (sip[s]|tel[s]) by Kamailio
-     * required headers - (4) -checks if the minimum set of required
+     * required  headers  -  (4)  -checks  if the minimum set of required
        headers to, from, cseq, callid and via is present in the request.
-     * via sip version - (8) - not working because parser fails already
+     * via  sip  version - (8) - not working because parser fails already
        when another version then 2.0 is present.
-     * via protocol - (16) - not working because parser fails already if
+     * via  protocol - (16) - not working because parser fails already if
        an unsupported transport is present.
-     * cseq method - (32) - checks if the method from the cseq header is
+     * cseq  method - (32) - checks if the method from the cseq header is
        equal to the request method.
-     * cseq value - (64) - checks if the number in the cseq header is a
+     * cseq  value  - (64) - checks if the number in the cseq header is a
        valid unsigend integer.
-     * content length - (128) - checks if the size of the body matches
+     * content  length  -  (128) - checks if the size of the body matches
        with the value from the content length header.
-     * expires value - (256) - checks if the value of the expires header
+     * expires  value - (256) - checks if the value of the expires header
        is a valid unsigned integer.
-     * proxy require - (512) - checks if all items of the proxy require
-       header are present in the list of the extensions from the module
+     * proxy  require  - (512) - checks if all items of the proxy require
+       header  are  present in the list of the extensions from the module
        parameter proxy_require.
-     * parse uri's - (1024) - checks if the specified URIs are present and
-       parseable by the Kamailio parsers
-     * digest credentials (2048) Check all instances of digest credentials
-       in a message. The test checks whether there are all required digest
-       parameters and have meaningful values.
+     * parse  uri's  -  (1024) - checks if the specified URIs are present
+       and parseable by the Kamailio parsers
+     * digest   credentials   (2048)   Check   all  instances  of  digest
+       credentials  in  a  message. The test checks whether there are all
+       required digest parameters and have meaningful values.
 
 2. Dependencies
 
    The following modules must be loaded before this module:
      * sl - Stateless replies.
 
-   Table of Contents
-
-   1. Parameters
-
-        1.1. default_checks (integer)
-        1.2. uri_checks (integer)
-        1.3. proxy_require (string)
-        1.4. autodrop (integer)
-
-   2. Functions
-
-        2.1. sanity_check([msg_checks [, uri_checks]])
-
-1. Parameters
+3. Parameters
 
-   1.1. default_checks (integer)
-   1.2. uri_checks (integer)
-   1.3. proxy_require (string)
-   1.4. autodrop (integer)
+   3.1. default_checks (integer)
+   3.2. uri_checks (integer)
+   3.3. proxy_require (string)
+   3.4. autodrop (integer)
 
-1.1. default_checks (integer)
+3.1. default_checks (integer)
 
-   This parameter determines which of the checks from the sanity module
-   are executed if no parameter was given to the sanity_check function
-   call. By default all implemented checks are included in the execution
-   of the sanity_check function. The integer value is the sum of the check
-   numbers which should be executed by default.
+   This  parameter  determines which of the checks from the sanity module
+   are  executed  if  no parameter was given to the sanity_check function
+   call.  By default all implemented checks are included in the execution
+   of  the  sanity_check  function.  The  integer value is the sum of the
+   check numbers which should be executed by default.
 
-   Default value is 999. This resolves to the following list of checks:
-   ruri_sip_version (1), ruri_scheme (2), required_headers (4),
-   cseq_method (32), cseq_value (64), cotent_length (128), expires_value
+   Default  value  is 999. This resolves to the following list of checks:
+   ruri_sip_version   (1),   ruri_scheme   (2),   required_headers   (4),
+   cseq_method  (32), cseq_value (64), cotent_length (128), expires_value
    (256), proxy_require (512).
 
    Example 1.1. Set default_checks parameter
@@ -117,38 +124,38 @@ Nils Ohlmeier
 modparam("sanity", "default_checks", 1)
 ...
 
-1.2. uri_checks (integer)
+3.2. uri_checks (integer)
 
-   This parameter determines which URIs are going to be checked if the
+   This  parameter  determines  which URIs are going to be checked if the
    'parse uri' will be executed.
 
-   Default value is 7. This resolves to the following list of parsed URIs:
-   Request RUI (1), From URI (2) and To URI (4).
+   Default  value  is  7.  This  resolves to the following list of parsed
+   URIs: Request RUI (1), From URI (2) and To URI (4).
 
    Example 1.2. Set uri_checks parameter
 ...
 modparam("sanity", "uri_checks", 3)
 ...
 
-1.3. proxy_require (string)
+3.3. proxy_require (string)
 
-   This parameter sets the list of supported extensions for this Kamailio.
-   The value is expected as a comma separated list of extensions. This
-   list is separated into single tokens. Each token from a proxy require
-   header will be compared to the tokens from this list.
+   This  parameter  sets  the  list  of  supported  extensions  for  this
+   Kamailio.  The  value  is  expected  as  a  comma  separated  list  of
+   extensions. This list is separated into single tokens. Each token from
+   a proxy require header will be compared to the tokens from this list.
 
    Example 1.3. Set proxy_require parameter
 ...
 modparam("sanity", "proxy_require", "foo, bar")
 ...
 
-1.4. autodrop (integer)
+3.4. autodrop (integer)
 
-   This parameter controls whether the module drops automatically or not
-   the SIP message if the sanity checks fail. Default value is 1 (auto
-   drop). If set to 0, sanity_check() function will return -1 (false) to
-   configuration file, allowing to write log messages for example - be
-   sure you exit execution of config without sending a SIP reply because
+   This  parameter controls whether the module drops automatically or not
+   the  SIP  message  if the sanity checks fail. Default value is 1 (auto
+   drop).  If set to 0, sanity_check() function will return -1 (false) to
+   configuration  file,  allowing  to write log messages for example - be
+   sure  you exit execution of config without sending a SIP reply because
    it is sent by module itself.
 
    Example 1.4. Set autodrop parameter
@@ -156,18 +163,18 @@ modparam("sanity", "proxy_require", "foo, bar")
 modparam("sanity", "autodrop", 1)
 ...
 
-2. Functions
+4. Functions
 
-   2.1. sanity_check([msg_checks [, uri_checks]])
+   4.1. sanity_check([msg_checks [, uri_checks]]) 
 
-2.1.  sanity_check([msg_checks [, uri_checks]])
+4.1.  sanity_check([msg_checks [, uri_checks]])
 
    This function makes a row of sanity checks over the given SIP request.
-   The behavior of the function is also controlled by 'autodrop'
-   parameter. If autodrop=0, the function returns false (-1) if one of the
-   checks failed. When autodrop=1, the function stops the execution of
-   configuration file. In both cases, if one of the checks fails the
-   module sends a precise error reply via SL send_reply(). Thus there is
+   The  behavior  of  the  function  is  also  controlled  by  'autodrop'
+   parameter.  If  autodrop=0,  the function returns false (-1) if one of
+   the  checks  failed. When autodrop=1, the function stops the execution
+   of  configuration  file. In both cases, if one of the checks fails the
+   module  sends a precise error reply via SL send_reply(). Thus there is
    no need to reply with a generic error message.
 
    Example 1.5. sanity_check usage
@@ -178,29 +185,29 @@ if (!sanity_check()) {
 ...
 
    Optionally the function takes an integer argument which overwrites the
-   global module parameter default_checks. This allows to make certain
-   test from script regions. The integer value is again the sum of the
-   checks (like for the module parameter) which should be executed at this
-   function call.
+   global  module  parameter  default_checks. This allows to make certain
+   test  from  script  regions. The integer value is again the sum of the
+   checks  (like  for  the  module parameter) which should be executed at
+   this function call.
 
    Example 1.6. sanity_check usage with parameter
 ...
 if (method=="REGISTER" && !sanity_check("256")) {
         /* the register contains an invalid expires value and is replied with a
-400 */
+ 400 */
         exit;
 }
 ...
 
-   Optionally the function takes a second integer argument which
-   overwrites the global module parameter uri_checks and thus determines
+   Optionally   the  function  takes  a  second  integer  argument  which
+   overwrites  the global module parameter uri_checks and thus determines
    which URIs will be checked if the parse uri test will be executed.
 
    Example 1.7. sanity_check usage with two parameters
 ...
 if (method=="INVITE" && !sanity_check("1024", "6")) {
         /* the INVITE contains an invalid From or To header and is replied with
-a 400 */
+ a 400 */
         exit;
 }
 ...

+ 147 - 54
modules/sl/README

@@ -1,3 +1,4 @@
+
 The SL Module - Statless request handling
 
 Bogdan Iancu
@@ -9,44 +10,135 @@ Daniel-Constantin Mierla
    asipto.com
 
    Copyright © 2003 FhG FOKUS
-     __________________________________________________________________
+     _________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+        2. Parameters
+
+              2.1. default_code (int)
+              2.2. default_reason (str)
+              2.3. bind_tm (int)
+
+        3. Functions
+
+              3.1. sl_send_reply(code, reason) 
+              3.2. send_reply(code, reason) 
+              3.3. sl_reply_error() 
+              3.4. sl_forward _reply([ code, [ reason ] ]) 
+
+        4. Statistics
+
+              4.1. 1xx_replies
+              4.2. 200_replies
+              4.3. 202_replies
+              4.4. 2xx_replies
+              4.5. 300_replies
+              4.6. 301_replies
+              4.7. 302_replies
+              4.8. 3xx_replies
+              4.9. 400_replies
+              4.10. 401_replies
+              4.11. 403_replies
+              4.12. 404_replies
+              4.13. 407_replies
+              4.14. 408_replies
+              4.15. 483_replies
+              4.16. 4xx_replies
+              4.17. 500_replies
+              4.18. 5xx_replies
+              4.19. 6xx_replies
+              4.20. xxx_replies
+              4.21. sent_replies
+              4.22. sent_err_replies
+              4.23. failures
+              4.24. received_ACKs
 
    List of Examples
 
-   1. default_code example
-   2. default_reason example
-   3. bind_tm example
-   4. sl_send_reply usage
-   5. send_reply usage
-   6. sl_reply_error usage
-   7. send_reply usage
+   1.1. default_code example
+   1.2. default_reason example
+   1.3. bind_tm example
+   1.4. sl_send_reply usage
+   1.5. send_reply usage
+   1.6. sl_reply_error usage
+   1.7. send_reply usage
+
+Chapter 1. Admin Guide
+
+   Table of Contents
+
+   1. Overview
+   2. Parameters
+
+        2.1. default_code (int)
+        2.2. default_reason (str)
+        2.3. bind_tm (int)
+
+   3. Functions
+
+        3.1. sl_send_reply(code, reason) 
+        3.2. send_reply(code, reason) 
+        3.3. sl_reply_error() 
+        3.4. sl_forward _reply([ code, [ reason ] ]) 
+
+   4. Statistics
+
+        4.1. 1xx_replies
+        4.2. 200_replies
+        4.3. 202_replies
+        4.4. 2xx_replies
+        4.5. 300_replies
+        4.6. 301_replies
+        4.7. 302_replies
+        4.8. 3xx_replies
+        4.9. 400_replies
+        4.10. 401_replies
+        4.11. 403_replies
+        4.12. 404_replies
+        4.13. 407_replies
+        4.14. 408_replies
+        4.15. 483_replies
+        4.16. 4xx_replies
+        4.17. 500_replies
+        4.18. 5xx_replies
+        4.19. 6xx_replies
+        4.20. xxx_replies
+        4.21. sent_replies
+        4.22. sent_err_replies
+        4.23. failures
+        4.24. received_ACKs
 
 1. Overview
 
-   The SL module allows the SIP server to act as a stateless UA server and
-   generate replies to SIP requests without keeping state. That is
+   The  SL  module  allows the SIP server to act as a stateless UA server
+   and  generate  replies  to SIP requests without keeping state. That is
    beneficial in many scenarios, in which you wish not to burden server's
    memory and scale well.
 
-   The SL module needs to filter ACKs sent after a local stateless reply
+   The  SL module needs to filter ACKs sent after a local stateless reply
    to an INVITE was generated. To recognize such ACKs, ser adds a special
    "signature" in to-tags. This signature is sought for in incoming ACKs,
    and if included, the ACKs are absorbed.
 
-   To speed up the filtering process, the module uses a timeout mechanism.
-   When a reply is sent, a timer us set. As long as the timer is valid,
-   the incoming ACK requests will be checked using TO tag value. Once the
-   timer expires, all the ACK messages are let through - a long time
-   passed till it sent a reply, so it does not expect any ACK that have to
-   be blocked.
-
-   The ACK filtering may fail in some rare cases. If you think these
-   matter to you, better use stateful processing (TM module) for INVITE
-   processing. Particularly, the problem happens when a UA sends an INVITE
-   which already has a to-tag in it (e.g., a re-INVITE) and the server
-   want to reply to it. Then, it will keep the current to-tag, which will
-   be mirrored in ACK. SER will not see its signature and forward the ACK
-   downstream. Caused harm is not bad--just a useless ACK is forwarded.
+   To  speed  up  the  filtering  process,  the  module  uses  a  timeout
+   mechanism.  When a reply is sent, a timer us set. As long as the timer
+   is  valid,  the  incoming  ACK  requests  will be checked using TO tag
+   value.  Once the timer expires, all the ACK messages are let through -
+   a long time passed till it sent a reply, so it does not expect any ACK
+   that have to be blocked.
+
+   The  ACK  filtering  may  fail  in some rare cases. If you think these
+   matter  to  you, better use stateful processing (TM module) for INVITE
+   processing.  Particularly,  the  problem  happens  when  a UA sends an
+   INVITE  which  already  has a to-tag in it (e.g., a re-INVITE) and the
+   server  want  to  reply  to it. Then, it will keep the current to-tag,
+   which  will  be  mirrored  in  ACK. SER will not see its signature and
+   forward the ACK downstream. Caused harm is not bad--just a useless ACK
+   is forwarded.
 
 2. Parameters
 
@@ -60,7 +152,7 @@ Daniel-Constantin Mierla
 
    Default value is 500.
 
-   Example 1. default_code example
+   Example 1.1. default_code example
 ...
 modparam("sl", "default_code", 505)
 ...
@@ -71,82 +163,83 @@ modparam("sl", "default_code", 505)
 
    Default value is 'Internal Server Error'.
 
-   Example 2. default_reason example
+   Example 1.2. default_reason example
 ...
 modparam("sl", "default_reason", "Server Error")
 ...
 
 2.3. bind_tm (int)
 
-   Controls if SL module should attempt to bind to TM module in order to
+   Controls  if SL module should attempt to bind to TM module in order to
    send stateful reply when the transaction is created.
 
    Default value is 1 (enabled).
 
-   Example 3. bind_tm example
+   Example 1.3. bind_tm example
 ...
 modparam("sl", "bind_tm", 0)  # feature disabled
 ...
 
 3. Functions
 
-   3.1. sl_send_reply(code, reason)
-   3.2. send_reply(code, reason)
-   3.3. sl_reply_error()
-   3.4. sl_forward _reply([ code, [ reason ] ])
+   3.1. sl_send_reply(code, reason) 
+   3.2. send_reply(code, reason) 
+   3.3. sl_reply_error() 
+   3.4. sl_forward _reply([ code, [ reason ] ]) 
 
-3.1. sl_send_reply(code, reason)
+3.1.  sl_send_reply(code, reason)
 
-   For the current request, a reply is sent back having the given code and
-   text reason. The reply is sent stateless, totally independent of the
-   Transaction module and with no retransmission for the INVITE's replies.
+   For  the  current  request, a reply is sent back having the given code
+   and  text  reason. The reply is sent stateless, totally independent of
+   the  Transaction  module  and  with no retransmission for the INVITE's
+   replies.
 
    Meaning of the parameters is as follows:
      * code - Return code.
      * reason - Reason phrase.
 
-   Example 4. sl_send_reply usage
+   Example 1.4. sl_send_reply usage
 ...
 sl_send_reply("404", "Not found");
 ...
 
-3.2. send_reply(code, reason)
+3.2.  send_reply(code, reason)
 
-   For the current request, a reply is sent back having the given code and
-   text reason. The reply is sent stateful or stateless, depending of the
-   TM module: if a transaction exists for the current request, then the
-   reply is sent statefully, otherwise stateless.
+   For  the  current  request, a reply is sent back having the given code
+   and text reason. The reply is sent stateful or stateless, depending of
+   the  TM  module: if a transaction exists for the current request, then
+   the reply is sent statefully, otherwise stateless.
 
    Meaning of the parameters is as follows:
      * code - Return code.
      * reason - Reason phrase.
 
-   This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
+   This   function   can   be  used  from  REQUEST_ROUTE,  FAILURE_ROUTE,
    BRANCH_ROUTE.
 
-   Example 5. send_reply usage
+   Example 1.5. send_reply usage
 ...
 send_reply("404", "Not found");
 ...
 send_reply("403", "Invalid user - $fU");
 ...
 
-3.3. sl_reply_error()
+3.3.  sl_reply_error()
 
-   Sends back an error reply describing the nature of the last internal
-   error. Usually this function should be used after a script function
+   Sends  back  an error reply describing the nature of the last internal
+   error.  Usually  this  function should be used after a script function
    that returned an error code.
 
-   Example 6. sl_reply_error usage
+   Example 1.6. sl_reply_error usage
 ...
 sl_reply_error();
 ...
 
-3.4. sl_forward _reply([ code, [ reason ] ])
+3.4.  sl_forward _reply([ code, [ reason ] ])
 
-   Forward statelessy the current received SIP reply, with the option to
-   change the status code and reason text. The new code has to be in the
-   same class. The received reply is forwarded as well by core when the
+   Forward  statelessy the current received SIP reply, with the option to
+   change  the status code and reason text. The new code has to be in the
+   same  class.  The received reply is forwarded as well by core when the
    config execution ended, unless it is dropped from config.
 
    Meaning of the parameters is as follows:
@@ -155,7 +248,7 @@ sl_reply_error();
 
    This function can be used from ONREPLY_ROUTE.
 
-   Example 7. send_reply usage
+   Example 1.7. send_reply usage
 ...
 if(status=="408")
     sl_forward_reply("404", "Not found");

+ 178 - 117
modules/sms/README

@@ -1,95 +1,153 @@
-1. SMS Module
+
+SMS Module
 
 Bogdan Iancu
 
    FhG FOKUS
 
    Copyright © 2003 FhG FOKUS
-     __________________________________________________________________
+     _________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+
+              1.1. Hardware Requirements
+              1.2. Numbering Plan
+              1.3. Address Mapping
+
+        2. Dependencies
+        3. Parameters
+
+              3.1. modems (string)
+              3.2. networks (string)
+              3.3. links (string)
+              3.4. default_net (string)
+              3.5. max_sms_parts (integer)
+              3.6. domain_str (string)
+              3.7. use_contact (integer)
+              3.8. sms_report_type (integer)
+
+        4. Functions
 
-   1.1. Overview
+              4.1. sms_send_msg_to_net(network_name) 
+              4.2. sms_send_msg() 
 
-        1.1.1. Hardware Requirements
-        1.1.2. Numbering Plan
-        1.1.3. Address Mapping
+   List of Examples
 
-   1.2. Dependencies
-   1.3. Parameters
+   1.1. Set modems parameter
+   1.2. Set networks parameter
+   1.3. Set links parameter
+   1.4. Set default_net parameter
+   1.5. Set max_sms_parts parameter
+   1.6. Set domain_str parameter
+   1.7. Set use_contact parameter
+   1.8. Set sms_report_type parameter
+   1.9. sms_send_msg_to_net usage
+   1.10. sms_send_msg usage
 
-        1.3.1. modems (string)
-        1.3.2. networks (string)
-        1.3.3. links (string)
-        1.3.4. default_net (string)
-        1.3.5. max_sms_parts (integer)
-        1.3.6. domain_str (string)
-        1.3.7. use_contact (integer)
-        1.3.8. sms_report_type (integer)
+Chapter 1. Admin Guide
 
-   1.4. Functions
+   Table of Contents
 
-        1.4.1. sms_send_msg_to_net(network_name)
-        1.4.2. sms_send_msg()
+   1. Overview
 
-1.1. Overview
+        1.1. Hardware Requirements
+        1.2. Numbering Plan
+        1.3. Address Mapping
 
-   This module provides a way of communication between SIP network (via
+   2. Dependencies
+   3. Parameters
+
+        3.1. modems (string)
+        3.2. networks (string)
+        3.3. links (string)
+        3.4. default_net (string)
+        3.5. max_sms_parts (integer)
+        3.6. domain_str (string)
+        3.7. use_contact (integer)
+        3.8. sms_report_type (integer)
+
+   4. Functions
+
+        4.1. sms_send_msg_to_net(network_name) 
+        4.2. sms_send_msg() 
+
+1. Overview
+
+   1.1. Hardware Requirements
+   1.2. Numbering Plan
+   1.3. Address Mapping
+
+   This  module  provides a way of communication between SIP network (via
    SIP MESSAGE) and GSM networks (via ShortMessageService). Communication
-   is possible from SIP to SMS and vice versa. The module provides
-   facilities like SMS confirmation--the gateway can confirm to the SIP
-   user if his message really reached its destination as a SMS--or
-   multi-part messages--if a SIP messages is too long it will be split and
-   sent as multiple SMS.
-
-   Errors occurred because of an invalid number or a too long message or
-   because of an internal modem malfunction are reported back to the SIP
+   is  possible  from  SIP  to  SMS  and  vice versa. The module provides
+   facilities  like  SMS confirmation--the gateway can confirm to the SIP
+   user  if  his  message  really  reached  its  destination as a SMS--or
+   multi-part  messages--if  a  SIP messages is too long it will be split
+   and sent as multiple SMS.
+
+   Errors  occurred because of an invalid number or a too long message or
+   because  of an internal modem malfunction are reported back to the SIP
    user via a SIP message containing explanations regarding the error.
 
-1.1.1. Hardware Requirements
-
-   The SMS module needs a GSM modem to be able to send/receive the SMS
-   messages. Usually, this kind of modems are externals, linked to the
-   machine via serial cable. The modem can be a dedicated one (as the ones
-   provided by FALCOM) or can be a GSM telephone that has an internal
-   modem (as the latest mobile phones from NOKIA and ERICSSON).
-
-1.1.2. Numbering Plan
-
-   The gateway accepts and advertises phone numbers in international
-   format, more specific like: +(international code)(area code)(number).
-   Ex: Germany, D1 = +49 170 5678181 Romania, Connex = +40 722 123456 A
-   number in this format is expected to be placed as username into RURI or
-   in the To header. If RURI misses the username, the To header will be
-   consider. Also, the gateway will advertise in this format the username
-   in Contact headers (in SIP replies and requests) and in From headers
-   (in SIP requests).
-
-1.1.3. Address Mapping
-
-   To identify the destination number of the SMS, the gateway expects to
-   have a mobile number in username of the SIP destination address (for
-   example sip:[email protected]). For the reverse direction,
-   because the gateway has only one GSM number, the destination SIP
-   address has to be encapsulated into the SMS body. The gateway expects
-   to find a SIP address at the beginning of the SMS body in
-   "sip:user.host" format. Everything before the SIP address will be
-   discarded, the useful text begins exactly after the address (for
-   example SMS="For sip:user@host hello world!!" -> SIP="hello world"),
-   view configuration for disable this behavior (modems parameters 's' y
-   't'). In order to facilitate replying, the gateway sends all the SMS
-   messages with a header containing the source SIP address in the
-   following format: "From sip:user@host (if you reply DONOT remove
-   it)<new_line>". When an SMS-reply is received having this header (all
-   of it or truncated at the end), the header will be left out (it will
+1.1. Hardware Requirements
+
+   The  SMS  module  needs a GSM modem to be able to send/receive the SMS
+   messages.  Usually,  this  kind of modems are externals, linked to the
+   machine  via  serial  cable.  The modem can be a dedicated one (as the
+   ones  provided  by  FALCOM)  or  can  be  a  GSM telephone that has an
+   internal modem (as the latest mobile phones from NOKIA and ERICSSON).
+
+1.2. Numbering Plan
+
+   The  gateway  accepts  and  advertises  phone numbers in international
+   format,  more specific like: +(international code)(area code)(number).
+   Ex:  Germany,  D1 = +49 170 5678181 Romania, Connex = +40 722 123456 A
+   number  in  this format is expected to be placed as username into RURI
+   or  in  the To header. If RURI misses the username, the To header will
+   be  consider.  Also,  the  gateway  will  advertise in this format the
+   username  in Contact headers (in SIP replies and requests) and in From
+   headers (in SIP requests).
+
+1.3. Address Mapping
+
+   To  identify the destination number of the SMS, the gateway expects to
+   have  a  mobile number in username of the SIP destination address (for
+   example   sip:[email protected]).  For  the  reverse  direction,
+   because  the  gateway  has  only  one  GSM number, the destination SIP
+   address  has to be encapsulated into the SMS body. The gateway expects
+   to   find  a  SIP  address  at  the  beginning  of  the  SMS  body  in
+   "sip:user.host"  format.  Everything  before  the  SIP address will be
+   discarded,  the  useful  text  begins  exactly  after the address (for
+   example  SMS="For  sip:user@host hello world!!" -> SIP="hello world"),
+   view  configuration for disable this behavior (modems parameters 's' y
+   't').  In  order to facilitate replying, the gateway sends all the SMS
+   messages  with  a  header  containing  the  source  SIP address in the
+   following  format:  "From  sip:user@host  (if  you  reply DONOT remove
+   it)<new_line>".  When an SMS-reply is received having this header (all
+   of  it  or truncated at the end), the header will be left out (it will
    not be in the SIP message).
 
-1.2. Dependencies
+2. Dependencies
 
    The following modules must be loaded before this module:
      * tm - Transaction Manager.
 
-1.3. Parameters
+3. Parameters
 
-1.3.1. modems (string)
+   3.1. modems (string)
+   3.2. networks (string)
+   3.3. links (string)
+   3.4. default_net (string)
+   3.5. max_sms_parts (integer)
+   3.6. domain_str (string)
+   3.7. use_contact (integer)
+   3.8. sms_report_type (integer)
+
+3.1. modems (string)
 
    Define and configure one or more GSM modems.
 modems_value     = modem_definition *( ";" modem_definition )
@@ -98,36 +156,36 @@ list_of_params   = modem_param *( ";" modem_param )
 modem_param      = name "=" value
 
    The following parameters can be used:
-     * d=device (mandatory) - Device associated with modem (/dev/ttyS0,
+     * d=device  (mandatory)  - Device associated with modem (/dev/ttyS0,
        /dev/modem, etc.).
      * p=pin (optional) - SIM PIN - default is NULL.
      * m=mode (optional) - Modem working mode
        ("ASCII","OLD","DIGICOM","NEW"). Default value is "NEW".
-     * c=SMS_Center (optional) - SMS center number for that modem. Default
-       is the SMS center set on the SIM card.
+     * c=SMS_Center  (optional)  -  SMS  center  number  for  that modem.
+       Default is the SMS center set on the SIM card.
      * b=baudrate (optional) - Default is 19600.
-     * r=retry (optional) - How many times to try to re-send a SMS that
+     * r=retry  (optional)  - How many times to try to re-send a SMS that
        reported error. Default is twice.
-     * l=looping (optional) - Time for modem to wait before performing a
+     * l=looping  (optional) - Time for modem to wait before performing a
        new check for incomimg/outgoing SMS/SIP_MSG. Default is 20.
      * t=to (optional) - uri for sip header TO. Default is NULL.
      * s=scan (optional) - Values: 0: NOT SCAN uri from body sms, use URI
-       in t=to. 1: SCAN uri from body sms (normal mode, default mode,
-       clasic mode) 2: SCAN MIX (both modes), First SCAN Default is 1
+       in  t=to.  1:  SCAN  uri from body sms (normal mode, default mode,
+       clasic  mode)  2:  SCAN  MIX (both modes), First SCAN Default is 1
        (SCAN).
 
 Note
 
    No default value, the parameter is mandatory.
 
-   Example 1. Set modems parameter
+   Example 1.1. Set modems parameter
 ...
 modparam("sms", "modems", "Nokia[d=/dev/ttyS1;s=0;t=sip:[email protected]]")
 modparam("sms", "modems", "Nokia [d=/dev/ttyS1;b=9600;m=new;l=30] ")
 modparam("sms", "modems", "Nokia[d=/dev/ttyS1];Siemens[d=/dev/ttyS2]")
 ...
 
-1.3.2. networks (string)
+3.2. networks (string)
 
    Define and configure used GSM networks.
 networks_value = net_definition *( ";" net_definition )
@@ -136,25 +194,25 @@ list_of_params = set_param *( ";" set_param )
 set_param      = name "=" value
 
    The following parameters can be used:
-     * m=msx_sms_per_call (optional) - Maximum number of SMS send /
-       received from that net in one modem loop. Default is 10. This
+     * m=msx_sms_per_call  (optional)  -  Maximum  number  of  SMS send /
+       received  from  that  net  in  one modem loop. Default is 10. This
        parameter was introduced to avoid starvation.
-       Example of the starvation--a modem can send SMS for more than 1
-       networks. If you have a huge number of SMS for the first network
-       and the number of incoming SIP messages is equal to the sent SMS
-       per same unit of time, the modem will never get to send SMS for the
-       next networks.
+       Example  of  the  starvation--a modem can send SMS for more than 1
+       networks.  If  you have a huge number of SMS for the first network
+       and  the  number of incoming SIP messages is equal to the sent SMS
+       per  same  unit  of time, the modem will never get to send SMS for
+       the next networks.
 
 Note
 
    No default value, the parameter is mandatory.
 
-   Example 2. Set networks parameter
+   Example 1.2. Set networks parameter
 ...
 modparam("sms", "networks", "D1 [m=10] ;d2[ m=20]")
 ...
 
-1.3.3. links (string)
+3.3. links (string)
 
    Define from which network each modem should send SMS.
 links_value = modem_assoc *( ";" modem_assoc )
@@ -165,96 +223,99 @@ Note
 
    No default value, the parameter is mandatory.
 
-   Example 3. Set links parameter
+   Example 1.3. Set links parameter
 ...
 modparam("sms", "links", "NOKIA[D1;d2]")
 ...
 
    The modem NOKIA will send SMS from D1 and D2 net (in this order !). if
-   in a net queue are more then max_sms_per_call SMS the modem will not
+   in  a  net queue are more then max_sms_per_call SMS the modem will not
    sleep before starting the next loop ! Shortly, if messages are waiting
    to be sent, the modem will not go in sleep.
 
-1.3.4. default_net (string)
+3.4. default_net (string)
 
-   The default network to use. If no one specified, the first defined
-   network is used. This parameter is useful only if the "sms_send_msg"
-   exported function is used (see Section 1.4, "Functions").
+   The  default  network  to  use. If no one specified, the first defined
+   network  is  used. This parameter is useful only if the "sms_send_msg"
+   exported function is used (see Section 4, "Functions").
 
-   Example 4. Set default_net parameter
+   Example 1.4. Set default_net parameter
 ...
 modparam("sms", "default_net", "D1")
 ...
 
-1.3.5. max_sms_parts (integer)
+3.5. max_sms_parts (integer)
 
-   Shows in how many parts (SMS messages) a SIP message can be split. If
+   Shows  in how many parts (SMS messages) a SIP message can be split. If
    exceeded, the SIP message will be sent truncated and the SIP user will
    get back another message containing the unsent part.
 
    Default value is 4.
 
-   Example 5. Set max_sms_parts parameter
+   Example 1.5. Set max_sms_parts parameter
 ...
 modparam("sms", "max_sms_parts", 10)
 ...
 
-1.3.6. domain_str (string)
+3.6. domain_str (string)
 
-   Specify a fake domain name to be used by the gateway. The Contact
-   headers and the From header from request will be construct based on
-   this fake domain name. It's useful when the gateway is transparently
+   Specify  a  fake  domain  name  to be used by the gateway. The Contact
+   headers  and  the  From header from request will be construct based on
+   this  fake  domain name. It's useful when the gateway is transparently
    hidden behind a proxy/register (located on different machines).
 
    Default is the name of the machine the gateway is running on.
 
-   Example 6. Set domain_str parameter
+   Example 1.6. Set domain_str parameter
 ...
 modparam("sms", "domain_str", "foo.bar")
 ...
 
-1.3.7. use_contact (integer)
+3.7. use_contact (integer)
 
    If a contact header should be added to the outgoing SIP messages. Even
    if the SIP draft forbids this, some UAS require it.
 
    Default is 0 (no).
 
-   Example 7. Set use_contact parameter
+   Example 1.7. Set use_contact parameter
 ...
 modparam("sms", "use_contact", 1)
 ...
 
-1.3.8. sms_report_type (integer)
+3.8. sms_report_type (integer)
 
-   If the modem should ask for SMS confirmation from the SMS Center. If
-   the SMSC reply with an error code, the gateway will send back to SIP
-   user a SIP message containing the text (or part of it) that couldn't be
-   send. Two report mechanisms are implemented:
+   If  the  modem should ask for SMS confirmation from the SMS Center. If
+   the  SMSC  reply with an error code, the gateway will send back to SIP
+   user  a  SIP message containing the text (or part of it) that couldn't
+   be send. Two report mechanisms are implemented:
      * 1 - the reports are delivered by the GSM device as SMS reports (so
        far supported only by Nokia modems);
-     * 2 - the reports are delivered as async. CDS responses (supported by
-       almost all modems, except Ericsson).
+     * 2  -  the reports are delivered as async. CDS responses (supported
+       by almost all modems, except Ericsson).
 
    Default is 0 (no report).
 
-   Example 8. Set sms_report_type parameter
+   Example 1.8. Set sms_report_type parameter
 ...
 modparam("sms", "sms_report_type", 1)
 ...
 
-1.4. Functions
+4. Functions
+
+   4.1. sms_send_msg_to_net(network_name) 
+   4.2. sms_send_msg() 
 
-1.4.1. sms_send_msg_to_net(network_name)
+4.1.  sms_send_msg_to_net(network_name)
 
-   Put the SIP msg in the specified network queue. The function return
+   Put  the  SIP  msg in the specified network queue. The function return
    error if the number encapsulated into SIP message is malformed, if the
    content_type is incorrect or because of some internal failures.
 
    Meaning of the parameters is as follows:
      * network_name - Name of network.
 
-   Example 9. sms_send_msg_to_net usage
+   Example 1.9. sms_send_msg_to_net usage
 ...
 if (sms_send_msg_to_net("D1"))
 {
@@ -273,11 +334,11 @@ if (sms_send_msg_to_net("D1"))
 };
 ...
 
-1.4.2. sms_send_msg()
+4.2.  sms_send_msg()
 
    The same as the previous one, but use the default network queue.
 
-   Example 10. sms_send_msg usage
+   Example 1.10. sms_send_msg usage
 ...
 if (sms_send_msg_to_net())
 {

+ 129 - 60
modules/textopsx/README

@@ -1,5 +1,5 @@
 
-1. Textopsx Module
+Textopsx Module
 
 Andrei Pelinescu-Onciul
 
@@ -13,38 +13,107 @@ Daniel-Constantin Mierla
    Copyright © 2003 FhG FOKUS
      _________________________________________________________________
 
-   1.1. Overview
-   1.2. Functions
-
-        1.2.1. msg_apply_changes() 
-        1.2.2. change_reply_status(code, reason) 
-        1.2.3. remove_body() 
-        1.2.4. keep_hf(regexp) 
-        1.2.5. fnmatch(value, expr [, flags]) 
-        1.2.6. append_hf_value(hf, hvalue) 
-        1.2.7. insert_hf_value(hf, hvalue) 
-        1.2.8. remove_hf_value(hf_par) 
-        1.2.9. remove_hf_value2(hf_par) 
-        1.2.10. assign_hf_value(hf, hvalue) 
-        1.2.11. assign_hf_value2(hf, hvalue) 
-        1.2.12. include_hf_value(hf, hvalue) 
-        1.2.13. exclude_hf_value(hf, hvalue) 
-        1.2.14. hf_value_exists(hf, hvalue) 
-        1.2.15. Selects
-
-              1.2.15.1. @hf_value
-              1.2.15.2. @hf_value2
-              1.2.15.3. @hf_value_exists
-
-1.1. Overview
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+        2. Functions
+
+              2.1. msg_apply_changes() 
+              2.2. change_reply_status(code, reason) 
+              2.3. remove_body() 
+              2.4. keep_hf(regexp) 
+              2.5. fnmatch(value, expr [, flags]) 
+              2.6. append_hf_value(hf, hvalue) 
+              2.7. insert_hf_value(hf, hvalue) 
+              2.8. remove_hf_value(hf_par) 
+              2.9. remove_hf_value2(hf_par) 
+              2.10. assign_hf_value(hf, hvalue) 
+              2.11. assign_hf_value2(hf, hvalue) 
+              2.12. include_hf_value(hf, hvalue) 
+              2.13. exclude_hf_value(hf, hvalue) 
+              2.14. hf_value_exists(hf, hvalue) 
+              2.15. Selects
+
+                    2.15.1. @hf_value
+                    2.15.2. @hf_value2
+                    2.15.3. @hf_value_exists
+
+   List of Examples
+
+   1.1. msg_apply_changes() usage
+   1.2. change_reply_status usage
+   1.3. remove_body() usage
+   1.4. keep_hf() usage
+   1.5. fnmatch() usage
+   1.6. append_hf_value usage
+   1.7. insert_hf_value usage
+   1.8. remove_hf_value usage
+   1.9. remove_hf_value2 usage
+   1.10. assign_hf_value usage
+   1.11. assign_hf_value2 usage
+   1.12. include_hf_value usage
+   1.13. exclude_hf_value usage
+   1.14. hf_value_exists usage
+   1.15. @hf_value select usage
+
+Chapter 1. Admin Guide
+
+   Table of Contents
+
+   1. Overview
+   2. Functions
+
+        2.1. msg_apply_changes() 
+        2.2. change_reply_status(code, reason) 
+        2.3. remove_body() 
+        2.4. keep_hf(regexp) 
+        2.5. fnmatch(value, expr [, flags]) 
+        2.6. append_hf_value(hf, hvalue) 
+        2.7. insert_hf_value(hf, hvalue) 
+        2.8. remove_hf_value(hf_par) 
+        2.9. remove_hf_value2(hf_par) 
+        2.10. assign_hf_value(hf, hvalue) 
+        2.11. assign_hf_value2(hf, hvalue) 
+        2.12. include_hf_value(hf, hvalue) 
+        2.13. exclude_hf_value(hf, hvalue) 
+        2.14. hf_value_exists(hf, hvalue) 
+        2.15. Selects
+
+              2.15.1. @hf_value
+              2.15.2. @hf_value2
+              2.15.3. @hf_value_exists
+
+1. Overview
 
    This  module  implements  functions for SIP message text operations in
    routing  block  configurations.  It  adds  new features similar to the
    textops module (textops eXtentions).
 
-1.2. Functions
-
-1.2.1.  msg_apply_changes()
+2. Functions
+
+   2.1. msg_apply_changes() 
+   2.2. change_reply_status(code, reason) 
+   2.3. remove_body() 
+   2.4. keep_hf(regexp) 
+   2.5. fnmatch(value, expr [, flags]) 
+   2.6. append_hf_value(hf, hvalue) 
+   2.7. insert_hf_value(hf, hvalue) 
+   2.8. remove_hf_value(hf_par) 
+   2.9. remove_hf_value2(hf_par) 
+   2.10. assign_hf_value(hf, hvalue) 
+   2.11. assign_hf_value2(hf, hvalue) 
+   2.12. include_hf_value(hf, hvalue) 
+   2.13. exclude_hf_value(hf, hvalue) 
+   2.14. hf_value_exists(hf, hvalue) 
+   2.15. Selects
+
+        2.15.1. @hf_value
+        2.15.2. @hf_value2
+        2.15.3. @hf_value_exists
+
+2.1.  msg_apply_changes()
 
    Use  this  function to apply changes performed on SIP request content.
    Be  careful  when  using  this  function;  due  to special handling of
@@ -53,7 +122,7 @@ Daniel-Constantin Mierla
 
    This function can be used from REQUEST_ROUTE.
 
-   Example 1. msg_apply_changes() usage
+   Example 1.1. msg_apply_changes() usage
 ...
 append_hf("My-Header: yes\r\n");
 if(msg_apply_changes())
@@ -66,7 +135,7 @@ if(msg_apply_changes())
 }
 ...
 
-1.2.2.  change_reply_status(code, reason)
+2.2.  change_reply_status(code, reason)
 
    Intercept a SIP reply (in an onreply_route) and change its status code
    and reason phrase prior to forwarding it.
@@ -77,7 +146,7 @@ if(msg_apply_changes())
 
    This function can be used from ONREPLY_ROUTE.
 
-   Example 2. change_reply_status usage
+   Example 1.2. change_reply_status usage
 ...
 onreply_route {
     if (@status == "603") {
@@ -87,18 +156,18 @@ onreply_route {
 }
 ...
 
-1.2.3.  remove_body()
+2.3.  remove_body()
 
    Use this function to remove the body of SIP requests or replies.
 
    This function can be used from ANY_ROUTE.
 
-   Example 3. remove_body() usage
+   Example 1.3. remove_body() usage
 ...
 remove_body();
 ...
 
-1.2.4.  keep_hf(regexp)
+2.4.  keep_hf(regexp)
 
    Remove headers that don't match the regular expression regexp. Several
    header  are ignored always (thus not removed): Via, From, To, Call-ID,
@@ -107,12 +176,12 @@ remove_body();
 
    This function can be used from ANY_ROUTE.
 
-   Example 4. keep_hf() usage
+   Example 1.4. keep_hf() usage
 ...
 keep_hf("User-Agent");
 ...
 
-1.2.5.  fnmatch(value, expr [, flags])
+2.5.  fnmatch(value, expr [, flags])
 
    Match  the  value  against the expr using shell-style pattern for file
    name  matching (see man page for C function fnmatch()). It is known to
@@ -123,7 +192,7 @@ keep_hf("User-Agent");
 
    This function can be used from ANY_ROUTE.
 
-   Example 5. fnmatch() usage
+   Example 1.5. fnmatch() usage
 ...
 if(fnmatch("$rU", "123*"))
 {
@@ -131,7 +200,7 @@ if(fnmatch("$rU", "123*"))
 }
 ...
 
-1.2.6.  append_hf_value(hf, hvalue)
+2.6.  append_hf_value(hf, hvalue)
 
    Append new header value after an existing header, if no index acquired
    append  at  the  end  of list. Note that a header may consist of comma
@@ -143,7 +212,7 @@ if(fnmatch("$rU", "123*"))
        message.
      * hvalue - Value to be added, config var formatting supported.
 
-   Example 6. append_hf_value usage
+   Example 1.6. append_hf_value usage
 ...
 append_hf_value("foo", "gogo;stamp=$Ts")   # add new header
 append_hf_value("foo[1]", "gogo")  # add new value behind first value
@@ -151,7 +220,7 @@ append_hf_value("foo[-1]", "$var(Bar)") # try add value to the last header, if
 not exists add new header
 ...
 
-1.2.7.  insert_hf_value(hf, hvalue)
+2.7.  insert_hf_value(hf, hvalue)
 
    Insert  new  header  value  before  an  existing  header,  if no index
    acquired insert before first hf header. Note that a header may consist
@@ -164,14 +233,14 @@ not exists add new header
        message.
      * hvalue - Value to be added, config var formatting supported.
 
-   Example 7. insert_hf_value usage
+   Example 1.7. insert_hf_value usage
 ...
 insert_hf_value("foo[2]", "gogo")
 insert_hf_value("foo", "$avp(foo)")   # add new header at the top of list
 insert_hf_value("foo[1]", "gogo") # try add to the first header
 ...
 
-1.2.8.  remove_hf_value(hf_par)
+2.8.  remove_hf_value(hf_par)
 
    Remove  the  header value from existing header, Note that a header may
    consist of comma delimited list of values.
@@ -181,7 +250,7 @@ insert_hf_value("foo[1]", "gogo") # try add to the first header
        ] [. PARAM ] If asterisk is specified as index then all values are
        affected.
 
-   Example 8. remove_hf_value usage
+   Example 1.8. remove_hf_value usage
 ...
 remove_hf_value("foo")  # remove foo[1]
 remove_hf_value("foo[*]")  # remove all foo's headers
@@ -190,7 +259,7 @@ remove_hf_value("foo.bar")  # delete parameter
 remove_hf_value("foo[*].bar") # for each foo delete bar parameters
 ...
 
-1.2.9.  remove_hf_value2(hf_par)
+2.9.  remove_hf_value2(hf_par)
 
    Remove  specified  header  or  parameter.  It  is  expected  header in
    Authorization  format (comma delimiters are not treated as multi-value
@@ -201,7 +270,7 @@ remove_hf_value("foo[*].bar") # for each foo delete bar parameters
        PARAM  ]  If  asterisk  is  specified as index then all values are
        affected.
 
-   Example 9. remove_hf_value2 usage
+   Example 1.9. remove_hf_value2 usage
 ...
 remove_hf_value2("foo")  # remove foo[1]
 remove_hf_value2("foo[*]")  # remove all foo's headers, the same as remove_hf_h
@@ -211,7 +280,7 @@ remove_hf_value2("foo.bar")  # delete parameter
 remove_hf_value2("foo[*].bar") # for each foo delete bar parameters
 ...
 
-1.2.10.  assign_hf_value(hf, hvalue)
+2.10.  assign_hf_value(hf, hvalue)
 
    Assign value to specified header value / param.
 
@@ -222,7 +291,7 @@ remove_hf_value2("foo[*].bar") # for each foo delete bar parameters
      * hvalue - Value to be assigned, config var formatting supported. If
        value is empty then no equal sign apears in param.
 
-   Example 10. assign_hf_value usage
+   Example 1.10. assign_hf_value usage
 ...
 assign_hf_value("foo", "gogo")  # foo[1]
 assign_hf_value("foo[-1]", "gogo")  # foo[last_foo]
@@ -233,7 +302,7 @@ assign_hf_value("foo[*]", "")  # remove all foo's, empty value remains
 assign_hf_value("foo[*].bar", "")  # set empty value (ex. lr)
 ...
 
-1.2.11.  assign_hf_value2(hf, hvalue)
+2.11.  assign_hf_value2(hf, hvalue)
 
    Assign   value   to   specified  header.  It  is  expected  header  in
    Authorization  format (comma delimiters are not treated as multi-value
@@ -246,14 +315,14 @@ assign_hf_value("foo[*].bar", "")  # set empty value (ex. lr)
      * hvalue - Value to be assigned, config var formatting supported. If
        value is empty then no equal sign apears in param.
 
-   Example 11. assign_hf_value2 usage
+   Example 1.11. assign_hf_value2 usage
 ...
 assign_hf_value2("Authorization.integrity-protected", "\"yes\"")
 assign_hf_value2("foo[-1]", "gogo")  # foo[last_foo]
 assign_hf_value2("foo[*].bar", "")  # set empty value (ex. lr)
 ...
 
-1.2.12.  include_hf_value(hf, hvalue)
+2.12.  include_hf_value(hf, hvalue)
 
    Add value in set if not exists, eg. "Supported: path,100rel".
 
@@ -261,12 +330,12 @@ assign_hf_value2("foo[*].bar", "")  # set empty value (ex. lr)
      * hf - Header field name to be affected.
      * hvalue - config var formatting supported.
 
-   Example 12. include_hf_value usage
+   Example 1.12. include_hf_value usage
 ...
 include_hf_value("Supported", "path");
 ...
 
-1.2.13.  exclude_hf_value(hf, hvalue)
+2.13.  exclude_hf_value(hf, hvalue)
 
    Remove value from set if exists, eg. "Supported: path,100rel".
 
@@ -274,12 +343,12 @@ include_hf_value("Supported", "path");
      * hf - Header field name to be affected.
      * hvalue - config formatting supported.
 
-   Example 13. exclude_hf_value usage
+   Example 1.13. exclude_hf_value usage
 ...
 exclude_hf_value("Supported", "100rel");
 ...
 
-1.2.14.  hf_value_exists(hf, hvalue)
+2.14.  hf_value_exists(hf, hvalue)
 
    Check     if     value     exists    in    set.    Alternate    select
    @hf_value_exists.HF.VALUE may be used. It returns one or zero.
@@ -289,7 +358,7 @@ exclude_hf_value("Supported", "100rel");
        dashes.
      * hvalue - config var formatting supported.
 
-   Example 14. hf_value_exists usage
+   Example 1.14. hf_value_exists usage
 ...
 if (hf_value_exists("Supported", "100rel")) {
 
@@ -300,9 +369,9 @@ if (@hf_value_exists.supported.path == "1") {
 }
 ...
 
-1.2.15. Selects
+2.15. Selects
 
-1.2.15.1. @hf_value
+2.15.1. @hf_value
 
    Get  value  of  required  header-value  or  param. Note that functions
    called  'value2'  works with Authorization-like headers where comma is
@@ -332,7 +401,7 @@ if (@hf_value_exists.supported.path == "1") {
      * IDX - Value index, negative value counts from bottom
      * PARAM_NAME - name of parameter
 
-   Example 15. @hf_value select usage
+   Example 1.15. @hf_value select usage
 ...
 $a = @hf_value.my_header[1].my_param;
 xplog("L_ERR", "$sel(@hf_value.via[-1]), $sel(@hf_value.from.tag)\n");
@@ -344,10 +413,10 @@ $rr = @hf_value.route.uri;
 $prt = @hf_value2.authorization.integrity_protected;
 ...
 
-1.2.15.2. @hf_value2
+2.15.2. @hf_value2
 
    TBA.
 
-1.2.15.3. @hf_value_exists
+2.15.3. @hf_value_exists
 
    TBA.

+ 80 - 41
modules/timer/README

@@ -1,46 +1,81 @@
-1. timer module
+
+timer module
 
 Tomas Mandys
 
    Iptel.org
 
    Copyright © 2007 iptelorg GmbH
-     __________________________________________________________________
+     _________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+        2. Dependencies
+        3. ABNF syntax
+        4. Parameters
+
+              4.1. declare_timer (string)
+
+        5. Functions
+
+              5.1. timer_enable(timer_id, enable_disable) 
+              5.2. @timer.timer.timer_id.enabled 
+              5.3. @timer.executed 
 
-   1.1. Overview
-   1.2. Dependencies
-   1.3. ABNF syntax
-   1.4. Parameters
+        6. Examples
 
-        1.4.1. declare_timer (string)
+   List of Examples
 
-   1.5. Functions
+   1.1. Example declare_timer
+   1.2. timer_enable usage
+   1.3. timer.timer.timer_id.enabled usage
+   1.4. timer.executed usage
+   1.5. timer common example
+   1.6. Using timer module for testing a functionality
 
-        1.5.1. timer_enable(timer_id, enable_disable)
-        1.5.2. @timer.timer.timer_id.enabled
-        1.5.3. @timer.executed
+Chapter 1. Admin Guide
 
-   1.6. Examples
+   Table of Contents
 
-1.1. Overview
+   1. Overview
+   2. Dependencies
+   3. ABNF syntax
+   4. Parameters
+
+        4.1. declare_timer (string)
+
+   5. Functions
+
+        5.1. timer_enable(timer_id, enable_disable) 
+        5.2. @timer.timer.timer_id.enabled 
+        5.3. @timer.executed 
+
+   6. Examples
+
+1. Overview
 
    The module supports triggering specific route block on timer.
 
-1.2. Dependencies
+2. Dependencies
 
    none
 
-1.3. ABNF syntax
+3. ABNF syntax
 
         timer_id = alphanum
         slow_fast = "slow" | "fast"
-        declare_timer_syntax = timer_id "=" (route#|route_name) "," interval ","
- slow_fast "," ["enable"]
+        declare_timer_syntax = timer_id "=" (route#|route_name) "," interval ",
+" slow_fast "," ["enable"]
         enable_disable = "0" | "1"
 
-1.4. Parameters
+4. Parameters
+
+   4.1. declare_timer (string)
 
-1.4.1. declare_timer (string)
+4.1. declare_timer (string)
 
    Declares timer route which will be called in specific interval.
 
@@ -48,58 +83,62 @@ Tomas Mandys
                         declare_timer = declare_timer_syntax
 
    timer_id is timer identifier, route is handler to be called when timer
-   is triggered, interval is timer interval in milliseconds, slow_fast
+   is  triggered,  interval  is timer interval in milliseconds, slow_fast
    determines if handler will be hooked in slow or fast timer queue, fast
-   timer handler returns as quickly as possible, slow timer handler may
+   timer  handler  returns as quickly as possible, slow timer handler may
    spend longer time, see ser/doc/timers.txt documentation. Use enable to
    enable timer when ser is starting, otherwise use timer_enable to start
    it later.
 
-   Example 1. Example declare_timer
+   Example 1.1. Example declare_timer
         ...
-        modparam("timer", "declare_timer", "MY_TIMER=MY_TIMER_ROUTE,10,slow,enab
-le");
+        modparam("timer", "declare_timer", "MY_TIMER=MY_TIMER_ROUTE,10,slow,ena
+ble");
         ...
 
-1.5. Functions
+5. Functions
+
+   5.1. timer_enable(timer_id, enable_disable) 
+   5.2. @timer.timer.timer_id.enabled 
+   5.3. @timer.executed 
 
-1.5.1. timer_enable(timer_id, enable_disable)
+5.1.  timer_enable(timer_id, enable_disable)
 
-   Enable/disable timer route specified by timer_id. Because of timer core
-   API the callback is not disabled immediately but is removed from
-   handler by itself not to decrease performance. Disabling and enabling
-   in sequence may be tricky. timer_id references to timer declared by
+   Enable/disable  timer  route  specified  by timer_id. Because of timer
+   core  API the callback is not disabled immediately but is removed from
+   handler  by itself not to decrease performance. Disabling and enabling
+   in  sequence  may  be tricky. timer_id references to timer declared by
    declare_timer.
 
-   Example 2. timer_enable usage
+   Example 1.2. timer_enable usage
         ...
         timer_enable("MY_TIMER", 1);
         ...
 
-1.5.2. @timer.timer.timer_id.enabled
+5.2.  @timer.timer.timer_id.enabled
 
    Return true ("1") if timer specified by timer_id is enabled, otherwise
    returns false ("0").
 
-   Example 3. timer.timer.timer_id.enabled usage
+   Example 1.3. timer.timer.timer_id.enabled usage
         if (@timer.timer.MY_TIMER.enabled == "1") {
         ....
         }
 
-1.5.3. @timer.executed
+5.3.  @timer.executed
 
    Returns name of timer which has been executed, i.e. non empty value is
    returned only when handler is being processed.
 
-   Example 4. timer.executed usage
+   Example 1.4. timer.executed usage
         if (@timer.executed != "") {
                 # timer is being handled
         ....
         }
 
-1.6. Examples
+6. Examples
 
-   Example 5. timer common example
+   Example 1.5. timer common example
 loadmodule "modules/xprint/xprint.so"
 loadmodule "modules/timer/timer.so"
 
@@ -121,11 +160,11 @@ route["ONTIMER2"] {
         route("print");
 }
 
-   Example 6. Using timer module for testing a functionality
+   Example 1.6. Using timer module for testing a functionality
 
-   The timer module may be used to test a functionality being developed
-   and not requiring real request.A developer may put tested code in route
-   section which is called once after ser starts.
+   The  timer  module may be used to test a functionality being developed
+   and  not  requiring  real  request.A  developer may put tested code in
+   route section which is called once after ser starts.
 loadmodule "timer";
 loadmodule "xprint";
 

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 515 - 368
modules/tls/README


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 609 - 345
modules/tm/README


+ 173 - 115
modules/uid_auth_db/README

@@ -1,4 +1,5 @@
-1. Auth_db Module
+
+UID Auth DB Module
 
 Jan Janak
 
@@ -10,216 +11,273 @@ Jakob Schlyter
    <[email protected]>
 
    Copyright © 2002, 2003 FhG FOKUS
-     __________________________________________________________________
-
-   1.1. Overview
-   1.2. Dependencies
-   1.3. Parameters
-
-        1.3.1. db_url (string)
-        1.3.2. user_column (string)
-        1.3.3. domain_column (string)
-        1.3.4. password_column (string)
-        1.3.5. rpid_column (string)
-        1.3.6. calculate_ha1 (integer)
-        1.3.7. plain_password_column (string)
-        1.3.8. password_column_2 (string)
-        1.3.9. use_rpid (integer)
-
-   1.4. Functions
-
-        1.4.1. www_authorize(realm, table)
-        1.4.2. proxy_authorize(realm, table)
-
-1.1. Overview
-
-   This module contains all authentication related functions that need the
-   access to the database. This module should be used together with auth
-   module, it cannot be used independently because it depends on the
-   module. Select this module if you want to use database to store
+     _________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+        2. Dependencies
+        3. Parameters
+
+              3.1. db_url (string)
+              3.2. user_column (string)
+              3.3. domain_column (string)
+              3.4. password_column (string)
+              3.5. rpid_column (string)
+              3.6. calculate_ha1 (integer)
+              3.7. plain_password_column (string)
+              3.8. password_column_2 (string)
+              3.9. use_rpid (integer)
+
+        4. Functions
+
+              4.1. www_authorize(realm, table)
+              4.2. proxy_authorize(realm, table)
+
+   List of Examples
+
+   1.1. db_url parameter usage
+   1.2. user_column usage
+   1.3. domain_column usage
+   1.4. password_column usage
+   1.5. rpid_column usage
+   1.6. calculate_ha1usage
+   1.7. plain_password_column usage
+   1.8. password_column_2 usage
+   1.9. use_rpidusage
+   1.10. www_authorize usage
+   1.11. proxy_authorize usage
+
+Chapter 1. Admin Guide
+
+   Table of Contents
+
+   1. Overview
+   2. Dependencies
+   3. Parameters
+
+        3.1. db_url (string)
+        3.2. user_column (string)
+        3.3. domain_column (string)
+        3.4. password_column (string)
+        3.5. rpid_column (string)
+        3.6. calculate_ha1 (integer)
+        3.7. plain_password_column (string)
+        3.8. password_column_2 (string)
+        3.9. use_rpid (integer)
+
+   4. Functions
+
+        4.1. www_authorize(realm, table)
+        4.2. proxy_authorize(realm, table)
+
+1. Overview
+
+   This  module  contains  all authentication related functions that need
+   the  access  to the database. This module should be used together with
+   auth module, it cannot be used independently because it depends on the
+   module.  Select  this  module  if  you  want  to use database to store
    authentication information like subscriber usernames and passwords. If
    you want to use radius authentication, then use auth_radius instead.
 
-1.2. Dependencies
+2. Dependencies
 
-   The module depends on the following modules (in the other words the
+   The  module  depends  on the following modules (in the other words the
    listed modules must be loaded before this module):
      * auth.  Generic authentication functions.
      * database.  Any database module (currently mysql, postgres, dbtext)
 
-1.3. Parameters
+3. Parameters
+
+   3.1. db_url (string)
+   3.2. user_column (string)
+   3.3. domain_column (string)
+   3.4. password_column (string)
+   3.5. rpid_column (string)
+   3.6. calculate_ha1 (integer)
+   3.7. plain_password_column (string)
+   3.8. password_column_2 (string)
+   3.9. use_rpid (integer)
 
-1.3.1. db_url (string)
+3.1. db_url (string)
 
    This is URL of the database to be used. Value of the parameter depends
-   on the database module used. For example for mysql and postgres modules
-   this is something like mysql://username:password@host:port/database.
-   For dbtext module (which stores data in plaintext files) it is
-   directory in which the database resides.
+   on  the  database  module  used.  For  example  for mysql and postgres
+   modules this is something like
+   mysql://username:password@host:port/database. For dbtext module (which
+   stores  data in plaintext files) it is directory in which the database
+   resides.
 
    Default value is "mysql://serro:47serro11@localhost/ser".
 
-   Example 1. db_url parameter usage
+   Example 1.1. db_url parameter usage
 modparam("auth_db", "db_url", "mysql://foo:[email protected]/ser")
 
-1.3.2. user_column (string)
+3.2. user_column (string)
 
-   This is the name of the column holding usernames. Default value is fine
-   for most people. Use the parameter if you really need to change it.
+   This  is  the  name  of the column holding usernames. Default value is
+   fine  for  most people. Use the parameter if you really need to change
+   it.
 
    Default value is "username".
 
-   Example 2. user_column usage
+   Example 1.2. user_column usage
 modparam("auth_db", "user_column", "user")
 
-1.3.3. domain_column (string)
+3.3. domain_column (string)
 
    This is the name of the column holding domains of users. Default value
-   is fine for most people. Use the parameter if you really need to change
-   it.
+   is  fine  for  most  people.  Use  the parameter if you really need to
+   change it.
 
    Default value is "domain".
 
-   Example 3. domain_column usage
+   Example 1.3. domain_column usage
 modparam("auth_db", "domain_column", "domain")
 
-1.3.4. password_column (string)
+3.4. password_column (string)
 
-   This is the name of the column holding passwords. Passwords can be
+   This  is  the  name  of the column holding passwords. Passwords can be
    either stored as plain text or pre-calculated HA1 strings. HA1 strings
-   are MD5 hashes of username, password, and realm. HA1 strings are more
-   safe because the server doesn't need to know plaintext passwords and
+   are  MD5 hashes of username, password, and realm. HA1 strings are more
+   safe  because  the server doesn't need to know plaintext passwords and
    they cannot be obtained from HA1 strings.
 
    Default value is "ha1".
 
-   Example 4. password_column usage
+   Example 1.4. password_column usage
 modparam("auth_db", "password_column", "password")
 
-1.3.5. rpid_column (string)
+3.5. rpid_column (string)
 
-   This is the name of the column holding information for the
-   Remote-Party-ID header field. Default value is fine for most people.
+   This   is   the  name  of  the  column  holding  information  for  the
+   Remote-Party-ID  header  field. Default value is fine for most people.
    Use the parameter if you really need to change it.
 
    Default value is "rpid".
 
-   Example 5. rpid_column usage
+   Example 1.5. rpid_column usage
 modparam("auth_db", "rpid_column", "remote_party_id")
 
-1.3.6. calculate_ha1 (integer)
+3.6. calculate_ha1 (integer)
 
-   This parameter tells server whether it should read plaintext password
+   This  parameter tells server whether it should read plaintext password
    from the database or HA1 string. If the parameter is set to 1 then the
    server will assume that the column pointed to by plain_password_column
-   contains plaintext passwords and it will calculate HA1 strings on the
+   contains  plaintext passwords and it will calculate HA1 strings on the
    fly.
 
    If the parameter is set to 0 then the server assumes that the database
-   contains HA1 strings directly and will not calculate them. In this case
-   it will use value of password_column as name of column with HA1
-   password. If username parameter of credentials contains also @domain
-   (some user agents put domain in username parameter), then column
-   pointed to by password_column_2 parameter will be used instead. This
-   column should also contain HA1 strings but they should be calculated
-   including the domain in the username parameter (as opposed to
-   password_column which (when containing HA1 strings) should always
+   contains  HA1  strings  directly  and will not calculate them. In this
+   case  it  will use value of password_column as name of column with HA1
+   password.  If  username parameter of credentials contains also @domain
+   (some  user  agents  put  domain  in  username parameter), then column
+   pointed  to  by password_column_2 parameter will be used instead. This
+   column  should  also contain HA1 strings but they should be calculated
+   including  the  domain  in  the  username  parameter  (as  opposed  to
+   password_column  which  (when  containing  HA1  strings) should always
    contains HA1 strings calculated without domain in username.
 
-   This ensures that the authentication will always work when using
+   This  ensures  that  the  authentication  will  always work when using
    pre-calculated HA1 string, not depending on the presence of the domain
    in username.
 
    Default value of this parameter is 0.
 
-   Example 6. calculate_ha1usage
+   Example 1.6. calculate_ha1usage
 modparam("auth_db", "calculate_ha1", 1)
 
-1.3.7. plain_password_column (string)
+3.7. plain_password_column (string)
 
-   This parameter holds the name of column holding plain text password.
+   This  parameter  holds the name of column holding plain text password.
    This column is used when calculate_ha1 is set.
 
    Default value is "password".
 
-   Example 7. plain_password_column usage
+   Example 1.7. plain_password_column usage
 modparam("auth_db", "plain_password_column", "password")
 
-1.3.8. password_column_2 (string)
+3.8. password_column_2 (string)
 
-   As described in the previous section this parameter contains name of
-   column holding pre-calculated HA1 string that were calculated including
-   the domain in the username. This parameter is used only when
+   As  described  in the previous section this parameter contains name of
+   column   holding   pre-calculated  HA1  string  that  were  calculated
+   including the domain in the username. This parameter is used only when
    calculate_ha1 is set to 0 and user agent send a credentials containing
    the domain in the username.
 
    Default value of the parameter is ha1b.
 
-   Example 8. password_column_2 usage
+   Example 1.8. password_column_2 usage
 modparam("auth_db", "password_column_2", "ha1_2")
 
-1.3.9. use_rpid (integer)
+3.9. use_rpid (integer)
 
-   This parameter specifies whether the server should fetch a value for
+   This  parameter  specifies whether the server should fetch a value for
    the Remote-Party-ID header field from the database.
 
-   If the parameter is set to 1 the server expects to find a value for
+   If  the  parameter  is set to 1 the server expects to find a value for
    this header in the column specified by the rpid_column parameter.
 
    Default value of this parameter is 0.
 
-   Example 9. use_rpidusage
+   Example 1.9. use_rpidusage
 modparam("auth_db", "use_rpid", 1)
 
-1.4. Functions
+4. Functions
+
+   4.1. www_authorize(realm, table)
+   4.2. proxy_authorize(realm, table)
 
-1.4.1. www_authorize(realm, table)
+4.1. www_authorize(realm, table)
 
-   The function verifies credentials according to RFC2617. If the
-   credentials are verified successfully then the function will succeed
-   and mark the credentials as authorized (marked credentials can be later
-   used by some other functions). If the function was unable to verify the
-   credentials for some reason then it will fail and the script should
-   call www_challenge which will challenge the user again.
+   The  function  verifies  credentials  according  to  RFC2617.  If  the
+   credentials  are  verified successfully then the function will succeed
+   and  mark  the  credentials  as  authorized (marked credentials can be
+   later  used  by  some  other functions). If the function was unable to
+   verify  the  credentials  for  some  reason  then it will fail and the
+   script should call www_challenge which will challenge the user again.
 
    Meaning of the parameters is as follows:
-     * realm.  Realm is a opaque string that the user agent should present
-       to the user so he can decide what username and password to use.
-       Usually this is domain of the host the server is running on. If an
-       empty string "" is used then the server will generate it from the
-       request. In case of REGISTER requests To header field domain will
-       be used (because this header field represents a user being
-       registered), for all other messages From header field domain will
-       be used.
-     * table.  Table to be used to lookup usernames and passwords (usually
-       subscribers table).
-
-   Example 10. www_authorize usage
+     * realm.   Realm  is  a  opaque  string  that  the user agent should
+       present to the user so he can decide what username and password to
+       use.  Usually this is domain of the host the server is running on.
+       If  an  empty  string  "" is used then the server will generate it
+       from  the  request.  In  case of REGISTER requests To header field
+       domain  will  be used (because this header field represents a user
+       being registered), for all other messages From header field domain
+       will be used.
+     * table.   Table  to  be  used  to  lookup  usernames  and passwords
+       (usually subscribers table).
+
+   Example 1.10. www_authorize usage
 ...
 if (www_authorize("iptel.org", "subscriber")) {
     www_challenge("iptel.org", "1");
 };
 ...
 
-1.4.2. proxy_authorize(realm, table)
+4.2. proxy_authorize(realm, table)
 
-   The function verifies credentials according to RFC2617. If the
-   credentials are verified successfully then the function will succeed
-   and mark the credentials as authorized (marked credentials can be later
-   used by some other functions). If the function was unable to verify the
-   credentials for some reason then it will fail and the script should
-   call proxy_challenge which will challenge the user again.
+   The  function  verifies  credentials  according  to  RFC2617.  If  the
+   credentials  are  verified successfully then the function will succeed
+   and  mark  the  credentials  as  authorized (marked credentials can be
+   later  used  by  some  other functions). If the function was unable to
+   verify  the  credentials  for  some  reason  then it will fail and the
+   script  should  call  proxy_challenge  which  will  challenge the user
+   again.
 
    Meaning of the parameters is as follows:
-     * realm - Realm is a opaque string that the user agent should present
-       to the user so he can decide what username and password to use.
-       Usually this is domain of the host the server is running on.
-       If an empty string "" is used then the server will generate it from
-       the request. From header field domain will be used as realm.
-     * table - Table to be used to lookup usernames and passwords (usually
-       subscribers table).
-
-   Example 11. proxy_authorize usage
+     * realm  -  Realm  is  a  opaque  string  that the user agent should
+       present to the user so he can decide what username and password to
+       use. Usually this is domain of the host the server is running on.
+       If  an  empty  string  "" is used then the server will generate it
+       from the request. From header field domain will be used as realm.
+     * table  -  Table  to  be  used  to  lookup  usernames and passwords
+       (usually subscribers table).
+
+   Example 1.11. proxy_authorize usage
 ...
 if (!proxy_authorize("", "subscriber)) {
     proxy_challenge("", "1");  # Realm will be autogenerated

+ 202 - 138
modules/uid_avp_db/README

@@ -1,4 +1,5 @@
-1. uid_avp_db Module
+
+UID AVP DB Module
 
 Jiri Kuthan
 
@@ -6,144 +7,199 @@ Jiri Kuthan
    <[email protected]>
 
    Copyright © 2004, 2005 FhG FOKUS
-     __________________________________________________________________
-
-   1.1. Overview
-   1.2. Dependencies
-   1.3. Parameters
-
-        1.3.1. db_url (string)
-        1.3.2. user_attrs_table (string)
-        1.3.3. uri_attrs_table (string)
-        1.3.4. uid_column (string)
-        1.3.5. username_column (string)
-        1.3.6. did_column (string)
-        1.3.7. name (string)
-        1.3.8. value_column (string)
-        1.3.9. type_column (string)
-        1.3.10. flags_column (string)
-        1.3.11. scheme_column (string)
-        1.3.12. attr_group (string)
-        1.3.13. auto_unlock_extra_attrs (string)
-
-   1.4. Functions
-
-        1.4.1. load_attrs (track, id)
-        1.4.2. load_extra_attrs (group_id, id)
-        1.4.3. save_extra_attrs (group_id, id)
-        1.4.4. remove_extra_attrs (group_id, id)
-        1.4.5. lock_extra_attrs (group_id, id)
-        1.4.6. unlock_extra_attrs (group_id, id)
-
-   1.5. Example extra attributes usage
-
-1.1. Overview
-
-   This module contains several functions that can be used to manipulate
-   the contents of AVPs (Attribute-Value pairs). The AVPs are variables
-   attached to the SIP message being processed. Each variable has its name
-   and value. AVPs can be used to store arbitrary data or as a means of
-   inter-module comminication.
-
-   You may also want to check the avpops module which is more flexible and
-   contains more functions. In future SER releases the avp module will be
-   probably deprecated in favor of avpops module.
-
-   Domain module operates in caching mode. Domain module reads the default
-   values of AVPs into cache memory when the module is loaded. After that
-   default values is re-read only when module is given avp_list_reload
-   fifo command. Any changes in usr_preferences_types table must thus be
-   followed by avp_list_reload command in order to reflect them in module
-   behavior.
-
-1.2. Dependencies
+     _________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+        2. Dependencies
+        3. Parameters
+
+              3.1. db_url (string)
+              3.2. user_attrs_table (string)
+              3.3. uri_attrs_table (string)
+              3.4. uid_column (string)
+              3.5. username_column (string)
+              3.6. did_column (string)
+              3.7. name (string)
+              3.8. value_column (string)
+              3.9. type_column (string)
+              3.10. flags_column (string)
+              3.11. scheme_column (string)
+              3.12. attr_group (string)
+              3.13. auto_unlock_extra_attrs (string)
+
+        4. Functions
+
+              4.1. load_attrs (track, id)
+              4.2. load_extra_attrs (group_id, id)
+              4.3. save_extra_attrs (group_id, id)
+              4.4. remove_extra_attrs (group_id, id)
+              4.5. lock_extra_attrs (group_id, id)
+              4.6. unlock_extra_attrs (group_id, id)
+
+        5. Example extra attributes usage
+
+   List of Examples
+
+   1.1. attribute group definition
+
+Chapter 1. Admin Guide
+
+   Table of Contents
+
+   1. Overview
+   2. Dependencies
+   3. Parameters
+
+        3.1. db_url (string)
+        3.2. user_attrs_table (string)
+        3.3. uri_attrs_table (string)
+        3.4. uid_column (string)
+        3.5. username_column (string)
+        3.6. did_column (string)
+        3.7. name (string)
+        3.8. value_column (string)
+        3.9. type_column (string)
+        3.10. flags_column (string)
+        3.11. scheme_column (string)
+        3.12. attr_group (string)
+        3.13. auto_unlock_extra_attrs (string)
+
+   4. Functions
+
+        4.1. load_attrs (track, id)
+        4.2. load_extra_attrs (group_id, id)
+        4.3. save_extra_attrs (group_id, id)
+        4.4. remove_extra_attrs (group_id, id)
+        4.5. lock_extra_attrs (group_id, id)
+        4.6. unlock_extra_attrs (group_id, id)
+
+   5. Example extra attributes usage
+
+1. Overview
+
+   This  module contains several functions that can be used to manipulate
+   the  contents  of AVPs (Attribute-Value pairs). The AVPs are variables
+   attached  to  the  SIP  message being processed. Each variable has its
+   name and value. AVPs can be used to store arbitrary data or as a means
+   of inter-module comminication.
+
+   You  may  also  want to check the avpops module which is more flexible
+   and  contains  more  functions.  In future SER releases the avp module
+   will be probably deprecated in favor of avpops module.
+
+   Domain  module  operates  in  caching  mode.  Domain  module reads the
+   default  values  of  AVPs into cache memory when the module is loaded.
+   After  that  default  values  is  re-read  only  when  module is given
+   avp_list_reload  fifo  command.  Any  changes in usr_preferences_types
+   table  must  thus  be  followed by avp_list_reload command in order to
+   reflect them in module behavior.
+
+2. Dependencies
 
    A database module, such as mysql, postgres, or dbtext.
 
-1.3. Parameters
+3. Parameters
+
+   3.1. db_url (string)
+   3.2. user_attrs_table (string)
+   3.3. uri_attrs_table (string)
+   3.4. uid_column (string)
+   3.5. username_column (string)
+   3.6. did_column (string)
+   3.7. name (string)
+   3.8. value_column (string)
+   3.9. type_column (string)
+   3.10. flags_column (string)
+   3.11. scheme_column (string)
+   3.12. attr_group (string)
+   3.13. auto_unlock_extra_attrs (string)
 
-1.3.1. db_url (string)
+3.1. db_url (string)
 
    The URL of the database to be used.
 
    Default value is "mysql://ser:heslo@localhost/ser".
 
-1.3.2. user_attrs_table (string)
+3.2. user_attrs_table (string)
 
    Name of the table with user attributes.
 
    Default value is "user_attrs".
 
-1.3.3. uri_attrs_table (string)
+3.3. uri_attrs_table (string)
 
    Name of the table with uri attributes.
 
    Default value is "uri_attrs".
 
-1.3.4. uid_column (string)
+3.4. uid_column (string)
 
    Name of the column that stores UID in the user attributes table.
 
    Default value is "uid".
 
-1.3.5. username_column (string)
+3.5. username_column (string)
 
-   Name of the column containing the username of the subscriber in uri
+   Name  of  the  column containing the username of the subscriber in uri
    attributes table.
 
    Default value is "username".
 
-1.3.6. did_column (string)
+3.6. did_column (string)
 
    Name of the column in uri attributes table containing the ID of domain
    that the subscriber belongs to.
 
    Default value is "did".
 
-1.3.7. name (string)
+3.7. name (string)
 
    The name of the column containing attribute names.
 
    Default value is "name".
 
-1.3.8. value_column (string)
+3.8. value_column (string)
 
    The name of the column containing attribute values.
 
    Default value is "value".
 
-1.3.9. type_column (string)
+3.9. type_column (string)
 
    The name of the column containing attribute value type.
 
    Default value is "type".
 
-1.3.10. flags_column (string)
+3.10. flags_column (string)
 
    The name of the column containing attribute flags.
 
    Default value is "flags".
 
-1.3.11. scheme_column (string)
+3.11. scheme_column (string)
 
-   The name of the column containing subscriber's scheme in uri
+   The   name  of  the  column  containing  subscriber's  scheme  in  uri
    attributes.
 
    Default value is "scheme".
 
-1.3.12. attr_group (string)
+3.12. attr_group (string)
 
-   'Extra attribute' group definition. It can be repeated to define more
+   'Extra  attribute' group definition. It can be repeated to define more
    attribute groups.
 
-   The group definition contains one or more assignments in the form
+   The  group  definition  contains  one  or more assignments in the form
    key=value. Possible keys are:
 
    id
           Attribute group identifier. Must be set.
 
    table
-          Table name used for storing attributes from this attribute
+          Table  name  used  for  storing  attributes from this attribute
           group. Must be set.
 
    flag
@@ -154,26 +210,26 @@ Jiri Kuthan
           Column name holding key. Default value is "id".
 
    name_column
-          Column name used for storing attribute name. Default value is
+          Column  name  used for storing attribute name. Default value is
           "name".
 
    value_column
-          Column name used for storing attribute value. Default value is
+          Column  name used for storing attribute value. Default value is
           "value".
 
    type_column
-          Column name used for storing attribute type. Default value is
+          Column  name  used for storing attribute type. Default value is
           "type".
 
    flags_column
-          Column name used for storing attribute flags. Default value is
+          Column  name used for storing attribute flags. Default value is
           "flags".
 
    None defined by default.
 
-   Example 1. attribute group definition
-modparam("avp_db", "attr_group", "id=dlg,flag=dialog_flag,table=dlg_attrs,key_co
-lumn=dlg_id");
+   Example 1.1. attribute group definition
+modparam("avp_db", "attr_group", "id=dlg,flag=dialog_flag,table=dlg_attrs,key_c
+olumn=dlg_id");
 
    Table used for these attributes:
 mysql> describe dlg_attrs;
@@ -197,104 +253,111 @@ route {
         ...
 }
 
-1.3.13. auto_unlock_extra_attrs (string)
+3.13. auto_unlock_extra_attrs (string)
 
-   Determines the action when any of the 'extra attributes' lock is
+   Determines  the  action  when  any  of  the 'extra attributes' lock is
    detected when routing script execution was finished. When the value of
-   this parameter is zero (default) BUG level message is logged, but the
-   lock is kept, so another process trying to obtain the lock might get
+   this  parameter is zero (default) BUG level message is logged, but the
+   lock  is  kept, so another process trying to obtain the lock might get
    stuck. If the value is nonzero, DEBUG level message is sent to the log
    and all the locks are released.
 
    Default value is 0.
 
-1.4. Functions
+4. Functions
+
+   4.1. load_attrs (track, id)
+   4.2. load_extra_attrs (group_id, id)
+   4.3. save_extra_attrs (group_id, id)
+   4.4. remove_extra_attrs (group_id, id)
+   4.5. lock_extra_attrs (group_id, id)
+   4.6. unlock_extra_attrs (group_id, id)
 
-1.4.1. load_attrs (track, id)
+4.1. load_attrs (track, id)
 
    Loads attributes from the database.
 
    track
 
         $fu
-                Load user attributes into from track. In this case the
+                Load  user  attributes  into from track. In this case the
                 second parameter is UID used to search attributes.
 
         $tu
-                Load user attributes into to track. In this case the
+                Load  user  attributes  into  to  track. In this case the
                 second parameter is UID used to search attributes.
 
         $fr
-                Load uri attributes into from track. In this case the
+                Load  uri  attributes  into  from track. In this case the
                 second parameter is URI used to search attributes.
 
         $tr
-                Load uri attributes into to track. In this case the second
-                parameter is URI used to search attributes.
+                Load  uri  attributes  into  to  track.  In this case the
+                second parameter is URI used to search attributes.
 
    id
-          Identifier used for searching attributes. When searching for
-          user attributes it is UID, when searchnig uri attributes it is
+          Identifier  used  for  searching attributes. When searching for
+          user  attributes it is UID, when searchnig uri attributes it is
           URI.
 
-1.4.2. load_extra_attrs (group_id, id)
+4.2. load_extra_attrs (group_id, id)
 
    Loads 'extra attributes' stored by previous call to save_extra_attrs.
 
    group_id
-          Identifies attribute group, see Section 1.3.12, "attr_group
+          Identifies   attribute  group,  see  Section 3.12,  "attr_group
           (string)".
 
    id
           Identifies attributes which should be loaded.
 
-1.4.3. save_extra_attrs (group_id, id)
+4.3. save_extra_attrs (group_id, id)
 
    Saves 'extra attributes' flagged by group flag under given id.
 
    group_id
-          Identifies attribute group, see Section 1.3.12, "attr_group
+          Identifies   attribute  group,  see  Section 3.12,  "attr_group
           (string)".
 
    id
           Identifier stored with flagged attributes.
 
-1.4.4. remove_extra_attrs (group_id, id)
+4.4. remove_extra_attrs (group_id, id)
 
    Removes all extra attributes with given id.
 
    group_id
-          Identifies attribute group, see Section 1.3.12, "attr_group
+          Identifies   attribute  group,  see  Section 3.12,  "attr_group
           (string)".
 
    id
           Identifies attributes which should be removed.
 
-1.4.5. lock_extra_attrs (group_id, id)
+4.5. lock_extra_attrs (group_id, id)
 
-   Locks extra attributes. Currently locks whole attribute group (not only
-   id).
+   Locks  extra  attributes.  Currently  locks whole attribute group (not
+   only id).
 
    group_id
-          Identifies attribute group, see Section 1.3.12, "attr_group
+          Identifies   attribute  group,  see  Section 3.12,  "attr_group
           (string)".
 
    id
           Identifies attributes which should be locked.
 
-1.4.6. unlock_extra_attrs (group_id, id)
+4.6. unlock_extra_attrs (group_id, id)
 
    Unlocks extra attributes. Currently unlocks whole attribute group (not
    only id).
 
    group_id
-          Identifies attribute group, see Section 1.3.12, "attr_group
+          Identifies   attribute  group,  see  Section 3.12,  "attr_group
           (string)".
 
    id
           Identifies attributes which should be unlocked.
 
-1.5. Example extra attributes usage
+5. Example extra attributes usage
 
 debug=3
 memdbg=5
@@ -332,8 +395,8 @@ loadmodule "/home/kubartv/SER/lib/ser/modules/gflags.so"
 modparam("usrloc", "db_mode", 1);
 modparam("usrloc|avp_db", "db_url", "mysql://ser:[email protected]/ser")
 
-modparam("avp_db", "attr_group", "id=dlg,flag=dialog_flag,table=dlg_attrs,key_co
-lumn=dlg_id");
+modparam("avp_db", "attr_group", "id=dlg,flag=dialog_flag,table=dlg_attrs,key_c
+olumn=dlg_id");
 
 modparam("gflags", "load_global_attrs", 1);
 
@@ -353,7 +416,7 @@ route["create_dialog"] {
 
 onreply_route["dialog_creation_reply"] {
         xplog("L_ERR", "dialog creation reply (%rs, %@cseq.method) [%@from.tag,
-%@to.tag]\n");
+ %@to.tag]\n");
 
         $res = @msg.response.code;
         xplog("L_ERR", " ... response: %$res\n");
@@ -362,15 +425,15 @@ onreply_route["dialog_creation_reply"] {
                 break;
         }
         if ($res < 101) {
-                xplog("L_ERR", " ... I won't create dialog from 100 response.\n"
-);
+                xplog("L_ERR", " ... I won't create dialog from 100 response.\n
+");
                 break;
         }
 
-        del_attr("$id"); # xlset_attr works strange when the attribute already e
-xists
-        xlset_attr("$id", "call-id:%@call_id caller_tag:%@from.tag callee_tag:%@
-to.tag");
+        del_attr("$id"); # xlset_attr works strange when the attribute already
+exists
+        xlset_attr("$id", "call-id:%@call_id caller_tag:%@from.tag callee_tag:%
+@to.tag");
         if ($res > 299) {
                 xplog("L_ERR", " ... dialog terminated\n");
                 remove_extra_attrs("dlg", "$id");
@@ -409,8 +472,8 @@ route["save_dialog"] {
                 # use this if you want to delete destroyed dialogs:
                 # remove_extra_attrs("dlg", "$id");
 
-                # else if you want leave them in DB (with the time of terminatio
-n)
+                # else if you want leave them in DB (with the time of terminati
+on)
                 $dlg_destroyed_at = @sys.now.local;
 
                 # set flag for attributes with name beggining with dlg_
@@ -431,8 +494,8 @@ route["load_dialog_data"] {
 
         del_attr("$dlg_init_method"); # used as flag of succesful read of data
 
-        # delete all used dlg attrs (because load_extra_attrs doesn't delete the
-m itself before adding)
+        # delete all used dlg attrs (because load_extra_attrs doesn't delete th
+em itself before adding)
         del_attr("$dlg_init_method");
         del_attr("$dlg_caller");
         del_attr("$dlg_callee");
@@ -453,20 +516,20 @@ route["load_dialog"] {
         # tries to load dialog according tags and callid
 
         # try to load dialog
-        del_attr("$id"); # xlset_attr works strange when the attribute already e
-xists
-        xlset_attr("$id", "call-id:%@call_id caller_tag:%@from.tag callee_tag:%@
-to.tag");
+        del_attr("$id"); # xlset_attr works strange when the attribute already
+exists
+        xlset_attr("$id", "call-id:%@call_id caller_tag:%@from.tag callee_tag:%
+@to.tag");
         if (route("load_dialog_data")) {
                 $dir = "caller2callee";
                 return 1;
         }
 
         # try to load dialog in other direction
-        del_attr("$id"); # xlset_attr works strange when the attribute already e
-xists
-        xlset_attr("$id", "call-id:%@call_id caller_tag:%@to.tag callee_tag:%@fr
-om.tag");
+        del_attr("$id"); # xlset_attr works strange when the attribute already
+exists
+        xlset_attr("$id", "call-id:%@call_id caller_tag:%@to.tag callee_tag:%@f
+rom.tag");
         if (route("load_dialog_data")) {
                 $dir = "callee2caller";
                 return 1;
@@ -482,8 +545,8 @@ route["update_dialog_reply"] {
                 # target refresh for INVITE dialogs
 
                 if ($dir == "caller2calle") { # if request from caller
-                        $dlg_callee = @contact; # update callee's contact (respo
-nse!)
+                        $dlg_callee = @contact; # update callee's contact (resp
+onse!)
                 }
                 else {
                         $dlg_caller = @contact;
@@ -499,8 +562,8 @@ route["update_dialog"] {
                 # target refresh for INVITE dialogs
 
                 if ($dir == "caller2calle") { # if request from caller
-                        $dlg_caller = @contact; # update caller's contact (reque
-st!)
+                        $dlg_caller = @contact; # update caller's contact (requ
+est!)
                 }
                 else {
                         $dlg_callee = @contact;
@@ -508,19 +571,19 @@ st!)
         }
 
         if ($dir == "caller2callee") { # if request from caller
-                # TODO: verify CSeq before modifying and return 500 if lower tha
-n last one
+                # TODO: verify CSeq before modifying and return 500 if lower th
+an last one
                 $dlg_caller_cseq = @cseq.num;
         }
         else {
-                # TODO: verify CSeq before modifying and return 500 if lower tha
-n last one
+                # TODO: verify CSeq before modifying and return 500 if lower th
+an last one
                 $dlg_callee_cseq = @cseq.num;
         }
 
         if (method=="BYE") {
-                $dlg_status = "pre-destroyed"; # to see that BYE already went th
-rough
+                $dlg_status = "pre-destroyed"; # to see that BYE already went t
+hrough
         }
         return 1;
 }
@@ -540,7 +603,7 @@ route["trace_dialog"] {
 onreply_route["dialog_reply"] {
         if ($id) {
                 xplog("L_ERR", "In-dialog reply (%rs, %@cseq.method) [%@to.tag,
-%@from.tag]\n");
+ %@from.tag]\n");
                 if (!route("load_dialog")) {
                         xplog("L_ERR", "Can't load dialog data\n");
                 }
@@ -599,7 +662,8 @@ route {
                 # initial request or non-dialog message
                 if (method=="INVITE") {
                         route("create_dialog");
-                        # we don't save the dialog here because AVPs will be set
+                        # we don't save the dialog here because AVPs will be se
+t
                         # when reply comes and the dialog will be stored then
                 }
                 else {
@@ -615,8 +679,8 @@ route {
                         t_on_reply("dialog_reply");
                 }
                 else {
-                        xplog("L_ERR", "Message within unknown dialog: %@cseq, t
-o_tag=%@to.tag from_tag=%@from.tag\n");
+                        xplog("L_ERR", "Message within unknown dialog: %@cseq,
+to_tag=%@to.tag from_tag=%@from.tag\n");
                 }
         }
 

+ 377 - 284
modules/uid_domain/README

@@ -1,95 +1,166 @@
-1. UID Domain Module
+
+UID Domain Module
 
 Juha Heinanen
 
    <[email protected]>
 
    Copyright © 2002-2010 Juha Heinanen
-     __________________________________________________________________
-
-   1.1. Overview
-
-        1.1.1. Virtual Domains
-        1.1.2. Domain-level Configuration Attributes
-        1.1.3. Caching
-
-   1.2. Dependencies
-   1.3. Known Limitations
-   1.4. Parameters
-
-        1.4.1. db_url (string)
-        1.4.2. db_mode (integer)
-        1.4.3. domain_table (string)
-        1.4.4. did_col (string)
-        1.4.5. domain_col (string)
-        1.4.6. flags_col (string)
-        1.4.7. domattr_table (string)
-        1.4.8. domattr_did (string)
-        1.4.9. domattr_name (string)
-        1.4.10. domattr_type (string)
-        1.4.11. domattr_value (string)
-        1.4.12. domattr_flags (string)
-        1.4.13. load_domain_attrs (integer)
-
-   1.5. Functions
-
-        1.5.1. is_local(domain)
-        1.5.2. lookup_domain(attr_group, domain)
+     _________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
 
-   1.6. FIFO Interface
+        1. Overview
+
+              1.1. Virtual Domains
+              1.2. Domain-level Configuration Attributes
+              1.3. Caching
+
+        2. Dependencies
+        3. Known Limitations
+        4. Parameters
+
+              4.1. db_url (string)
+              4.2. db_mode (integer)
+              4.3. domain_table (string)
+              4.4. did_col (string)
+              4.5. domain_col (string)
+              4.6. flags_col (string)
+              4.7. domattr_table (string)
+              4.8. domattr_did (string)
+              4.9. domattr_name (string)
+              4.10. domattr_type (string)
+              4.11. domattr_value (string)
+              4.12. domattr_flags (string)
+              4.13. load_domain_attrs (integer)
+
+        5. Functions
+
+              5.1. is_local(domain)
+              5.2. lookup_domain(attr_group, domain)
+
+        6. FIFO Interface
+
+              6.1. domain.reload
+              6.2. domain.dump
+
+        7. Internal API
+
+   List of Examples
+
+   1.1. Virtual Domain iptel.org
+   1.2. Database Representation of Virtual Domain
+   1.3. Table domain_attrs
+   1.4. Setting db_url parameter
+   1.5. Setting db_mode parameter
+   1.6. Setting domain_table parameter
+   1.7. Setting did_col parameter
+   1.8. Setting domain_col parameter
+   1.9. Setting flags_col parameter
+   1.10. Setting domattrs_table parameter
+   1.11. Setting domattrs_did parameter
+   1.12. Setting domattrs_name parameter
+   1.13. Setting domattrs_type parameter
+   1.14. Setting domattrs_value parameter
+   1.15. Setting domattrs_flags parameter
+   1.16. Setting load_domain_attrs parameter
+   1.17. is_uri_host_local_local usage
+   1.18. lookup_domain usage
+   1.19. Calling load_domain_api
+
+Chapter 1. Admin Guide
+
+   Table of Contents
+
+   1. Overview
+
+        1.1. Virtual Domains
+        1.2. Domain-level Configuration Attributes
+        1.3. Caching
+
+   2. Dependencies
+   3. Known Limitations
+   4. Parameters
+
+        4.1. db_url (string)
+        4.2. db_mode (integer)
+        4.3. domain_table (string)
+        4.4. did_col (string)
+        4.5. domain_col (string)
+        4.6. flags_col (string)
+        4.7. domattr_table (string)
+        4.8. domattr_did (string)
+        4.9. domattr_name (string)
+        4.10. domattr_type (string)
+        4.11. domattr_value (string)
+        4.12. domattr_flags (string)
+        4.13. load_domain_attrs (integer)
+
+   5. Functions
+
+        5.1. is_local(domain)
+        5.2. lookup_domain(attr_group, domain)
+
+   6. FIFO Interface
+
+        6.1. domain.reload
+        6.2. domain.dump
 
-        1.6.1. domain.reload
-        1.6.2. domain.dump
-
-   1.7. Internal API
-
-1.1. Overview
-
-   Domain modules, as the name suggests, implements support for multiple
-   independent virtual domains hosted on one SIP server. This is often
+   7. Internal API
+
+1. Overview
+
+   1.1. Virtual Domains
+   1.2. Domain-level Configuration Attributes
+   1.3. Caching
+
+   Domain  modules, as the name suggests, implements support for multiple
+   independent  virtual  domains  hosted on one SIP server. This is often
    useful if you have multiple domain names and you want to make them all
    work and appear as one. Alternatively you might find the module useful
-   if you want to run a shared SIP service for multiple independent
-   customers. The module stores all supported domains and associated
-   configuration in a database table. Most of the information can be
+   if  you  want  to  run  a  shared SIP service for multiple independent
+   customers.  The  module  stores  all  supported domains and associated
+   configuration  in  a  database  table.  Most of the information can be
    cached in memory for performance reasons.
 
-1.1.1. Virtual Domains
+1.1. Virtual Domains
 
-   The domain module adds support for so-called virtual domains. A virtual
-   domain is just a collection of domain names and associated
-   configuration information identified by a unique identifier. We refer
-   to the domain identifier as DID elsewhere in the documentation. DID
+   The  domain  module  adds  support  for  so-called  virtual domains. A
+   virtual  domain  is  just  a collection of domain names and associated
+   configuration  information identified by a unique identifier. We refer
+   to  the  domain  identifier as DID elsewhere in the documentation. DID
    stands for "Domain IDentifier". In traditional POST world the term DID
    has a different meaning though. Please be aware that this is just pure
    coincidence.
 
-   All domain names that belong to one virtual domain are interchangeable.
-   From SIP server's perspective there is no difference between them. They
-   can be used in SIP URIs interchangeably and the behavior of the SIP
-   server will not be affected. This is called "domain name normalization"
-   and it is one of the steps performed early during SIP message
-   processing.
+   All   domain   names   that   belong   to   one   virtual  domain  are
+   interchangeable.  From SIP server's perspective there is no difference
+   between  them.  They  can  be used in SIP URIs interchangeably and the
+   behavior  of  the  SIP  server  will  not  be affected. This is called
+   "domain name normalization" and it is one of the steps performed early
+   during SIP message processing.
 
-   The DID identifier can be anything. To the SIP server DIDs are just
+   The  DID  identifier  can be anything. To the SIP server DIDs are just
    opaque strings and what format you choose depends on your requirements
-   and the type of the setup. You can use numbers in smaller setups if the
-   size of the data is a concern. You can set the DID to the canonical
-   domain name of the domain. You can use RFC 4122 style UUIDs if your
-   setup is large and distributed. You can use anything as long as it can
-   be represented as string. The only requirement is that the identifier
-   of each virtual domain must be unique.
-
-   The following example illustrates how one virtual domain can be
+   and  the  type  of the setup. You can use numbers in smaller setups if
+   the  size  of  the  data  is  a  concern.  You  can set the DID to the
+   canonical  domain name of the domain. You can use RFC 4122 style UUIDs
+   if  your  setup is large and distributed. You can use anything as long
+   as  it  can be represented as string. The only requirement is that the
+   identifier of each virtual domain must be unique.
+
+   The  following  example  illustrates  how  one  virtual  domain can be
    represented. The iptel.org domain runs a public SIP service. The users
-   of the service can use SIP URIs of form sip:[email protected]. The SIP
-   service is distributed, there is a number of SIP servers. The SIP
-   servers are also available through a number of other domain names, such
-   as sip.iptel.org, proxy.iptel.org and so on. We created one virtual
-   domain in the domain module and added all such domain names to the
-   virtual domain:
-
-   Example 1. Virtual Domain iptel.org
+   of  the  service  can use SIP URIs of form sip:[email protected]. The
+   SIP  service is distributed, there is a number of SIP servers. The SIP
+   servers  are  also  available  through a number of other domain names,
+   such  as  sip.iptel.org,  proxy.iptel.org  and  so  on. We created one
+   virtual domain in the domain module and added all such domain names to
+   the virtual domain:
+
+   Example 1.1. Virtual Domain iptel.org
 iptel
   |
   +---iptel.org
@@ -97,20 +168,20 @@ iptel
   +---proxy.iptel.org
   +---213.192.59.75
 
-   In the example above, we chose "iptel" as the unique identifier for the
-   virtual domain. This identifier is permanent. It never changes. Over
-   time we may change domain names assigned to this virtual domain, but
-   this identifier never changes. The main reason why virtual domain
+   In  the  example  above, we chose "iptel" as the unique identifier for
+   the  virtual  domain.  This identifier is permanent. It never changes.
+   Over  time we may change domain names assigned to this virtual domain,
+   but  this identifier never changes. The main reason why virtual domain
    identifiers must never change is that because they are referenced from
-   other tables, for example the accounting table. The data in the
-   accounting table is long-lived, usually archived, and this ensures that
-   the data will still reference correct virtual domain, no matter what
-   domain names are assigned to it.
+   other  tables,  for  example  the  accounting  table.  The data in the
+   accounting  table  is  long-lived,  usually archived, and this ensures
+   that  the  data will still reference correct virtual domain, no matter
+   what domain names are assigned to it.
 
-   The virtual domain described above will be stored in the domain table
+   The  virtual domain described above will be stored in the domain table
    in the database:
 
-   Example 2. Database Representation of Virtual Domain
+   Example 1.2. Database Representation of Virtual Domain
 +-------+-----------------+-------+
 | did   | domain          | flags |
 +-------+-----------------+-------+
@@ -120,44 +191,44 @@ iptel
 | iptel | 213.192.59.75   |    33 |
 +-------+-----------------+-------+
 
-   Because all domain names that belong to one particular virtual domain
-   are equal, it does not matter which domain name is used in the host
-   part of the SIP URI. Thus an imaginary user joe with SIP URI
-   sip:[email protected] will also be reachable as sip:[email protected],
-   sip:[email protected], and sip:[email protected]. If we add a new
-   domain name to this virtual domain then joe will also be able to use
-   the new domain name in his SIP URI, without the need to change
+   Because  all domain names that belong to one particular virtual domain
+   are  equal,  it  does not matter which domain name is used in the host
+   part  of  the  SIP  URI.  Thus  an  imaginary  user  joe  with SIP URI
+   sip:[email protected]  will  also  be  reachable as sip:[email protected],
+   sip:[email protected],  and  sip:[email protected].  If we add a new
+   domain  name  to this virtual domain then joe will also be able to use
+   the  new  domain  name  in  his  SIP  URI,  without the need to change
    anything.
 
-1.1.2. Domain-level Configuration Attributes
+1.2. Domain-level Configuration Attributes
 
-   In addition to a number of domain names, each virtual domain can also
-   have extra configuration information associated with it. The
-   possibility to configure the SIP server sightly differently in each
-   virtual domain is, in fact, the main reason why we introduced the
-   concept of virtual domains. We wanted to have one SIP server which will
-   provide SIP service to multiple different customers and each of the
-   customers may have slightly different configuration requirements.
+   In  addition to a number of domain names, each virtual domain can also
+   have   extra   configuration   information  associated  with  it.  The
+   possibility  to  configure  the SIP server sightly differently in each
+   virtual  domain  is,  in  fact,  the main reason why we introduced the
+   concept  of  virtual  domains.  We wanted to have one SIP server which
+   will  provide  SIP service to multiple different customers and each of
+   the  customers may have slightly different configuration requirements.
    That's how domain-level configuration attributes were born.
 
    Because the administrator of the SIP server seldom knows configuration
-   requirements in advance, we decided to implement a generic solution and
-   store all configuration options in named attributes. Named attributes
-   are just like variables, they have a name and they have a value.
-   Attributes are accessible from the configuration script of the SIP
-   server. Domain-level attributes are attributes that are associated with
-   a particular virtual domain. They can be used to store additional
-   configuration for the entire virtual domain, that is all users that
-   belong (or have SIP URI) in that particular virtual domain.
-   Domain-level attributes can be overridden be user-level attributes with
-   the same name configured for a particular user. In other words a domain
-   level attribute will only be effective if no user-level attribute with
-   the same name exists.
-
-   Domain-level attributes are stored in a separate table. The name of the
-   table is domain_attrs and it is defined as follows:
-
-   Example 3. Table domain_attrs
+   requirements  in  advance,  we decided to implement a generic solution
+   and  store  all  configuration  options  in  named  attributes.  Named
+   attributes  are  just like variables, they have a name and they have a
+   value.  Attributes are accessible from the configuration script of the
+   SIP server. Domain-level attributes are attributes that are associated
+   with a particular virtual domain. They can be used to store additional
+   configuration  for  the  entire virtual domain, that is all users that
+   belong   (or   have  SIP  URI)  in  that  particular  virtual  domain.
+   Domain-level  attributes  can  be  overridden be user-level attributes
+   with  the same name configured for a particular user. In other words a
+   domain  level  attribute  will  only  be  effective  if  no user-level
+   attribute with the same name exists.
+
+   Domain-level  attributes  are  stored in a separate table. The name of
+   the table is domain_attrs and it is defined as follows:
+
+   Example 1.3. Table domain_attrs
 +-------+------------------+------+-----+---------+-------+
 | Field | Type             | Null | Key | Default | Extra |
 +-------+------------------+------+-----+---------+-------+
@@ -168,287 +239,306 @@ iptel
 | flags | int(10) unsigned | NO   |     | 0       |       |
 +-------+------------------+------+-----+---------+-------+
 
-   Each attribute has name, type and value. A single attribute can have
-   multiple values and in that case it will occupy more rows in the table.
-   Each attribute is associated with a particular virtual domain using the
-   DID identifier. Domain-level attributes can contain just about
-   anything. It is a generic configuration mechanism and it is up to you
-   to define a list of attribute that are meaningful in your setup and use
-   those attributes in the routing part of the configuration file.
-
-   Attributes for a particular virtual-domain are made available to script
-   function by the lookup_domain function. This is the function that is
-   used to map domain names to DIDs. One of the side-effects of the
-   function is that it makes domain-level attributes available to script
-   function if a matching virtual domain is found.
-
-   When caching is enabled, all attributes from domain_attrs table are
-   cached in memory, just like virtual domain themselves. If you disable
-   caching then the domain module will attempt to load attributes from the
-   database each time you call lookup_domain. Attributes cached in memory
-   can be realoaded with the domain.reload management function.
-
-1.1.3. Caching
-
-   Domain module operates in caching or non-caching mode depending on
+   Each  attribute  has name, type and value. A single attribute can have
+   multiple  values  and  in  that  case  it will occupy more rows in the
+   table.  Each  attribute is associated with a particular virtual domain
+   using  the  DID  identifier.  Domain-level attributes can contain just
+   about  anything.  It is a generic configuration mechanism and it is up
+   to you to define a list of attribute that are meaningful in your setup
+   and  use  those  attributes  in  the routing part of the configuration
+   file.
+
+   Attributes  for  a  particular  virtual-domain  are  made available to
+   script  function  by  the lookup_domain function. This is the function
+   that  is  used to map domain names to DIDs. One of the side-effects of
+   the  function  is  that  it makes domain-level attributes available to
+   script function if a matching virtual domain is found.
+
+   When  caching  is  enabled, all attributes from domain_attrs table are
+   cached  in memory, just like virtual domain themselves. If you disable
+   caching  then  the  domain module will attempt to load attributes from
+   the  database  each  time you call lookup_domain. Attributes cached in
+   memory can be realoaded with the domain.reload management function.
+
+1.3. Caching
+
+   Domain  module  operates  in  caching or non-caching mode depending on
    value of module parameter db_mode. In caching mode domain module reads
-   the contents of domain table into cache memory when the module is
-   loaded. After that domain table is re-read only when module is given
-   domain_reload fifo command. Any changes in domain table must thus be
-   followed by domain_reload command in order to reflect them in module
-   behavior. In non-caching mode domain module always queries domain table
-   in the database.
-
-   Caching is implemented using a hash table. The size of the hash table
-   is given by HASH_SIZE constant defined in domain_mod.h. Its "factory
-   default" value is 128. Caching mode is highly recommended if you want
+   the  contents  of  domain  table  into cache memory when the module is
+   loaded.  After  that domain table is re-read only when module is given
+   domain_reload  fifo  command. Any changes in domain table must thus be
+   followed  by  domain_reload command in order to reflect them in module
+   behavior.  In  non-caching  mode  domain  module always queries domain
+   table in the database.
+
+   Caching  is implemented using a hash table. The size of the hash table
+   is  given  by HASH_SIZE constant defined in domain_mod.h. Its "factory
+   default"  value is 128. Caching mode is highly recommended if you want
    to use domain-level attributes.
 
-1.2. Dependencies
+2. Dependencies
 
-   The module depends on the following modules (in the other words the
+   The  module  depends  on the following modules (in the other words the
    listed modules must be loaded before this module):
      * database - Any database module
 
-1.3. Known Limitations
+3. Known Limitations
 
-   There is an unlikely race condition on domain list update. If a process
-   uses a table, which is reloaded at the same time twice through FIFO,
-   the second reload will delete the original table still in use by the
-   process.
+   There  is  an  unlikely  race  condition  on  domain list update. If a
+   process uses a table, which is reloaded at the same time twice through
+   FIFO, the second reload will delete the original table still in use by
+   the process.
 
-1.4. Parameters
+4. Parameters
 
-1.4.1. db_url (string)
+   4.1. db_url (string)
+   4.2. db_mode (integer)
+   4.3. domain_table (string)
+   4.4. did_col (string)
+   4.5. domain_col (string)
+   4.6. flags_col (string)
+   4.7. domattr_table (string)
+   4.8. domattr_did (string)
+   4.9. domattr_name (string)
+   4.10. domattr_type (string)
+   4.11. domattr_value (string)
+   4.12. domattr_flags (string)
+   4.13. load_domain_attrs (integer)
+
+4.1. db_url (string)
 
    This is URL of the database to be used.
 
    Default value is "mysql://serro:47serro11@localhost/ser"
 
-   Example 4. Setting db_url parameter
+   Example 1.4. Setting db_url parameter
 modparam("domain", "db_url", "mysql://ser:pass@db_host/ser")
 
-1.4.2. db_mode (integer)
+4.2. db_mode (integer)
 
-   Database mode. Value 0 means non-caching, 1 means caching is enabled.
-   It is highly recommended to enable caching if you want to use
+   Database  mode. Value 0 means non-caching, 1 means caching is enabled.
+   It  is  highly  recommended  to  enable  caching  if  you  want to use
    domain-level attributes.
 
    Default value is 1 (caching).
 
-   Example 5. Setting db_mode parameter
+   Example 1.5. Setting db_mode parameter
 modparam("domain", "db_mode", 0)   # Do not use caching
 
-1.4.3. domain_table (string)
+4.3. domain_table (string)
 
-   Name of table containing names of local domains that the proxy is
-   responsible for. Local users must have in their SIP URI a host part
+   Name  of  table  containing  names  of local domains that the proxy is
+   responsible  for.  Local  users must have in their SIP URI a host part
    that is equal to one of the domains stored in this table.
 
    Default value is "domain".
 
-   Example 6. Setting domain_table parameter
+   Example 1.6. Setting domain_table parameter
 modparam("domain", "domain_table", "new_name")
 
-1.4.4. did_col (string)
+4.4. did_col (string)
 
-   This is the name of the column in domain table that contains the unique
-   identifiers of virtual domains. Domains names found in this table are
-   arranged into virtual domains. Each virtual domain must have a unique
-   identifier and it can contain one or more domain names.
+   This  is  the  name  of  the  column in domain table that contains the
+   unique  identifiers  of  virtual  domains. Domains names found in this
+   table are arranged into virtual domains. Each virtual domain must have
+   a unique identifier and it can contain one or more domain names.
 
    Default value is "did".
 
-   Example 7. Setting did_col parameter
+   Example 1.7. Setting did_col parameter
 modparam("domain", "did_col", "did")
 
-1.4.5. domain_col (string)
+4.5. domain_col (string)
 
    Name of column containing domain names in the domain table.
 
    Default value is "domain".
 
-   Example 8. Setting domain_col parameter
+   Example 1.8. Setting domain_col parameter
 modparam("domain", "domain_col", "domain")
 
-1.4.6. flags_col (string)
+4.6. flags_col (string)
 
-   This is the name of the column in domain table which stores various
-   flags. Each row in the table has a bunch of generic flags that can be
-   used mark the row disabled, deleted, etc. The flags allow for more
-   flexible administration of the data in the database and they are
+   This  is  the  name of the column in domain table which stores various
+   flags.  Each row in the table has a bunch of generic flags that can be
+   used  mark  the  row  disabled, deleted, etc. The flags allow for more
+   flexible  administration  of  the  data  in  the database and they are
    present in several other tables too.
 
    Default value is "flags".
 
-   Example 9. Setting flags_col parameter
+   Example 1.9. Setting flags_col parameter
 modparam("domain", "flags_col", "domain")
 
-1.4.7. domattr_table (string)
+4.7. domattr_table (string)
 
-   This parameter can be used to configure the name of the table that is
-   used to store domain-level attributes. Domain level attributes are
-   attributes that are associated with a particular virtual domain. They
-   are typically used to store additional domain-wide settings that should
-   apply to all users who belong to the domain.
+   This  parameter can be used to configure the name of the table that is
+   used  to  store  domain-level  attributes. Domain level attributes are
+   attributes  that are associated with a particular virtual domain. They
+   are  typically  used  to  store  additional  domain-wide settings that
+   should apply to all users who belong to the domain.
 
    Default value is "domain_attrs".
 
-   Example 10. Setting domattrs_table parameter
+   Example 1.10. Setting domattrs_table parameter
 modparam("domain", "domattr_table", "domain_attrs")
 
-1.4.8. domattr_did (string)
+4.8. domattr_did (string)
 
    Use this parameter to configure the name of the column in domain_attrs
-   table that is used to store the did of the virtual domain the attribute
-   belongs to. Normally there is no need to configure this parameter,
-   unless you want adapt to module to a different database schema.
+   table  that  is  used  to  store  the  did  of  the virtual domain the
+   attribute  belongs  to.  Normally  there  is no need to configure this
+   parameter,  unless  you  want  adapt to module to a different database
+   schema.
 
    Default value is "did".
 
-   Example 11. Setting domattrs_did parameter
+   Example 1.11. Setting domattrs_did parameter
 modparam("domain", "domattr_did", "did")
 
-1.4.9. domattr_name (string)
+4.9. domattr_name (string)
 
    Use this parameter to configure the name of the column in domain_attrs
-   table that is used to store the name of the attribute. Normally there
-   is no need to configure this parameter, unless you want adapt to module
-   to a different database schema.
+   table  that is used to store the name of the attribute. Normally there
+   is  no  need  to  configure  this  parameter, unless you want adapt to
+   module to a different database schema.
 
    Default value is "name".
 
-   Example 12. Setting domattrs_name parameter
+   Example 1.12. Setting domattrs_name parameter
 modparam("domain", "domattr_name", "name")
 
-1.4.10. domattr_type (string)
+4.10. domattr_type (string)
 
    Use this parameter to configure the name of the column in domain_attrs
-   table that is used to store the type of the attribute. Normally there
-   is no need to configure this parameter, unless you want adapt to module
-   to a different database schema.
+   table  that is used to store the type of the attribute. Normally there
+   is  no  need  to  configure  this  parameter, unless you want adapt to
+   module to a different database schema.
 
    Default value is "type".
 
-   Example 13. Setting domattrs_type parameter
+   Example 1.13. Setting domattrs_type parameter
 modparam("domain", "domattr_type", "type")
 
-1.4.11. domattr_value (string)
+4.11. domattr_value (string)
 
    Use this parameter to configure the name of the column in domain_attrs
    table that is used to store the value of the attribute. Normally there
-   is no need to configure this parameter, unless you want adapt to module
-   to a different database schema.
+   is  no  need  to  configure  this  parameter, unless you want adapt to
+   module to a different database schema.
 
    Default value is "value".
 
-   Example 14. Setting domattrs_value parameter
+   Example 1.14. Setting domattrs_value parameter
 modparam("domain", "domattr_value", "value")
 
-1.4.12. domattr_flags (string)
+4.12. domattr_flags (string)
 
-   This is the name of the column in domain_attrs table which stores
+   This  is  the  name  of  the column in domain_attrs table which stores
    various flags. Each row in the table has a bunch of generic flags that
-   can be used mark the row disabled, deleted, etc. The flags allow for
-   more flexible administration of the data in the database and they are
-   present in several other tables too. You do not have to touch this
+   can  be  used mark the row disabled, deleted, etc. The flags allow for
+   more  flexible administration of the data in the database and they are
+   present  in  several  other  tables too. You do not have to touch this
    parameter under normal circumstances.
 
    Default value is "flags".
 
-   Example 15. Setting domattrs_flags parameter
+   Example 1.15. Setting domattrs_flags parameter
 modparam("domain", "domattr_flags", "flags")
 
-1.4.13. load_domain_attrs (integer)
+4.13. load_domain_attrs (integer)
 
-   This parameter can be used to enable/disable user of domain-level
-   attributes. Domain-level attributes are variables that can be used to
-   store additional configuration that applies to the whole virtual domain
-   and all users within the virtual domain. Domain-level attributes are
-   stored in domain_attrs. If you set this parameter to a non-zero value
-   then the server will make domain-level attributes available to the
-   script every time you call function lookup_domain. If you set the
-   parameter to 0 then domain-level attributes will be ignored, the domain
-   module will not load them from the database and the lookup function
-   will not make them available to the script.
+   This  parameter  can  be  used  to enable/disable user of domain-level
+   attributes.  Domain-level attributes are variables that can be used to
+   store  additional  configuration  that  applies  to  the whole virtual
+   domain   and   all  users  within  the  virtual  domain.  Domain-level
+   attributes  are stored in domain_attrs. If you set this parameter to a
+   non-zero  value  then  the  server  will  make domain-level attributes
+   available to the script every time you call function lookup_domain. If
+   you  set  the  parameter  to  0  then  domain-level attributes will be
+   ignored,  the  domain  module will not load them from the database and
+   the lookup function will not make them available to the script.
 
    Default value is 0.
 
-   Example 16. Setting load_domain_attrs parameter
+   Example 1.16. Setting load_domain_attrs parameter
 modparam("domain", "load_domain_attrs", 1)
 
-1.5. Functions
+5. Functions
+
+   5.1. is_local(domain)
+   5.2. lookup_domain(attr_group, domain)
 
-1.5.1. is_local(domain)
+5.1. is_local(domain)
 
-   This function can be used to test whether a given domain name in
-   parameter belongs to one of the virtual domains defined in the domain
+   This  function  can  be  used  to  test whether a given domain name in
+   parameter  belongs to one of the virtual domains defined in the domain
    table. Such domain name is said to be local. The function returns 1 if
    the domain name is found in the domain table and -1 otherwise.
 
-   The first parameter of the function can be anything that returns a
-   string with domain name. In its simplest form it can be a string with
-   domain name: is_local("iptel.org"). You can also test a domain name
-   stored in an attribute: is_local("$my_domain"). And finally you can
-   test a domain name present in the SIP message with selects:
+   The  first  parameter  of  the function can be anything that returns a
+   string  with domain name. In its simplest form it can be a string with
+   domain  name:  is_local("iptel.org").  You can also test a domain name
+   stored  in  an  attribute: is_local("$my_domain"). And finally you can
+   test   a  domain  name  present  in  the  SIP  message  with  selects:
    is_local("@ruri.host").
 
-   Note: Unlike function lookup_domain, this function does not make domain
-   attributes of the virtual domain available to the script. Domain
-   attributes are simply ignored by this function.
+   Note:  Unlike  function  lookup_domain,  this  function  does not make
+   domain  attributes  of  the  virtual  domain  available to the script.
+   Domain attributes are simply ignored by this function.
 
-   Example 17. is_uri_host_local_local usage
+   Example 1.17. is_uri_host_local_local usage
 ...
 if (is_local("@ruri.host")) {
     /* Domain part of Request-URI is local */
 }
 ...
 
-1.5.2. lookup_domain(attr_group, domain)
+5.2. lookup_domain(attr_group, domain)
 
-   This is the main function of the domain module. It can be used to
-   implement support for virtual domains in the SIP server. Each virtual
+   This  is  the  main  function  of the domain module. It can be used to
+   implement  support for virtual domains in the SIP server. Each virtual
    domain is identified by a unique identifier (opaque string) and it can
-   have one or more associated domain names. Given a domain name in the
-   second parameter, this function finds the associated virtual domain
-   identifier (known as DID) and stores it in an attribute for later user.
-   In addition to that the function also loads all domain-level attributes
-   for the virtual domain and makes them available to the configuration
-   script.
+   have  one  or more associated domain names. Given a domain name in the
+   second  parameter,  this  function finds the associated virtual domain
+   identifier  (known  as  DID)  and  stores it in an attribute for later
+   user.  In  addition  to  that the function also loads all domain-level
+   attributes  for  the  virtual  domain  and makes them available to the
+   configuration script.
 
    The first parameter of the function identifies the group of attributes
-   where the DID and domain-level attributes shall be stored. The value of
-   the first parameter can be either "$fd" for the domain-level attribute
-   group that belongs to the calling party (From), or "$td" for the
-   domain-level attribute group that belongs to the called party
+   where  the  DID and domain-level attributes shall be stored. The value
+   of  the  first  parameter  can  be  either  "$fd" for the domain-level
+   attribute group that belongs to the calling party (From), or "$td" for
+   the  domain-level  attribute  group  that  belongs to the called party
    (Request-URI).
 
    The value of the second parameter can be a simple string, an attribute
    name, or a select. See the documentation of function is_local for more
    details.
 
-   If a match is found then the DID of the virtual domain will be stored
-   either in $fd.did or in $td.did, depending on the value of the first
-   parameter. In addition to that domain-level attributes, if any, will be
-   available as either $fd.<name> or $td.</name>.
+   If  a match is found then the DID of the virtual domain will be stored
+   either  in  $fd.did or in $td.did, depending on the value of the first
+   parameter.  In  addition to that domain-level attributes, if any, will
+   be available as either $fd.<name> or $td.</name>.
 
-   The function returns 1 when a matching virtual domain for the given
+   The  function  returns  1 when a matching virtual domain for the given
    domain name was found and -1 otherwise.
 
-   The following example shows a typical use of the function. In a multi
-   domain setup, one has to typically figure out where the both the
-   calling and the called domains are local (i.e. configured on the server
-   as the domains the server is responsible for). This is typically done
-   by calling function lookup_domain twice, once with the hostname part of
-   the From header as parameter and secondly with the hostname part of the
-   Request-URI as parameter.
-
-   The type of the situation can be then determined from the value of
-   corresponding attributes ($td.did and $fd.did). A non-existing
-   attribute value indicates that the domain name is not local (it does
+   The  following example shows a typical use of the function. In a multi
+   domain  setup,  one  has  to  typically  figure out where the both the
+   calling  and  the  called  domains  are  local (i.e. configured on the
+   server  as  the  domains  the  server  is  responsible  for).  This is
+   typically  done by calling function lookup_domain twice, once with the
+   hostname  part  of  the From header as parameter and secondly with the
+   hostname part of the Request-URI as parameter.
+
+   The  type  of  the  situation can be then determined from the value of
+   corresponding   attributes   ($td.did  and  $fd.did).  A  non-existing
+   attribute  value  indicates that the domain name is not local (it does
    not belong to any virtual domain configured in the domain table).
 
-   Example 18. lookup_domain usage
+   Example 1.18. lookup_domain usage
 lookup_domain("$fd", "@from.uri.host");
 lookup_domain("$td", "@ruri.host");
 
@@ -475,33 +565,36 @@ if ($fd.did && $td.did) {
     # virtual domain hosted on the same server
 }
 
-1.6. FIFO Interface
+6. FIFO Interface
+
+   6.1. domain.reload
+   6.2. domain.dump
 
-1.6.1. domain.reload
+6.1. domain.reload
 
-   Causes domain module to re-read the contents of domain table into cache
-   memory. If domain-level attributes are used then it will also re-load
-   the contents of the domain_attrs table in the memory cache.
+   Causes  domain  module  to  re-read  the contents of domain table into
+   cache  memory.  If  domain-level attributes are used then it will also
+   re-load the contents of the domain_attrs table in the memory cache.
 
-1.6.2. domain.dump
+6.2. domain.dump
 
-   Causes domain module to dump hash indexes and domain names in its cache
-   memory.
+   Causes  domain  module  to  dump  hash indexes and domain names in its
+   cache memory.
 
-1.7. Internal API
+7. Internal API
 
-   The domain module has an internal API which can be used to access
-   additional functions of the module (i.e. functions that are normally
+   The  domain  module  has  an  internal API which can be used to access
+   additional  functions  of the module (i.e. functions that are normally
    not available from the routing script). Currently the API exports only
-   the function is_domain_local. That function can be used to determine
-   whether a given domain name is on the list of locally configured domain
-   names.
+   the  function  is_domain_local. That function can be used to determine
+   whether  a  given  domain  name  is  on the list of locally configured
+   domain names.
 
-   If you want to use the internal API of domain module from your module
-   then you need to include the header file domain_api.h and call
+   If  you want to use the internal API of domain module from your module
+   then  you  need  to  include  the  header  file  domain_api.h and call
    load_domain_api first.
 
-   Example 19. Calling load_domain_api
+   Example 1.19. Calling load_domain_api
 #include "../domain/domain_api.h"
 
 domain_api_t dom_api;
@@ -510,7 +603,7 @@ if (load_domain_api(&dom_api) != 0) {
     /* error */
 }
 
-   After that you can call function is_domain_local whose pointer is
+   After  that  you  can  call  function is_domain_local whose pointer is
    stored in the initialized data structure:
 str tmp = STR_STATIC_INIT("mydomain.com");
 

+ 83 - 49
modules/uid_gflags/README

@@ -1,36 +1,64 @@
-1. UID Gflags Module
+
+UID Gflags Module
 
 Jiri Kuthan
 
    <[email protected]>
 
    Copyright © 2004 FhG FOKUS
-     __________________________________________________________________
+     _________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+        2. Parameters
+
+              2.1. initial (integer)
+
+        3. Functions
+
+              3.1. set_gflag(flag_num)
+              3.2. reset_ugflag(flag_num)
+              3.3. is_ugflag(flag_num)
+
+        4. FIFO Interface
+        5. XMLRPC Interface
 
-   1.1. Overview
-   1.2. Parameters
+   List of Examples
 
-        1.2.1. initial (integer)
+   1.1. set_ugflag usage
+   1.2. reset_ugflag usage
 
-   1.3. Functions
+Chapter 1. Admin Guide
 
-        1.3.1. set_gflag(flag_num)
-        1.3.2. reset_ugflag(flag_num)
-        1.3.3. is_ugflag(flag_num)
+   Table of Contents
 
-   1.4. FIFO Interface
-   1.5. XMLRPC Interface
+   1. Overview
+   2. Parameters
 
-1.1. Overview
+        2.1. initial (integer)
 
-   The module implements global flags. The difference between the global
-   flags and flags that can be used in the configuration file or AVPs is
-   that they the scope of the global flags is not limited to the SIP
-   message or transaction being processed. Global flags are always
+   3. Functions
+
+        3.1. set_gflag(flag_num)
+        3.2. reset_ugflag(flag_num)
+        3.3. is_ugflag(flag_num)
+
+   4. FIFO Interface
+   5. XMLRPC Interface
+
+1. Overview
+
+   The  module implements global flags. The difference between the global
+   flags  and flags that can be used in the configuration file or AVPs is
+   that  they  the  scope  of  the global flags is not limited to the SIP
+   message  or  transaction  being  processed.  Global  flags  are always
    available, their contents is not forgotten when a SIP transaction gets
    destroyed in SER.
 
-   Global flags can be accessed from the configuration script, for
+   Global  flags  can  be  accessed  from  the  configuration script, for
    example:
 if (is_ugflag("1")) {
     t_relay_to_udp("10.0.0.1", "5060");
@@ -38,76 +66,82 @@ if (is_ugflag("1")) {
     t_relay_to_udp("10.0.0.2", "5060");
 };
 
-   The value of the global flags can be manipulated by external tools such
-   as the web interface of SER or cmd line administration tools. One
-   particular application of global flags could be runtime configuration
+   The  value  of  the  global flags can be manipulated by external tools
+   such as the web interface of SER or cmd line administration tools. One
+   particular  application of global flags could be runtime configuration
    changes without the need to restart SER.
 
-1.2. Parameters
+2. Parameters
 
-1.2.1. initial (integer)
+   2.1. initial (integer)
 
-   The initial value of global flags. Each bit in the integer represents
+2.1. initial (integer)
+
+   The  initial value of global flags. Each bit in the integer represents
    one flag.
 
    Default value is 0.
 
-1.3. Functions
+3. Functions
+
+   3.1. set_gflag(flag_num)
+   3.2. reset_ugflag(flag_num)
+   3.3. is_ugflag(flag_num)
 
-1.3.1. set_gflag(flag_num)
+3.1. set_gflag(flag_num)
 
-   Set the flag identified by flag_num to 1. The range of flag_num is 0 to
-   31.
+   Set  the  flag identified by flag_num to 1. The range of flag_num is 0
+   to 31.
 
-   Example 1. set_ugflag usage
+   Example 1.1. set_ugflag usage
 ...
 set_ugflag("2");
 ...
 
-1.3.2. reset_ugflag(flag_num)
+3.2. reset_ugflag(flag_num)
 
-   Set the flag identified by flag_num to 0. The range of flag_num is 0 to
-   31.
+   Set  the  flag identified by flag_num to 0. The range of flag_num is 0
+   to 31.
 
-   Example 2. reset_ugflag usage
+   Example 1.2. reset_ugflag usage
 ...
 reset_ugflag("2");
 ...
 
-1.3.3. is_ugflag(flag_num)
+3.3. is_ugflag(flag_num)
 
-   Returns 1 when flag identified by flag_num is set, 0 otherwise. The
+   Returns  1  when  flag identified by flag_num is set, 0 otherwise. The
    range of flag_num parameter is 0 to 31.
 
-1.4. FIFO Interface
+4. FIFO Interface
 
-   The state of the global flags can be read and modified over the FIFO
-   interface of SER. This module implements the following FIFO interface
+   The  state  of the global flags can be read and modified over the FIFO
+   interface  of SER. This module implements the following FIFO interface
    functions:
      * set_gflag - Set the value of a flag to 1. The function accepts one
        parameter which is the number of the flag to be set.
      * reset_gflag - Reset the value of a flag to 0. The function accepts
        one parameter which is the number of the flag to be reset.
-     * is_gflag - Return the status of a flag. The FIFO function would
-       return TRUE if the flag is set and FALSE if it is not set. The only
-       parameter of this function is the number of the flag.
+     * is_gflag  -  Return  the status of a flag. The FIFO function would
+       return  TRUE  if  the  flag is set and FALSE if it is not set. The
+       only parameter of this function is the number of the flag.
 
-1.5. XMLRPC Interface
+5. XMLRPC Interface
 
    The state of the global flags can be read and modified over the XMLRPC
-   interface. This module implements the following XMLRPC interface
+   interface.  This  module  implements  the  following  XMLRPC interface
    commands:
-     * gflags.set - Set the value of a flag to 1. The function accepts one
-       parameter which is the number of the flag to be set.
-     * gflags.reset - Reset the value of a flag to 0. The function accepts
-       one parameter which is the number of the flag to be reset.
-     * gflags.is_set - Return the status of a flag. The FIFO function
-       would return TRUE if the flag is set and FALSE if it is not set.
+     * gflags.set  -  Set  the value of a flag to 1. The function accepts
+       one parameter which is the number of the flag to be set.
+     * gflags.reset  -  Reset  the  value  of  a  flag to 0. The function
+       accepts one parameter which is the number of the flag to be reset.
+     * gflags.is_set  -  Return  the  status of a flag. The FIFO function
+       would  return  TRUE if the flag is set and FALSE if it is not set.
        The only parameter of this function is the number of the flag.
      * gflags.flush - Flush the state of global flags into database.
      * gflags.dump - Return the status of all flags. The value is TRUE if
        the flag is set and FALSE if the flag is not set. The function has
        no parameters.
-     * global.reload - Reload values from global_attrs DB table. This
+     * global.reload  -  Reload  values  from global_attrs DB table. This
        function does not have any parameters. There is no return value on
        success.

+ 98 - 43
modules/uid_uri_db/README

@@ -1,159 +1,214 @@
-1. UID Uri_db Module
+
+UID Uri_db Module
 
 Jan Janak
 
    FhG FOKUS
 
    Copyright © 2003 FhG FOKUS
-     __________________________________________________________________
+     _________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+        2. Dependencies
+        3. Parameters
+
+              3.1. db_url (string)
+              3.2. uri_table (string)
+              3.3. uri_user_column (string)
+              3.4. uri_domain_column (string)
+              3.5. uri_uriuser_column (string)
+              3.6. subscriber_table (string)
+              3.7. subscriber_user_column (string)
+              3.8. subscriber_domain_column (string)
+
+        4. Functions
+
+              4.1. check_to() 
+              4.2. check_from() 
+              4.3. does_uri_exist() 
 
-   1.1. Overview
-   1.2. Dependencies
-   1.3. Parameters
+   List of Examples
 
-        1.3.1. db_url (string)
-        1.3.2. uri_table (string)
-        1.3.3. uri_user_column (string)
-        1.3.4. uri_domain_column (string)
-        1.3.5. uri_uriuser_column (string)
-        1.3.6. subscriber_table (string)
-        1.3.7. subscriber_user_column (string)
-        1.3.8. subscriber_domain_column (string)
+   1.1. Set db_url parameter
+   1.2. Set uri_table parameter
+   1.3. Set uri_user_column parameter
+   1.4. Set uri_domain_column parameter
+   1.5. Set uri_uriuser_column parameter
+   1.6. Set subscriber_table parameter
+   1.7. Set subscriber_user_column parameter
+   1.8. Set subscriber_domain_column parameter
+   1.9. check_to usage
+   1.10. check_from usage
+   1.11. does_uri_exist usage
 
-   1.4. Functions
+Chapter 1. Admin Guide
 
-        1.4.1. check_to()
-        1.4.2. check_from()
-        1.4.3. does_uri_exist()
+   Table of Contents
 
-1.1. Overview
+   1. Overview
+   2. Dependencies
+   3. Parameters
+
+        3.1. db_url (string)
+        3.2. uri_table (string)
+        3.3. uri_user_column (string)
+        3.4. uri_domain_column (string)
+        3.5. uri_uriuser_column (string)
+        3.6. subscriber_table (string)
+        3.7. subscriber_user_column (string)
+        3.8. subscriber_domain_column (string)
+
+   4. Functions
+
+        4.1. check_to() 
+        4.2. check_from() 
+        4.3. does_uri_exist() 
+
+1. Overview
 
    Various checks related to SIP URI.
 
-1.2. Dependencies
+2. Dependencies
 
    The following modules must be loaded before this module:
      * A SER database module.
 
-1.3. Parameters
+3. Parameters
+
+   3.1. db_url (string)
+   3.2. uri_table (string)
+   3.3. uri_user_column (string)
+   3.4. uri_domain_column (string)
+   3.5. uri_uriuser_column (string)
+   3.6. subscriber_table (string)
+   3.7. subscriber_user_column (string)
+   3.8. subscriber_domain_column (string)
 
-1.3.1. db_url (string)
+3.1. db_url (string)
 
    URL of the database to be used.
 
    Default value is "mysql://serro:47serro11@localhost/ser".
 
-   Example 1. Set db_url parameter
+   Example 1.1. Set db_url parameter
 ...
 modparam("module", "db_url", "mysql://username:password@localhost/ser")
 ...
 
-1.3.2. uri_table (string)
+3.2. uri_table (string)
 
    Table containing list of allowed URIs for each user.
 
    Default value is "uri".
 
-   Example 2. Set uri_table parameter
+   Example 1.2. Set uri_table parameter
 ...
 modparam("module", "uri_table", "uri")
 ...
 
-1.3.3. uri_user_column (string)
+3.3. uri_user_column (string)
 
    Column holding usernames in the URI table.
 
    Default value is "username".
 
-   Example 3. Set uri_user_column parameter
+   Example 1.3. Set uri_user_column parameter
 ...
 modparam("module", "uri_user_column", "username")
 ...
 
-1.3.4. uri_domain_column (string)
+3.4. uri_domain_column (string)
 
    Column holding domain in the URI table.
 
    Default value is "domain".
 
-   Example 4. Set uri_domain_column parameter
+   Example 1.4. Set uri_domain_column parameter
 ...
 modparam("module", "uri_domain_column", "domain")
 ...
 
-1.3.5. uri_uriuser_column (string)
+3.5. uri_uriuser_column (string)
 
    Column holding URI username in the URI table.
 
    Default value is "uri_user".
 
-   Example 5. Set uri_uriuser_column parameter
+   Example 1.5. Set uri_uriuser_column parameter
 ...
 modparam("module", "uri_uriuser_column", "uri_user")
 ...
 
-1.3.6. subscriber_table (string)
+3.6. subscriber_table (string)
 
    Name of the subscriber table.
 
    Default value is "subscriber".
 
-   Example 6. Set subscriber_table parameter
+   Example 1.6. Set subscriber_table parameter
 ...
 modparam("module", "subscriber_table", "subscriber")
 ...
 
-1.3.7. subscriber_user_column (string)
+3.7. subscriber_user_column (string)
 
    Column holding username in subscriber table.
 
    Default value is "username".
 
-   Example 7. Set subscriber_user_column parameter
+   Example 1.7. Set subscriber_user_column parameter
 ...
 modparam("module", "subscriber_user_column", "username")
 ...
 
-1.3.8. subscriber_domain_column (string)
+3.8. subscriber_domain_column (string)
 
    Column holding domains in the subscriber table.
 
    Default value is "domain".
 
-   Example 8. Set subscriber_domain_column parameter
+   Example 1.8. Set subscriber_domain_column parameter
 ...
 modparam("module", "subscriber_domain_column", "domain")
 ...
 
-1.4. Functions
+4. Functions
+
+   4.1. check_to() 
+   4.2. check_from() 
+   4.3. does_uri_exist() 
 
-1.4.1. check_to()
+4.1.  check_to()
 
    Check To username against URI table or digest credentials.
 
-   Example 9. check_to usage
+   Example 1.9. check_to usage
 ...
 if (check_to()) {
     ...
 };
 ...
 
-1.4.2. check_from()
+4.2.  check_from()
 
    Check From username against URI table or digest credentials.
 
-   Example 10. check_from usage
+   Example 1.10. check_from usage
 ...
 if (check_from()) {
     ...
 };
 ...
 
-1.4.3. does_uri_exist()
+4.3.  does_uri_exist()
 
    Check if username in the request URI belongs to an existing user.
 
-   Example 11. does_uri_exist usage
+   Example 1.11. does_uri_exist usage
 ...
 if (does_uri_exist()) {
     ...

+ 54 - 14
modules/xmlops/README

@@ -1,3 +1,4 @@
+
 XMLOPS Module
 
 Daniel-Constantin Mierla
@@ -6,17 +7,55 @@ Daniel-Constantin Mierla
    <[email protected]>
 
    Copyright © 2009 asipto.com
-     __________________________________________________________________
+     _________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+        2. Dependencies
+
+              2.1. Kamailio Modules
+              2.2. External Libraries or Applications
+
+        3. Parameters
+
+              3.1. buf_size (integer)
+              3.2. xml_ns (str)
+
+        4. Pseudo-Variables
+
+              4.1. $xml(name=>spec) 
 
    List of Examples
 
-   1. Set buf_size parameter
-   2. Set xml_ns parameter
-   3. xml usage
+   1.1. Set buf_size parameter
+   1.2. Set xml_ns parameter
+   1.3. xml usage
+
+Chapter 1. Admin Guide
+
+   Table of Contents
+
+   1. Overview
+   2. Dependencies
+
+        2.1. Kamailio Modules
+        2.2. External Libraries or Applications
+
+   3. Parameters
+
+        3.1. buf_size (integer)
+        3.2. xml_ns (str)
+
+   4. Pseudo-Variables
+
+        4.1. $xml(name=>spec) 
 
 1. Overview
 
-   This is a module implementing functions and pseudo-variables for XML
+   This  is  a module implementing functions and pseudo-variables for XML
    operations.
 
 2. Dependencies
@@ -31,7 +70,7 @@ Daniel-Constantin Mierla
 
 2.2. External Libraries or Applications
 
-   The following libraries or applications must be installed before
+   The  following  libraries  or  applications  must  be installed before
    running kamailio with this module loaded:
      * libxml - for compilation from source, the development headers from
        this library are needed as well.
@@ -40,7 +79,6 @@ Daniel-Constantin Mierla
 
    3.1. buf_size (integer)
    3.2. xml_ns (str)
-   3.3. Pseudo-Variables
 
 3.1. buf_size (integer)
 
@@ -48,29 +86,31 @@ Daniel-Constantin Mierla
 
    Default value is 4096.
 
-   Example 1. Set buf_size parameter
+   Example 1.1. Set buf_size parameter
 ...
 modparam("xmlops", "buf_size", 8192)
 ...
 
 3.2. xml_ns (str)
 
-   Register xml namespace prefix. Parameter value must have the format:
+   Register  xml  namespace prefix. Parameter value must have the format:
    'prefix=uri'.
 
-   Example 2. Set xml_ns parameter
+   Example 1.2. Set xml_ns parameter
 ...
 modparam("xmlops", "xml_ns", "rpid=urn:ietf:params:xml:ns:pidf:rpid")
 ...
 
-3.3. Pseudo-Variables
+4. Pseudo-Variables
+
+   4.1. $xml(name=>spec) 
 
-3.3. Pseudo-Variables
+4.1.  $xml(name=>spec)
 
-   Pseudo-variable for XML document operations using xpath syntax. For
+   Pseudo-variable  for  XML  document operations using xpath syntax. For
    more see the Pseudo-Variables Cookbook.
 
-   Example 3. xml usage
+   Example 1.3. xml usage
 ...
 $xml(x=>doc)
     = '<?xml version="1.0" encoding="UTF-8"?><a><b>test</b></a>';

+ 145 - 70
modules/xprint/README

@@ -1,3 +1,4 @@
+
 The Xprint Module
 
 Elena-Ramona Modroiu
@@ -5,24 +6,76 @@ Elena-Ramona Modroiu
    Asipto
 
    Copyright © 2003 FhG FOKUS
-     __________________________________________________________________
+     _________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+        2. Implemented Specifiers
+        3. Parameters
+
+              3.1. buf_size (integer)
+
+        4. Functions
+
+              4.1. xplog(level, format) 
+              4.2. xpdbg(format) 
+
+   2. Developer Guide
+
+        1. Module API
+
+              1.1. Functions
+
+                    1.1.1. int xbind(xl_api_t *xl_api) 
+                    1.1.2. int xparse(char *s, xl_elog_p *el) 
+                    1.1.3. int shm_xparse(char *s, xl_elog_p *el) 
+                    1.1.4. int xparse2(char *s, xl_elog_p *el,
+                            xl_parse_cb cb) 
+
+                    1.1.5. int shm_xparse2(char *s, xl_elog_p *el,
+                            xl_parse_cb cb) 
+
+                    1.1.6. xfree(xl_elog_p el) 
+                    1.1.7. shm_xfree(xl_elog_p el) 
+                    1.1.8. int xprint(struct sip_msg* msg, xl_elog_p el,
+                            char *buf, int *len) 
+
+                    1.1.9. str *xnulstr() 
 
    List of Examples
 
-   1. Set buf_size parameter
-   2. xplog usage
-   3. xpdbg usage
+   1.1. Set buf_size parameter
+   1.2. xplog usage
+   1.3. xpdbg usage
+
+Chapter 1. Admin Guide
+
+   Table of Contents
+
+   1. Overview
+   2. Implemented Specifiers
+   3. Parameters
+
+        3.1. buf_size (integer)
+
+   4. Functions
+
+        4.1. xplog(level, format) 
+        4.2. xpdbg(format) 
 
 1. Overview
 
-   IMPORTANT: this is former xlog module from SIP Express Router (SER)
-   kept because it is used by other modules via API to get the value for
-   strings with specifiers. If you want to print log messages from
+   IMPORTANT:  this  is  former xlog module from SIP Express Router (SER)
+   kept  because it is used by other modules via API to get the value for
+   strings  with  specifiers.  If  you  want  to  print log messages from
    configuration file, use the real module named 'xlog'.
 
-   This module provides the possibility to print user formatted log or
-   debug messages from SER scripts, similar to printf function but now a
-   specifier is replaced with a part of the SIP request. Section 2,
+   This  module  provides  the possibility to print user formatted log or
+   debug  messages from SER scripts, similar to printf function but now a
+   specifier  is  replaced  with  a  part  of the SIP request. Section 2,
    "Implemented Specifiers" shows what can be printed out.
 
 2. Implemented Specifiers
@@ -33,14 +86,14 @@ Elena-Ramona Modroiu
      * %ci : call-id
      * %cs : cseq
      * %ct : contact header
-     * %Cxy : color printing based on escape sequences (x - foreground
-       color, y - background color). The values for colors: x - default
-       color of the terminal; s - Black; r - Red; g - Green; y - Yellow; b
-       - Blue; p - Purple; c - Cyan; w - White
+     * %Cxy  :  color  printing based on escape sequences (x - foreground
+       color,  y  - background color). The values for colors: x - default
+       color  of the terminal; s - Black; r - Red; g - Green; y - Yellow;
+       b - Blue; p - Purple; c - Cyan; w - White
      * %ds : destination set
      * %fu : 'From' uri
      * %ft : 'From' tag
-     * %Hn : host's hostname (if system hostname is FQDN, part before
+     * %Hn  :  host's  hostname  (if system hostname is FQDN, part before
        first .)
      * %Hd : host's domain (if system hosntame is FQDN, part behind first
        .)
@@ -59,7 +112,7 @@ Elena-Ramona Modroiu
      * %rr : reply's reason
      * %rs : reply's status
      * %rt : 'Refer-To' uri
-     * %Ri : IP address of the interface where the request has been
+     * %Ri  :  IP  address  of  the  interface where the request has been
        received
      * %Rp : received port
      * %si : IP source address
@@ -72,32 +125,32 @@ Elena-Ramona Modroiu
      * %ua : User agent header field
      * %uq : unique id (per SER's process) - to make really unique id use
        %uq-%px-%mx or %uq-%px-%Tx
-     * %{name[N]} : print the body of the Nth header identified by 'name'.
-       If [N] is omitted then the body of the first header is printed. The
-       first header is got when N=0, for the second N=1, a.s.o. To print
-       the last header of that type, use -1, no other negative values are
-       supported now. No white spaces are allowed inside the specifier
-       (before }, before or after {, [, ] symbols). When N='*', all
-       headers of that type are printed.
-       The module should identify most of compact header names (the ones
+     * %{name[N]}  :  print  the  body  of  the  Nth header identified by
+       'name'.  If  [N]  is  omitted then the body of the first header is
+       printed.  The  first  header  is got when N=0, for the second N=1,
+       a.s.o.  To  print  the  last header of that type, use -1, no other
+       negative  values  are  supported  now. No white spaces are allowed
+       inside  the specifier (before }, before or after {, [, ] symbols).
+       When N='*', all headers of that type are printed.
+       The  module should identify most of compact header names (the ones
        recognized by ser which should be all at this moment), if not, the
        compact form has to be specified explicitely. It is recommended to
-       use dedicated specifiers for headers (e.g., %ua for user agent
+       use  dedicated  specifiers  for  headers (e.g., %ua for user agent
        header), if they are available -- they are faster.
      * %<name[N]> : print the value of AVP optionally %indexed by the [N]
        value It uses AVPs subindexing, e.g. if you don't specify subindex
        and there are more AVPs with the same name, the result is NULL. To
-       specify first AVP use [1], negative values are indexes counted
+       specify  first  AVP  use  [1], negative values are indexes counted
        backward through the list.
-     * %@select.framework[N].value : print the value of select framework
-       call. For detailed info what calls are available see select
+     * %@select.framework[N].value  : print the value of select framework
+       call.  For  detailed  info  what  calls  are  available see select
        framework documentation (and modules documentation, as modules can
        extend select framework calls).
      * %| or %(space) : end of %@select.framework identifier. If you need
-       to concatenate select framework call and another non-whitespace
-       literal, you need to explicitelly set the end of the select
+       to  concatenate  select  framework call and another non-whitespace
+       literal,  you  need  to  explicitelly  set  the  end of the select
        framework identifier.
-       E.g. %@ruri.user%|@%@ruri.host converts all featured request uri
+       E.g.  %@ruri.user%|@%@ruri.host  converts all featured request uri
        into user@host form only.
 
 3. Parameters
@@ -110,15 +163,15 @@ Elena-Ramona Modroiu
 
    Default value is 4096.
 
-   Example 1. Set buf_size parameter
+   Example 1.1. Set buf_size parameter
 ...
 modparam("xprint", "buf_size", 8192)
 ...
 
 4. Functions
 
-   4.1. xplog(level, format)
-   4.2. xpdbg(format)
+   4.1. xplog(level, format) 
+   4.2. xpdbg(format) 
 
 4.1.  xplog(level, format)
 
@@ -136,7 +189,7 @@ modparam("xprint", "buf_size", 8192)
        What really matters is the third letter of the value.
      * format - The formatted string to be printed.
 
-   Example 2. xplog usage
+   Example 1.2. xplog usage
 ...
 xplog("L_ERR", "time [%Tf] method <%rm> r-uri <%ru> 2nd via <%{via[1]}>\n");
 ...
@@ -148,41 +201,63 @@ xplog("L_ERR", "time [%Tf] method <%rm> r-uri <%ru> 2nd via <%{via[1]}>\n");
    Meaning of the parameters is as follows:
      * format - The formatted string to be printed.
 
-   Example 3. xpdbg usage
+   Example 1.3. xpdbg usage
 ...
 xpdbg("time [%Tf] method <%rm> r-uri <%ru>\n");
 ...
 
-5. Module API
+Chapter 2. Developer Guide
+
+   Table of Contents
+
+   1. Module API
+
+        1.1. Functions
+
+              1.1.1. int xbind(xl_api_t *xl_api) 
+              1.1.2. int xparse(char *s, xl_elog_p *el) 
+              1.1.3. int shm_xparse(char *s, xl_elog_p *el) 
+              1.1.4. int xparse2(char *s, xl_elog_p *el, xl_parse_cb cb) 
+              1.1.5. int shm_xparse2(char *s, xl_elog_p *el, xl_parse_cb
+                      cb) 
+
+              1.1.6. xfree(xl_elog_p el) 
+              1.1.7. shm_xfree(xl_elog_p el) 
+              1.1.8. int xprint(struct sip_msg* msg, xl_elog_p el, char
+                      *buf, int *len) 
+
+              1.1.9. str *xnulstr() 
+
+1. Module API
 
-   5.1. Functions
+   1.1. Functions
 
-        5.1.1. int xbind(xl_api_t *xl_api)
-        5.1.2. int xparse(char *s, xl_elog_p *el)
-        5.1.3. int shm_xparse(char *s, xl_elog_p *el)
-        5.1.4. int xparse2(char *s, xl_elog_p *el, xl_parse_cb cb)
-        5.1.5. int shm_xparse2(char *s, xl_elog_p *el, xl_parse_cb cb)
-        5.1.6. xfree(xl_elog_p el)
-        5.1.7. shm_xfree(xl_elog_p el)
-        5.1.8. int xprint(struct sip_msg* msg, xl_elog_p el, char *buf,
-                int *len)
+        1.1.1. int xbind(xl_api_t *xl_api) 
+        1.1.2. int xparse(char *s, xl_elog_p *el) 
+        1.1.3. int shm_xparse(char *s, xl_elog_p *el) 
+        1.1.4. int xparse2(char *s, xl_elog_p *el, xl_parse_cb cb) 
+        1.1.5. int shm_xparse2(char *s, xl_elog_p *el, xl_parse_cb cb) 
+        1.1.6. xfree(xl_elog_p el) 
+        1.1.7. shm_xfree(xl_elog_p el) 
+        1.1.8. int xprint(struct sip_msg* msg, xl_elog_p el, char *buf,
+                int *len) 
 
-        5.1.9. str *xnulstr()
+        1.1.9. str *xnulstr() 
 
-5.1. Functions
+1.1. Functions
 
-5.1.1.  int xbind(xl_api_t *xl_api)
+1.1.1.  int xbind(xl_api_t *xl_api)
 
    Bind to the xprint module API.
 
    Meaning of the parameters is as follows:
-     * xl_api - structure that the xprint module functions are bind to.
-       The functions can be executed as xl_api.xparse(),
+     * xl_api  -  structure that the xprint module functions are bind to.
+       The    functions    can    be    executed    as   xl_api.xparse(),
        xl_api.xprint()...
 
    Return value: 0 - success, <0 - error.
 
-5.1.2.  int xparse(char *s, xl_elog_p *el)
+1.1.2.  int xparse(char *s, xl_elog_p *el)
 
    Parse an xl-formatted string in private memory.
 
@@ -192,30 +267,30 @@ xpdbg("time [%Tf] method <%rm> r-uri <%ru>\n");
 
    Return value: 0 - success, <0 - error.
 
-5.1.3.  int shm_xparse(char *s, xl_elog_p *el)
+1.1.3.  int shm_xparse(char *s, xl_elog_p *el)
 
-   Parse an xl-formatted string in shared memory. See xparse() function
+   Parse  an  xl-formatted string in shared memory. See xparse() function
    for details.
 
-5.1.4.  int xparse2(char *s, xl_elog_p *el, xl_parse_cb cb)
+1.1.4.  int xparse2(char *s, xl_elog_p *el, xl_parse_cb cb)
 
-   Parse an xl-formatted string in private memory. This function is able
-   to identify regular expression back references, for example \1, \2,
-   \3... When a back reference is found the callback function is called
-   that is supposed to farther parse the back reference and fill in the
+   Parse  an xl-formatted string in private memory. This function is able
+   to  identify  regular  expression back references, for example \1, \2,
+   \3...  When  a back reference is found the callback function is called
+   that  is  supposed to farther parse the back reference and fill in the
    xl_elog structure.
 
    Meaning of the parameters is as follows:
      * s - string to be parsed.
      * el - returned xl-lib list.
-     * cb - callback function for parsing the regular expression back
+     * cb  -  callback  function  for parsing the regular expression back
        references.
 
-   The prototype of the callback function is: typedef int (*xl_parse_cb)
+   The  prototype of the callback function is: typedef int (*xl_parse_cb)
    (str *s, int shm, xl_elog_p el);
 
    Parameters of the callback function:
-     * s - regular expression back reference to be parsed (without the
+     * s  -  regular  expression back reference to be parsed (without the
        leading '\' character).
      * shm - indicates whether or not shared memory needs to be used. (1:
        shared memory, 0: private memory)
@@ -224,26 +299,26 @@ xpdbg("time [%Tf] method <%rm> r-uri <%ru>\n");
 
    Return value: 0 - success, <0 - error.
 
-5.1.5.  int shm_xparse2(char *s, xl_elog_p *el, xl_parse_cb cb)
+1.1.5.  int shm_xparse2(char *s, xl_elog_p *el, xl_parse_cb cb)
 
-   Parse an xl-formatted string in shared memory supporting regular
+   Parse  an  xl-formatted  string  in  shared  memory supporting regular
    expression back references. See xparse2() function for details.
 
-5.1.6.  xfree(xl_elog_p el)
+1.1.6.  xfree(xl_elog_p el)
 
    Free the xl-lib list allocated by xparse() or xparse2().
 
    Meaning of the parameters is as follows:
      * el - xl-lib list to be freed.
 
-5.1.7.  shm_xfree(xl_elog_p el)
+1.1.7.  shm_xfree(xl_elog_p el)
 
    Free the xl-lib list allocated by shm_xparse() or shm_xparse2().
 
    Meaning of the parameters is as follows:
      * el - xl-lib list to be freed.
 
-5.1.8.  int xprint(struct sip_msg* msg, xl_elog_p el, char *buf, int *len)
+1.1.8.  int xprint(struct sip_msg* msg, xl_elog_p el, char *buf, int *len)
 
    Evaluate the xl-formatted string and print the result into a buffer.
 
@@ -251,11 +326,11 @@ xpdbg("time [%Tf] method <%rm> r-uri <%ru>\n");
      * msg - SIP message pointer.
      * el - xl-lib list to be evaluated.
      * buf - pre-allocated buffer that is filled in with the result.
-     * len - length of the printed string. len needs to be set to the
+     * len  -  length  of  the printed string. len needs to be set to the
        maximum length of the result buffer before calling this function.
 
    Return value: 0 - success, <0 - error.
 
-5.1.9.  str *xnulstr()
+1.1.9.  str *xnulstr()
 
    Return the string "<null>".

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels