-
Notifications
You must be signed in to change notification settings - Fork 908
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
math: new module to collect math functions
- Loading branch information
Showing
6 changed files
with
416 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,9 @@ | ||
# | ||
# WARNING: do not run this directly, it should be run by the main Makefile | ||
|
||
include ../../Makefile.defs | ||
auto_gen= | ||
NAME=math.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,106 @@ | ||
MATH Module | ||
|
||
Daniel-Constantin Mierla | ||
|
||
<miconda@gmail.com> | ||
|
||
Edited by | ||
|
||
Daniel-Constantin Mierla | ||
|
||
<miconda@gmail.com> | ||
|
||
Copyright � 2023 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. pow(base, power, res) | ||
3.2. log(x, res) | ||
|
||
List of Examples | ||
|
||
1.1. pow usage | ||
1.2. log 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. pow(base, power, res) | ||
3.2. log(x, res) | ||
|
||
1. Overview | ||
|
||
This module provides a collection of functions for math operations. | ||
|
||
Note that the result values are casted to intger (long value), being | ||
the type supported by the config variables. | ||
|
||
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: | ||
* 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. pow(base, power, res) | ||
3.2. log(x, res) | ||
|
||
3.1. pow(base, power, res) | ||
|
||
The exponentiation function, computing the base raised to power, | ||
storing in res. | ||
|
||
This function can be used from ANY_ROUTE. | ||
|
||
Example 1.1. pow usage | ||
... | ||
pow("2", "10", "$var(res)"); | ||
$var(base) = 2; | ||
$var(power) = 10; | ||
pow("$var(base)", "$var(power)", "$var(res)"); | ||
... | ||
|
||
3.2. log(x, res) | ||
|
||
The function computes the natural logarithm of x and stores the result | ||
in res. | ||
|
||
This function can be used from ANY_ROUTE. | ||
|
||
Example 1.2. log usage | ||
... | ||
log("10", "$var(res)"); | ||
$var(x) = 10; | ||
pow("$var(x)", "$var(res)"); | ||
... |
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 = math.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,36 @@ | ||
<?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> | ||
<bookinfo> | ||
<title>MATH Module</title> | ||
<productname class="trade">kamailio.org</productname> | ||
<authorgroup> | ||
<author> | ||
<firstname>Daniel-Constantin</firstname> | ||
<surname>Mierla</surname> | ||
<email>miconda@gmail.com</email> | ||
</author> | ||
<editor> | ||
<firstname>Daniel-Constantin</firstname> | ||
<surname>Mierla</surname> | ||
<email>miconda@gmail.com</email> | ||
</editor> | ||
</authorgroup> | ||
<copyright> | ||
<year>2023</year> | ||
<holder>asipto.com</holder> | ||
</copyright> | ||
</bookinfo> | ||
<toc></toc> | ||
|
||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="math_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,106 @@ | ||
<?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> | ||
This module provides a collection of functions for math operations. | ||
</para> | ||
<para> | ||
Note that the result values are casted to intger (long value), being | ||
the type supported by the config variables. | ||
</para> | ||
</section> | ||
|
||
<section> | ||
<title>Dependencies</title> | ||
<section> | ||
<title>&kamailio; Modules</title> | ||
<para> | ||
The following modules must be loaded before 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="math.f.pow"> | ||
<title> | ||
<function moreinfo="none">pow(base, power, res)</function> | ||
</title> | ||
<para> | ||
The exponentiation function, computing the base raised to power, storing | ||
in res. | ||
</para> | ||
<para> | ||
This function can be used from ANY_ROUTE. | ||
</para> | ||
<example> | ||
<title><function>pow</function> usage</title> | ||
<programlisting format="linespecific"> | ||
... | ||
pow("2", "10", "$var(res)"); | ||
$var(base) = 2; | ||
$var(power) = 10; | ||
pow("$var(base)", "$var(power)", "$var(res)"); | ||
... | ||
</programlisting> | ||
</example> | ||
</section> | ||
<section id="math.f.log"> | ||
<title> | ||
<function moreinfo="none">log(x, res)</function> | ||
</title> | ||
<para> | ||
The function computes the natural logarithm of x and stores the result | ||
in res. | ||
</para> | ||
<para> | ||
This function can be used from ANY_ROUTE. | ||
</para> | ||
<example> | ||
<title><function>log</function> usage</title> | ||
<programlisting format="linespecific"> | ||
... | ||
log("10", "$var(res)"); | ||
$var(x) = 10; | ||
pow("$var(x)", "$var(res)"); | ||
... | ||
</programlisting> | ||
</example> | ||
</section> | ||
</section> | ||
</chapter> |
Oops, something went wrong.