
registrar Module

Jan Janak

   FhG FOKUS

Edited by

Jan Janak

   Copyright  2003 FhG FOKUS
     _________________________________________________________

   Table of Contents
   1. User's Guide

        1.1. Overview
        1.2. Dependencies

              1.2.1. SER Modules
              1.2.2. External Libraries or Applications

        1.3. Exported Parameters

              1.3.1. default_expires (integer)
              1.3.2. default_q (integer)
              1.3.3. append_branches (integer)
              1.3.4. case_sensitive (integer)
              1.3.5. desc_time_order (integer)
              1.3.6. nat_flag (integer)
              1.3.7. realm_prefix (string)
              1.3.8. min_expires (integer)
              1.3.9. max_expires (integer)
              1.3.10. received_param (integer)
              1.3.11. received_avp (integer)
              1.3.12. use_domain (integer)
              1.3.13. max_contacts (integer)
              1.3.14. retry_after (integer)

        1.4. Exported Functions

              1.4.1. save(domain)
              1.4.2. save_noreply(domain)
              1.4.3. save_memory(domain)
              1.4.4. lookup(domain)
              1.4.5. registered(domain)

   2. Developer's Guide
   3. Frequently Asked Questions

   List of Examples
   1-1. Set default_expires parameter
   1-2. Set default_q parameter
   1-3. Set append_branches parameter
   1-4. Set case_sensitive parameter
   1-5. Set desc_time_order parameter
   1-6. Set nat_flag parameter
   1-7. Set min_expires parameter
   1-8. Set max_expires parameter
   1-9. Set received_param parameter
   1-10. Set received_avp parameter
   1-11. Set use_domain parameter
   1-12. Set max_contacts parameter
   1-13. Set retry_after parameter
   1-14. save usage
   1-15. save_noreply usage
   1-16. lookup usage
   1-17. registered usage
     _________________________________________________________

Chapter 1. User's Guide

1.1. Overview

   The module contains REGISTER processing logic.
     _________________________________________________________

1.2. Dependencies

1.2.1. SER Modules

   The following modules must be loaded before this module:

     * usrloc - User Location Module.
     * sl - Stateless Replies.
     _________________________________________________________

1.2.2. External Libraries or Applications

   The following libraries or applications must be installed
   before running SER with this module loaded:

     * None.
     _________________________________________________________

1.3. Exported Parameters

1.3.1. default_expires (integer)

   If the processed message contains neither Expires HFs nor
   expires contact parameters, this value will be used for newly
   created usrloc records. The parameter contains number of
   second to expire (for example use 3600 for one hour).

   Default value is 3600. 

   Example 1-1. Set default_expires parameter
...
modparam("registrar", "default_expires", 1800)
...
     _________________________________________________________

1.3.2. default_q (integer)

   The parameter represents default q value for new contacts.
   Because ser doesn't support float parameter types, the value
   in the parameter is divided by 100 and stored as float. For
   example, if you want default_q to be 0.38, use value 38 here.

   Default value is 0. 

   Example 1-2. Set default_q parameter
...
modparam("registrar", "default_q", 100)
...
     _________________________________________________________

1.3.3. append_branches (integer)

   The parameter controls how lookup function processes multiple
   contacts. If there are multiple contacts for the given
   username in usrloc and this parameter is set to 1, Request-URI
   will be overwritten with the highest-q rated contact and the
   rest will be appended to sip_msg structure and can be later
   used by tm for forking. If the parameter is set to 0, only
   Request-URI will be overwritten with the highest-q rated
   contact and the rest will be left unprocessed.

   Default value is 1. 

   Example 1-3. Set append_branches parameter
...
modparam("registrar", "append_branches", 0)
...
     _________________________________________________________

1.3.4. case_sensitive (integer)

   If set to 1 then AOR comparison will be case sensitive, if set
   to 0 then AOR comparison will be case insensitive--This is
   recommended.

   Default value is 0. 

   Example 1-4. Set case_sensitive parameter
...
modparam("registrar", "case_sensitive", 1)
...
     _________________________________________________________

1.3.5. desc_time_order (integer)

   If set to 1 then all contacts will be ordered in descending
   modification time order. In this case the most recently
   updated/created contact will be used.

   Default value is 0. 

   Example 1-5. Set desc_time_order parameter
...
modparam("registrar", "desc_time_order", 1)
...
     _________________________________________________________

1.3.6. nat_flag (integer)

   The number of the NAT-flag. This is the flag which is set when
   the originator of a message is behind NAT. This flag will be
   saved in the user location database when save function is
   executed and recovered later by lookup function.

   Default value is 4. 

   Example 1-6. Set nat_flag parameter
...
modparam("registrar", "nat_flag", 6)
...
     _________________________________________________________

1.3.7. realm_prefix (string)

   The prefix to be stripped from the beginning of hostname part.
   This is useful when dealing with user agents that do not allow
   to specify different hostname part and outbound server. Such
   user agents would typically resolve a domain using SRV and put
   the hostname obtained from SRV in From and To header field of
   REGISTER message. For example, if SRV for iptel.org points to
   sip.iptel.org then such user agents would create From:
   sip:user@sip.iptel.org and in this case this parameter can be
   used to strip "sip." prefix.

   Default value is "". 
     _________________________________________________________

1.3.8. min_expires (integer)

   The minimum expires value of a Contact, values lower than this
   minimum will be automatically set to the minimum. Value 0
   disables the checking.

   Default value is 60. 

   Example 1-7. Set min_expires parameter
...
modparam("registrar", "min_expires", 60)
...
     _________________________________________________________

