You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kamailio/modules_k/pv
Richard Fuchs fa39cc9fbe
fix possible segfault in empty-string case
13 years ago
..
doc update to 3.3.0 from upstream 14 years ago
Makefile Start versioning of kamailio-3.1-sipwise in svn. 15 years ago
README update to 3.3.0 from upstream 14 years ago
pv.c update to 3.3.0 from upstream 14 years ago
pv_branch.c Merge sipwise and kamailio 3.1.5 branches 15 years ago
pv_branch.h Start versioning of kamailio-3.1-sipwise in svn. 15 years ago
pv_core.c update to 3.3.0 from upstream 14 years ago
pv_core.h update to 3.3.0 from upstream 14 years ago
pv_select.c Start versioning of kamailio-3.1-sipwise in svn. 15 years ago
pv_select.h Start versioning of kamailio-3.1-sipwise in svn. 15 years ago
pv_shv.c Start versioning of kamailio-3.1-sipwise in svn. 15 years ago
pv_shv.h Start versioning of kamailio-3.1-sipwise in svn. 15 years ago
pv_stats.c Start versioning of kamailio-3.1-sipwise in svn. 15 years ago
pv_stats.h Start versioning of kamailio-3.1-sipwise in svn. 15 years ago
pv_svar.c Start versioning of kamailio-3.1-sipwise in svn. 15 years ago
pv_svar.h Start versioning of kamailio-3.1-sipwise in svn. 15 years ago
pv_time.c update to 3.3.0 from upstream 14 years ago
pv_time.h update to 3.3.0 from upstream 14 years ago
pv_trans.c fix possible segfault in empty-string case 13 years ago
pv_trans.h update to 3.3.0 from upstream 14 years ago
pv_xavp.c update to 3.3.0 from upstream 14 years ago
pv_xavp.h Start versioning of kamailio-3.1-sipwise in svn. 15 years ago

README

Pseudo-Variables Module

Daniel-Constantin Mierla

   asipto.com
   <daniel@asipto.com>

Edited by

Daniel-Constantin Mierla

   <daniel@asipto.com>

   Copyright © 2008-2011 Daniel-Constantin Mierla (asipto.com)

   Copyright © 2011 Juha Heinanen
     __________________________________________________________________

   Table of Contents

   1. Admin Guide

        1. Overview
        2. Dependencies

              2.1. Kamailio Modules
              2.2. External Libraries or Applications

        3. Parameters

              3.1. shvset (string)
              3.2. varset (string)
              3.3. avp_aliases (string)

        4. Functions

              4.1. pv_isset(pvar)
              4.2. pv_unset(pvar)
              4.3. is_int(pvar)

        5. MI Commands

              5.1. shv_set
              5.2. shv_get

   List of Examples

   1.1. shvset parameter usage
   1.2. varset parameter usage
   1.3. avp_aliases parameter usage
   1.4. pv_isset usage
   1.5. pv_unset usage
   1.6. is_int() usage
   1.7. shv_set usage
   1.8. shv_get 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. shvset (string)
        3.2. varset (string)
        3.3. avp_aliases (string)

   4. Functions

        4.1. pv_isset(pvar)
        4.2. pv_unset(pvar)
        4.3. is_int(pvar)

   5. MI Commands

        5.1. shv_set
        5.2. shv_get

1. Overview

   This module collects the core pseudo-variables that can be used in
   configuration file. They are listed in Dokuwiki:
   http://www.kamailio.org/dokuwiki/, in Pseudo-Variables section

2. Dependencies

   2.1. Kamailio Modules
   2.2. External Libraries or Applications

2.1. Kamailio Modules

   The following modules must be loaded before this module:
     * No dependencies on other Kamailio modules.

2.2. External Libraries or Applications

   The following libraries or applications must be installed before
   running Kamailio with this module loaded:
     * None.

3. Parameters

   3.1. shvset (string)
   3.2. varset (string)
   3.3. avp_aliases (string)

3.1. shvset (string)

   Set the value of a shared variable ($shv(name)). The parameter can be
   set many times.

   The value of the parameter has the format: _name_ '=' _type_ ':'
   _value_
     * _name_: shared variable name
     * _type_: type of the value
          + “i”: integer value
          + “s”: string value
     * _value_: value to be set

   Default value is “NULL”.

   Example 1.1. shvset parameter usage
...
modparam("pv", "shvset", "debug=i:1")
modparam("pv", "shvset", "pstngw=s:sip:10.10.10.10")
...

3.2. varset (string)

   Set the value of a script variable ($var(name)). The parameter can be
   set many times.

   The value of the parameter has the format: _name_ '=' _type_ ':'
   _value_
     * _name_: shared variable name
     * _type_: type of the value
          + “i”: integer value
          + “s”: string value
     * _value_: value to be set

   Default value is “NULL”.

   Example 1.2. varset parameter usage
...
modparam("pv", "varset", "init=i:1")
modparam("pv", "varset", "gw=s:sip:11.11.11.11;transport=tcp")
...

3.3. avp_aliases (string)

   Define aliases for PV AVP names.

   Default value is NULL.

   Example 1.3. avp_aliases parameter usage
...
modparam("pv","avp_aliases","email=s:email_addr;tmp=i:100")
...

4. Functions

   4.1. pv_isset(pvar)
   4.2. pv_unset(pvar)
   4.3. is_int(pvar)

4.1. pv_isset(pvar)

   Return true if a PV value is different than 'null'.

   Meaning of the parameters is as follows:
     * pvar - pvar identifier.

   This function can be used from ANY_ROUTE.

   Example 1.4. pv_isset usage
...
if(pv_isset("$avp("s:x")"))
{
    ...
}
...

4.2. pv_unset(pvar)

   Unset the value of the PV (e.g., delete AVP, set to null).

   Meaning of the parameters is as follows:
     * pvar - pvar identifier.

   This function can be used from ANY_ROUTE.

   Example 1.5. pv_unset usage
...
pv_unset("$avp("s:x")");
...

4.3.  is_int(pvar)

   Function checks if pvar argument contains integer value and returns 1
   if it does and -1 otherwise.

   Function can be used from all kinds of routes.

   Example 1.6. is_int() usage
...
if (is_int("$var(foo)")) {
    xlog("L_INFO", "variable foo contains integer value\n");
}
...

5. MI Commands

   5.1. shv_set
   5.2. shv_get

5.1. shv_set

   Set the value of a shared variable ($shv(name)).

   Parameters:
     * _name_: shared variable name
     * _type_: type of the value
          + “int”: integer value
          + “str”: string value
     * _value_: value to be set

   MI FIFO Command Format:
                :shv_set:_reply_fifo_file_
                _name_
                _type_
                _value_
                _empty_line_

   Example 1.7. shv_set usage
...
$ kamctl fifo shv_set debug int 0
...

5.2. shv_get

   Get the value of a shared variable ($shv(name)).

   Parameters:
     * _name_: shared variable name. If this parameter is missing, all
       shared variables are returned.

   MI FIFO Command Format:
                :shv_get:_reply_fifo_file_
                _name_
                _empty_line_

   Example 1.8. shv_get usage
...
$ kamctl fifo shv_get debug
$ kamctl fifo shv_get
...