POSOPS Module

Daniel-Constantin Mierla

   asipto.com
   <miconda@gmail.com>

Edited by

Daniel-Constantin Mierla

   <miconda@gmail.com>

   Copyright © 2021 http://www.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. idx0 (int)

        4. Functions

              4.1. pos_append(idx, val)
              4.2. pos_insert(idx, val)
              4.3. pos_rm(idx, len)
              4.4. pos_headers_start()
              4.5. pos_headers_end()
              4.6. pos_body_start()
              4.7. pos_body_end()

   List of Examples

   1.1. Set idx0 parameter
   1.2. pos_append() usage
   1.3. pos_insert() usage
   1.4. pos_rm() usage
   1.5. pos_headers_start() usage
   1.6. pos_headers_end() usage
   1.7. pos_body_start() usage
   1.8. pos_body_end() 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. idx0 (int)

   4. Functions

        4.1. pos_append(idx, val)
        4.2. pos_insert(idx, val)
        4.3. pos_rm(idx, len)
        4.4. pos_headers_start()
        4.5. pos_headers_end()
        4.6. pos_body_start()
        4.7. pos_body_end()

1. Overview

   The module exports utility functions to work with position inside the
   SIP message buffer.

   Among them are function to add or remove content at a specific
   position.

2. Dependencies

   2.1. Kamailio Modules
   2.2. External Libraries or Applications

2.1. Kamailio Modules

   The following modules must be installed (but not loaded) to use this
   module:
     * none.

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. idx0 (int)

3.1. idx0 (int)

   The value to return by functions seeking a position when the index is 0
   (note: returning 0 is stopping the execution of configuration file like
   'exit', but for KEMI usage it is ok).

   Default value is -255.

   Example 1.1. Set idx0 parameter
...
modparam("posops", "idx0", -200)
...

4. Functions

   4.1. pos_append(idx, val)
   4.2. pos_insert(idx, val)
   4.3. pos_rm(idx, len)
   4.4. pos_headers_start()
   4.5. pos_headers_end()
   4.6. pos_body_start()
   4.7. pos_body_end()

4.1.  pos_append(idx, val)

   Append the value val after the position idx in the SIP message buffer.

   The idx can be an integer value or a variable holding an integer. If
   the value is negative, the position is counted from the end of the
   buffer.

   The val can be a static string or variables.

   This function can be used from ANY_ROUTE.

   Example 1.2. pos_append() usage
...
pos_append("100", "kamailio-$si");
...

4.2.  pos_insert(idx, val)

   Insert the value val at the position idx in the SIP message buffer.

   The idx can be an integer value or a variable holding an integer. If
   the value is negative, the position is counted from the end of the
   buffer.

   The val can be a static string or variables.

   This function can be used from ANY_ROUTE.

   Example 1.3. pos_insert() usage
...
pos_insert("100", "kamailio-$si");
...

4.3.  pos_rm(idx, len)

   Remove len characters starting at the position idx in the SIP message
   buffer.

   The idx can be an integer value or a variable holding an integer. If
   the value is negative, the position is counted from the end of the
   buffer.

   The idx can be a positive integer value or a variable holding a
   positive integer.

   This function can be used from ANY_ROUTE.

   Example 1.4. pos_rm() usage
...
pos_insert("100", "10");
...

4.4.  pos_headers_start()

   Return the position in the message buffer where headers start.

   This function can be used from ANY_ROUTE.

   Example 1.5. pos_headers_start() usage
...
$var(pos) = pos_headers_start();
...

4.5.  pos_headers_end()

   Return the position in the message buffer where headers end.

   This function can be used from ANY_ROUTE.

   Example 1.6. pos_headers_end() usage
...
$var(pos) = pos_headers_end();
...

4.6.  pos_body_start()

   Return the position in the message buffer where body starts.

   This function can be used from ANY_ROUTE.

   Example 1.7. pos_body_start() usage
...
$var(pos) = pos_body_start();
...

4.7.  pos_body_end()

   Return the position in the message buffer where body ends.

   This function can be used from ANY_ROUTE.

   Example 1.8. pos_body_end() usage
...
$var(pos) = pos_body_end();
...