1.3.9. max_expires (integer)

   The maximum expires value of a Contact, values higher than
   this maximum will be automatically set to the maximum. Value 0
   disables the checking.

   Default value is 0. 

   Example 1-8. Set max_expires parameter
...
modparam("registrar", "max_expires", 120)
...
     _________________________________________________________

1.3.10. received_param (integer)

   The name of the parameter that will be appended to Contacts of
   200 OK when the received URI was set by nathelper module.

   Default value is "received". 

   Example 1-9. Set received_param parameter
...
modparam("registrar", "received_param", "rcv")
...
     _________________________________________________________

1.3.11. received_avp (integer)

   Registrar will store the value of the AVP configured by this
   parameter in the received column in the user location
   database. It will leave the column empty if the AVP is empty.
   The AVP should contain a SIP URI consisting of the source IP,
   port, and protocol of the REGISTER message being processed.

   Note

   The value of this parameter should be the same as the value of
   corresponding parameter of nathelper module.

   Default value is 42. 

   Example 1-10. Set received_avp parameter
...
modparam("registrar", "received_avp", 43)
...
     _________________________________________________________

1.3.12. use_domain (integer)

   If set to 1 then the registrar will use username@domain as
   address of record. If the variable is set to 0 then only
   username will be used as the address of record.

   Default value is 0. 

   Example 1-11. Set use_domain parameter
...
modparam("registrar", "use_domain", 1)
...
     _________________________________________________________

1.3.13. max_contacts (integer)

   The parameter can be used to limit the number of contacts per
   AOR (Address of Record) in the user location database. Value 0
   disables the check.

   Default value is 0. 

   Example 1-12. Set max_contacts parameter
...
# Allow no more than 10 contacts per AOR
modparam("registrar", "max_contacts", 10)
...
     _________________________________________________________

1.3.14. retry_after (integer)

   The registrar can generate 5xx reply to REGISTER in various
   situations. It can, for example, happen when the max_contacts
   parameter is set and the processing of REGISTER request would
   exceed the limit. In this case the registrar would generate
   "503 Service Unavailable" response.

   If you want to add the Retry-After header field in 5xx
   replies, set this parameter to a value grater than zero (0
   means do not add the header field). See section 20.33 of
   RFC3261 for more details.

   Default value is 0 (disabled). 

   Example 1-13. Set retry_after parameter
...
modparam("registrar", "retry_after", 30)
...
     _________________________________________________________

1.4. Exported Functions

1.4.1. save(domain)

   The function processes a REGISTER message. It can add, remove
   or modify usrloc records depending on Contact and Expires HFs
   in the REGISTER message. On success, 200 OK will be returned
   listing all contacts that are currently in usrloc. On an
   error, error message will be send with a short description in
   reason phrase.

   Meaning of the parameters is as follows:

     * domain - Logical domain within registrar. If database is
       used then this must be name of the table which stores the
       contacts.

   Example 1-14. save usage
...
save("location");
...
     _________________________________________________________

1.4.2. save_noreply(domain)

   Same as save() but it doesn't send a reply.

   Meaning of the parameters is as follows:

     * domain - Logical domain within registrar. If database is
       used then this must be na e of the table which stores the
       contacts.

   Example 1-15. save_noreply usage
...
save_noreply("location");
...
     _________________________________________________________

1.4.3. save_memory(domain)

   Same as save() but it does update the memory cache only. The
   contents of the database will be not updated. This is useful
   for REGISTER replication where two machines updating the same
   database would generate a conflict. In such a scenario one
   machine could update the database, replicate the message to
   the other machine and that one would only update memory cache.

   Meaning of the parameters is as follows:

     * domain - Logical domain within registrar. If database is
       used then this must be na e of the table which stores the
       contacts.
     _________________________________________________________

1.4.4. lookup(domain)

   The functions extracts username from Request-URI and tries to
   find all contacts for the username in usrloc. If there are no
   such contacts, -1 will be returned. If there are such
   contacts, Request-URI will be overwritten with the contact
   that has the highest q value and optionally the rest will be
   appended to the message (depending on append_branches
   parameter value).

   Meaning of the parameters is as follows:

     * domain - Name of table that should be used for the lookup.

   Example 1-16. lookup usage
...
lookup("location");
...
     _________________________________________________________

1.4.5. registered(domain)

   The function returns true if the AOR in the Request-URI is
   registered, false otherwise. The function does not modify the
   message being process, it neither rewrites the Request-URI if
   a contact is found not append branches.

   Meaning of the parameters is as follows:

     * domain - Name of table that should be used for the lookup.

   Example 1-17. registered usage
...
if (registered("location")) {
    sl_send_reply("100", "Trying");
    ...
};
...
     _________________________________________________________

Chapter 2. Developer's Guide

   The module does not provide any sort of API to use in other
   SER modules.
     _________________________________________________________

Chapter 3. Frequently Asked Questions

   3.1. Where can I find more about SER?
   3.2. Where can I post a question about this module?
   3.3. How can I report a bug?

   3.1. Where can I find more about SER?

   Take a look at http://iptel.org/ser.

   3.2. Where can I post a question about this module?

   First at all check if your question was already answered on
   one of our mailing lists:

     * http://mail.iptel.org/mailman/listinfo/serusers
     * http://mail.iptel.org/mailman/listinfo/serdev

   E-mails regarding any stable version should be sent to
   <serusers@iptel.org> and e-mail regarding development versions
   or CVS snapshots should be send to <serdev@iptel.org>.

   If you want to keep the mail private, send it to
   <serhelp@iptel.org>.

   3.3. How can I report a bug?

   Please follow the guidelines provided at:
   http://iptel.org/ser/bugs
