dialplan Module

Andreea-Ancuta Onofrei

   Voice Sistem SRL

Edited by

Andreea-Ancuta Onofrei

   Copyright © 2007 voice-system.ro
     __________________________________________________________

   Table of Contents
   1. User's Guide

        1.1. Overview
        1.2. How it works
        1.3. Dependencies

              1.3.1. OpenSER Modules
              1.3.2. External Libraries or Applications

        1.4. Exported Parameters

              1.4.1. db_url (string)
              1.4.2. table_name (string)
              1.4.3. dpid_col (string)
              1.4.4. pr_col (string)
              1.4.5. match_op_col (string)
              1.4.6. match_exp_col (string)
              1.4.7. match_len_col (string)
              1.4.8. subst_exp_col (string)
              1.4.9. repl_exp_col (string)
              1.4.10. attrs_col (string)
              1.4.11. attrs_pvar (string)
              1.4.12. fetch_rows (int)

        1.5. Exported Functions

              1.5.1. dp_translate(id, src/dest)

        1.6. Exported MI Functions

              1.6.1. dp_reload

   2. Developer's Guide
   3. Frequently Asked Questions

   List of Examples
   1-1. Set db_url parameter
   1-2. Set table_name parameter
   1-3. Set dpid_col parameter
   1-4. Set pr_col parameter
   1-5. Set match_op_col parameter
   1-6. Set match_exp_col parameter
   1-7. Set pr_col parameter
   1-8. Set pr_col parameter
   1-9. Set repl_exp_col parameter
   1-10. Set attrs_col parameter
   1-11. Set attrs_pvar parameter
   1-12. Set fetch_rows parameter
   1-13. dp_translate usage
   1-14. dp_translate usage
     __________________________________________________________

Chapter 1. User's Guide

1.1. Overview

   This module manipulates the username from the R-URI or the
   value of a pseudo-variable to get to a canonical form of a PSNT
   number.

   The module must be capable to autocomplete ordinary telephone
   numbers, replace emergency numbers with the corresponding
   number and set some call attributes.
     __________________________________________________________

1.2. How it works

   In order to handle telephone numbers(strings) the module will
   load a set of rules from a database. Every database raw will be
   stored in memory as a translation rule. Each rule will describe
   how the matching should be made, how the telephone number
   should be modified and which attributes should be set for the
   matching call.

   The first matching rule will be processed.
     __________________________________________________________

1.3. Dependencies

1.3.1. OpenSER Modules

   The following modules must be loaded before this module:

     * None
     __________________________________________________________

1.3.2. External Libraries or Applications

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

     * None.
     __________________________________________________________

1.4. Exported Parameters

1.4.1. db_url (string)

   The translation rules will be loaded using this database url.

   Default value is "mysql://openser:openserrw@localhost/openser".

   Example 1-1. Set db_url parameter
...
modparam("dialplan", "db_url", "mysql://user:passwb@localhost/db")
...
     __________________________________________________________

1.4.2. table_name (string)

   The table's name from which to load the translation rules.

   Default value is "dialplan".

   Example 1-2. Set table_name parameter
...
modparam("dialplan", "table_name", "my_table")
...
     __________________________________________________________

1.4.3. dpid_col (string)

   The column name to store the dialplan ID group.

   Default value is "dpid".

   Example 1-3. Set dpid_col parameter
...
modparam("dialplan", "dpid_col", "column_name")
...
     __________________________________________________________

1.4.4. pr_col (string)

   The column name to store the priority of the correspondig rule
   from the database raw.

   Default value is "pr".

   Example 1-4. Set pr_col parameter
...
modparam("dialplan", "pr_col", "column_name")
...
     __________________________________________________________

1.4.5. match_op_col (string)

   The column name to store the type of matching of the rule.

   Default value is "match_op".

   Example 1-5. Set match_op_col parameter
...
modparam("dialplan", "match_op_col", "column_name")
...
     __________________________________________________________

1.4.6. match_exp_col (string)

   The column name to store the rule match expression.

   Default value is "match_exp".

   Example 1-6. Set match_exp_col parameter
...
modparam("dialplan", "match_exp_col", "column_name")
...
     __________________________________________________________

