Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
posops: new module with functions working with the position in messag…
…e buffer - add/remove content at a specific position in the sip message buffer
- Loading branch information
Showing
6 changed files
with
642 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# | ||
# posops module makefile | ||
# | ||
# | ||
# WARNING: do not run this directly, it should be run by the main Makefile | ||
|
||
include ../../Makefile.defs | ||
auto_gen= | ||
NAME=posops.so | ||
LIBS= | ||
|
||
include ../../Makefile.modules | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
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. Functions | ||
|
||
3.1. pos_append(idx, val) | ||
3.2. pos_insert(idx, val) | ||
3.3. pos_rm(idx, len) | ||
|
||
List of Examples | ||
|
||
1.1. pos_append() usage | ||
1.2. pos_insert() usage | ||
1.3. pos_rm() usage | ||
|
||
Chapter 1. Admin Guide | ||
|
||
Table of Contents | ||
|
||
1. Overview | ||
2. Dependencies | ||
|
||
2.1. Kamailio Modules | ||
2.2. External Libraries or Applications | ||
|
||
3. Functions | ||
|
||
3.1. pos_append(idx, val) | ||
3.2. pos_insert(idx, val) | ||
3.3. pos_rm(idx, len) | ||
|
||
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. Functions | ||
|
||
3.1. pos_append(idx, val) | ||
3.2. pos_insert(idx, val) | ||
3.3. pos_rm(idx, len) | ||
|
||
3.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.1. pos_append() usage | ||
... | ||
pos_append("100", "kamailio-$si"); | ||
... | ||
|
||
3.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.2. pos_insert() usage | ||
... | ||
pos_insert("100", "kamailio-$si"); | ||
... | ||
|
||
3.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.3. pos_rm() usage | ||
... | ||
pos_insert("100", "10"); | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
docs = posops.xml | ||
|
||
docbook_dir = ../../../../doc/docbook | ||
include $(docbook_dir)/Makefile.module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0" encoding='ISO-8859-1'?> | ||
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" | ||
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ | ||
|
||
<!-- Include general documentation entities --> | ||
<!ENTITY % docentities SYSTEM "../../../../doc/docbook/entities.xml"> | ||
%docentities; | ||
|
||
]> | ||
|
||
<book xmlns:xi="http://www.w3.org/2001/XInclude"> | ||
<bookinfo> | ||
<title>POSOPS Module</title> | ||
<productname class="trade">&kamailioname;</productname> | ||
<authorgroup> | ||
<author> | ||
<firstname>Daniel-Constantin</firstname> | ||
<surname>Mierla</surname> | ||
<affiliation><orgname>asipto.com</orgname></affiliation> | ||
<email>miconda@gmail.com</email> | ||
<address> | ||
<otheraddr> | ||
<ulink url="http://www.asipto.com">http://www.asipto.com</ulink> | ||
</otheraddr> | ||
</address> | ||
</author> | ||
<editor> | ||
<firstname>Daniel-Constantin</firstname> | ||
<surname>Mierla</surname> | ||
<email>miconda@gmail.com</email> | ||
</editor> | ||
</authorgroup> | ||
<copyright> | ||
<year>2021</year> | ||
<holder>http://www.asipto.com</holder> | ||
</copyright> | ||
</bookinfo> | ||
<toc></toc> | ||
|
||
<xi:include href="posops_admin.xml"/> | ||
|
||
</book> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
<?xml version="1.0" encoding='ISO-8859-1'?> | ||
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" | ||
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ | ||
|
||
<!-- Include general documentation entities --> | ||
<!ENTITY % docentities SYSTEM "../../../../doc/docbook/entities.xml"> | ||
%docentities; | ||
|
||
]> | ||
<!-- Module User's Guide --> | ||
|
||
<chapter> | ||
|
||
<title>&adminguide;</title> | ||
|
||
<section> | ||
<title>Overview</title> | ||
<para> | ||
The module exports utility functions to work with position inside the | ||
SIP message buffer. | ||
</para> | ||
<para> | ||
Among them are function to add or remove content at a specific position. | ||
</para> | ||
</section> | ||
<section> | ||
<title>Dependencies</title> | ||
<section> | ||
<title>&kamailio; Modules</title> | ||
<para> | ||
The following modules must be installed (but not loaded) to use this module: | ||
<itemizedlist> | ||
<listitem> | ||
<para> | ||
<emphasis>none</emphasis>. | ||
</para> | ||
</listitem> | ||
</itemizedlist> | ||
</para> | ||
</section> | ||
<section> | ||
<title>External Libraries or Applications</title> | ||
<para> | ||
The following libraries or applications must be installed before running | ||
&kamailio; with this module loaded: | ||
<itemizedlist> | ||
<listitem> | ||
<para> | ||
<emphasis>none</emphasis>. | ||
</para> | ||
</listitem> | ||
</itemizedlist> | ||
</para> | ||
</section> | ||
</section> | ||
|
||
<section> | ||
<title>Functions</title> | ||
<section id="posops.f.pos_append"> | ||
<title> | ||
<function moreinfo="none">pos_append(idx, val)</function> | ||
</title> | ||
<para> | ||
Append the value val after the position idx in the SIP message buffer. | ||
</para> | ||
<para> | ||
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. | ||
</para> | ||
<para> | ||
The val can be a static string or variables. | ||
</para> | ||
<para> | ||
This function can be used from ANY_ROUTE. | ||
</para> | ||
<example> | ||
<title><function>pos_append()</function> usage</title> | ||
<programlisting format="linespecific"> | ||
... | ||
pos_append("100", "kamailio-$si"); | ||
... | ||
</programlisting> | ||
</example> | ||
</section> | ||
<section id="posops.f.pos_insert"> | ||
<title> | ||
<function moreinfo="none">pos_insert(idx, val)</function> | ||
</title> | ||
<para> | ||
Insert the value val at the position idx in the SIP message buffer. | ||
</para> | ||
<para> | ||
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. | ||
</para> | ||
<para> | ||
The val can be a static string or variables. | ||
</para> | ||
<para> | ||
This function can be used from ANY_ROUTE. | ||
</para> | ||
<example> | ||
<title><function>pos_insert()</function> usage</title> | ||
<programlisting format="linespecific"> | ||
... | ||
pos_insert("100", "kamailio-$si"); | ||
... | ||
</programlisting> | ||
</example> | ||
</section> | ||
<section id="posops.f.pos_rm"> | ||
<title> | ||
<function moreinfo="none">pos_rm(idx, len)</function> | ||
</title> | ||
<para> | ||
Remove len characters starting at the position idx in the SIP message buffer. | ||
</para> | ||
<para> | ||
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. | ||
</para> | ||
<para> | ||
The idx can be a positive integer value or a variable holding a positive | ||
integer. | ||
</para> | ||
<para> | ||
This function can be used from ANY_ROUTE. | ||
</para> | ||
<example> | ||
<title><function>pos_rm()</function> usage</title> | ||
<programlisting format="linespecific"> | ||
... | ||
pos_insert("100", "10"); | ||
... | ||
</programlisting> | ||
</example> | ||
</section> | ||
</section> | ||
|
||
</chapter> | ||
|
Oops, something went wrong.