1.4.7. match_len_col (string)

   The column name to store the length of a string matching the
   match expression.

   Default value is "match_len".

   Example 1-7. Set pr_col parameter
...
modparam("dialplan", "match_len_col", "column_name")
...
     __________________________________________________________

1.4.8. subst_exp_col (string)

   The column name to store the rule's substitution expression.

   Default value is "subst_exp".

   Example 1-8. Set pr_col parameter
...
modparam("dialplan", "subst_exp_col", "column_name")
...
     __________________________________________________________

1.4.9. repl_exp_col (string)

   The column name to store the rule's replacement expression.

   Default value is "repl_exp".

   Example 1-9. Set repl_exp_col parameter
...
modparam("dialplan", "repl_exp_col", "column_name")
...
     __________________________________________________________

1.4.10. attrs_col (string)

   The column name to store the rule's attributes to be set to the
   message.

   Default value is "attrs".

   Example 1-10. Set attrs_col parameter
...
modparam("dialplan", "attrs_col", "column_name")
...
     __________________________________________________________

1.4.11. attrs_pvar (string)

   The pvar to store the rule's attributes, after translation
   (dp_translate() succeeds). This parameter can be an AVP or a
   SCRIPT VAR.

   Default value is "NULL".

   Example 1-11. Set attrs_pvar parameter
...
modparam("dialplan", "attrs_pvar", "$avp(s:dest)")
...
     __________________________________________________________

1.4.12. fetch_rows (int)

   The number of rows to be fetched at once from database/

   Default value is "1000".

   Example 1-12. Set fetch_rows parameter
...
modparam("dialplan", "fetch_rows", 4000)
...
     __________________________________________________________

1.5. Exported Functions

1.5.1. dp_translate(id, src/dest)

   Will try to translate the src string into dest string according
   to the translation rules with dpid equal to id.

   Meaning of the parameters is as follows:

     * id -the dialplan id of the possible matching rules. This
       parameter cand have the following types:
          + integer- the dialplan id is staticaly assigned
          + avp var -the dialplan id is the value of an existing
            avp variable
          + script var -the dialplan id is the value of an
            existing script variable.
     * src/dest - input and output of the function. If this
       parameter is missing the default parameter
       "ruri.user/ruri.user" will be used, thus translating the
       request uri.
       Both src and dest can have the following types:
          + R-URI
            - the string is the r-uri or r-uri username
          + avp var
            -At input the function will get the input string from
            an existing avp variable. At output the function will
            add an avp with the value of the output string.
          + script var
            -At input the function will get the input string from
            an existing script variable. At output the function
            will set an script variable with the value of the
            output string.

   This function can be used from REQUEST_ROUTE, BRANCH_ROUTE.

   Example 1-13. dp_translate usage
...
dp_translate("240", "$ruri.user/$avp(s:dest)");
xlog("translated to var $avp(s:dest) \n");
...

   Example 1-14. dp_translate usage
...
$avp(s:src) = $ruri.user;
dp_translate("$var(x)", "$avp(s:src)/$var(y)");
xlog("translated to var $var(y) \n");
...
     __________________________________________________________

1.6. Exported MI Functions

1.6.1. dp_reload

   It will update the translation rules, loading the database
   info.

   Name: dp_reload

   Parameters: none

   MI DATAGRAM Command Format:
                :dp_reload:
                _empty_line_
     __________________________________________________________

Chapter 2. Developer's Guide

   The module does not provide any API to use in other OpenSER
   modules.
     __________________________________________________________

Chapter 3. Frequently Asked Questions

   3.1. Where can I find more about OpenSER?
   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 OpenSER?

   Take a look at http://openser.org/.

   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:

     * User Mailing List -
       http://openser.org/cgi-bin/mailman/listinfo/users
     * Developer Mailing List -
       http://openser.org/cgi-bin/mailman/listinfo/devel

   E-mails regarding any stable OpenSER release should be sent to
   <users@openser.org> and e-mails regarding development versions
   should be sent to <devel@openser.org>.

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

   3.3. How can I report a bug?

   Please follow the guidelines provided at:
   http://sourceforge.net/tracker/?group_id=139143.
