|
@@ -26,7 +26,7 @@ Julien Chavanton
|
|
|
|
|
|
Copyright © 2010 Elena-Ramona Modroiu (asipto.com)
|
|
Copyright © 2010 Elena-Ramona Modroiu (asipto.com)
|
|
|
|
|
|
- Copyright © 2018 Julien chavanton, Flowroute
|
|
|
|
|
|
+ Copyright © 2018-2020 Julien chavanton, Flowroute
|
|
__________________________________________________________________
|
|
__________________________________________________________________
|
|
|
|
|
|
Table of Contents
|
|
Table of Contents
|
|
@@ -41,7 +41,8 @@ Julien Chavanton
|
|
|
|
|
|
3. Parameters
|
|
3. Parameters
|
|
|
|
|
|
- 3.1. mqueue (string)
|
|
|
|
|
|
+ 3.1. db_url (str)
|
|
|
|
+ 3.2. mqueue (string)
|
|
|
|
|
|
4. Functions
|
|
4. Functions
|
|
|
|
|
|
@@ -58,13 +59,14 @@ Julien Chavanton
|
|
|
|
|
|
List of Examples
|
|
List of Examples
|
|
|
|
|
|
- 1.1. Set mqueue parameter
|
|
|
|
- 1.2. mq_add usage
|
|
|
|
- 1.3. mq_fetch usage
|
|
|
|
- 1.4. mq_pv_free usage
|
|
|
|
- 1.5. mq_size usage
|
|
|
|
- 1.6. mqueue.get_size usage
|
|
|
|
- 1.7. mqueue.fetch usage
|
|
|
|
|
|
+ 1.1. Set db_url parameter
|
|
|
|
+ 1.2. Set mqueue parameter
|
|
|
|
+ 1.3. mq_add usage
|
|
|
|
+ 1.4. mq_fetch usage
|
|
|
|
+ 1.5. mq_pv_free usage
|
|
|
|
+ 1.6. mq_size usage
|
|
|
|
+ 1.7. mqueue.get_size usage
|
|
|
|
+ 1.8. mqueue.fetch usage
|
|
|
|
|
|
Chapter 1. Admin Guide
|
|
Chapter 1. Admin Guide
|
|
|
|
|
|
@@ -78,7 +80,8 @@ Chapter 1. Admin Guide
|
|
|
|
|
|
3. Parameters
|
|
3. Parameters
|
|
|
|
|
|
- 3.1. mqueue (string)
|
|
|
|
|
|
+ 3.1. db_url (str)
|
|
|
|
+ 3.2. mqueue (string)
|
|
|
|
|
|
4. Functions
|
|
4. Functions
|
|
|
|
|
|
@@ -122,9 +125,30 @@ Chapter 1. Admin Guide
|
|
|
|
|
|
3. Parameters
|
|
3. Parameters
|
|
|
|
|
|
- 3.1. mqueue (string)
|
|
|
|
|
|
+ 3.1. db_url (str)
|
|
|
|
+ 3.2. mqueue (string)
|
|
|
|
|
|
-3.1. mqueue (string)
|
|
|
|
|
|
+3.1. db_url (str)
|
|
|
|
+
|
|
|
|
+ The URL to connect to database for loading values in mqueue table at
|
|
|
|
+ start up and/or saving values at shutdown.
|
|
|
|
+
|
|
|
|
+ Default value is NULL (do not connect).
|
|
|
|
+
|
|
|
|
+ Example 1.1. Set db_url parameter
|
|
|
|
+...
|
|
|
|
+modparam("mqueue", "db_url", "mysql://kamailio:kamailiorw@localhost/kamailio")
|
|
|
|
+
|
|
|
|
+# Example of table in sqlite, you have the set the fields to support the length
|
|
|
|
+according to the data that will be present in the mqueue
|
|
|
|
+CREATE TABLE mqueue_name (
|
|
|
|
+id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
|
|
+key character varying(64) DEFAULT "" NOT NULL,
|
|
|
|
+val character varying(4096) DEFAULT "" NOT NULL
|
|
|
|
+);
|
|
|
|
+...
|
|
|
|
+
|
|
|
|
+3.2. mqueue (string)
|
|
|
|
|
|
Definition of a memory queue
|
|
Definition of a memory queue
|
|
|
|
|
|
@@ -137,11 +161,17 @@ Chapter 1. Admin Guide
|
|
+ size: size of the queue. Specifies the maximum number of items
|
|
+ size: size of the queue. Specifies the maximum number of items
|
|
in queue. If exceeded the oldest one is removed. If not set
|
|
in queue. If exceeded the oldest one is removed. If not set
|
|
the queue will be limitless.
|
|
the queue will be limitless.
|
|
|
|
+ + dbmode: If set to 1, the content of the queue is written to
|
|
|
|
+ database table when the SIP server is stopped (i.e., ensure
|
|
|
|
+ persistency over restarts). If set to 2, it is written at
|
|
|
|
+ shutdown but not read at startup. If set to 3, it is read at
|
|
|
|
+ sartup but not written at shutdown. Default value is 0 (no db
|
|
|
|
+ table interaction).
|
|
|
|
|
|
The parameter can be set many times, each holding the definition of one
|
|
The parameter can be set many times, each holding the definition of one
|
|
queue.
|
|
queue.
|
|
|
|
|
|
- Example 1.1. Set mqueue parameter
|
|
|
|
|
|
+ Example 1.2. Set mqueue parameter
|
|
...
|
|
...
|
|
modparam("mqueue", "mqueue", "name=myq;size=20;")
|
|
modparam("mqueue", "mqueue", "name=myq;size=20;")
|
|
modparam("mqueue", "mqueue", "name=qaz")
|
|
modparam("mqueue", "mqueue", "name=qaz")
|
|
@@ -159,7 +189,7 @@ modparam("mqueue", "mqueue", "name=qaz")
|
|
Add a new item (key, value) in the queue. If max size of queue is
|
|
Add a new item (key, value) in the queue. If max size of queue is
|
|
exceeded, the oldest one is removed.
|
|
exceeded, the oldest one is removed.
|
|
|
|
|
|
- Example 1.2. mq_add usage
|
|
|
|
|
|
+ Example 1.3. mq_add usage
|
|
...
|
|
...
|
|
mq_add("myq", "$rU", "call from $fU");
|
|
mq_add("myq", "$rU", "call from $fU");
|
|
...
|
|
...
|
|
@@ -172,7 +202,7 @@ mq_add("myq", "$rU", "call from $fU");
|
|
Return: true on success (1); false on failure (-1) or no item fetched
|
|
Return: true on success (1); false on failure (-1) or no item fetched
|
|
(-2).
|
|
(-2).
|
|
|
|
|
|
- Example 1.3. mq_fetch usage
|
|
|
|
|
|
+ Example 1.4. mq_fetch usage
|
|
...
|
|
...
|
|
while(mq_fetch("myq"))
|
|
while(mq_fetch("myq"))
|
|
{
|
|
{
|
|
@@ -185,7 +215,7 @@ while(mq_fetch("myq"))
|
|
Free the item fetched in pseudo-variables. It is optional, a new fetch
|
|
Free the item fetched in pseudo-variables. It is optional, a new fetch
|
|
frees the previous values.
|
|
frees the previous values.
|
|
|
|
|
|
- Example 1.4. mq_pv_free usage
|
|
|
|
|
|
+ Example 1.5. mq_pv_free usage
|
|
...
|
|
...
|
|
mq_pv_free("myq");
|
|
mq_pv_free("myq");
|
|
...
|
|
...
|
|
@@ -197,7 +227,7 @@ mq_pv_free("myq");
|
|
If the mqueue is empty, the function returns -1. If the mqueue is not
|
|
If the mqueue is empty, the function returns -1. If the mqueue is not
|
|
found, the function returns -2.
|
|
found, the function returns -2.
|
|
|
|
|
|
- Example 1.5. mq_size usage
|
|
|
|
|
|
+ Example 1.6. mq_size usage
|
|
...
|
|
...
|
|
$var(q_size) = mq_size("queue");
|
|
$var(q_size) = mq_size("queue");
|
|
xlog("L_INFO", "Size of queue is: $var(q_size)\n");
|
|
xlog("L_INFO", "Size of queue is: $var(q_size)\n");
|
|
@@ -226,7 +256,7 @@ xlog("L_INFO", "Size of queue is: $var(q_size)\n");
|
|
Parameters:
|
|
Parameters:
|
|
* name - the name of memory queue
|
|
* name - the name of memory queue
|
|
|
|
|
|
- Example 1.6. mqueue.get_size usage
|
|
|
|
|
|
+ Example 1.7. mqueue.get_size usage
|
|
...
|
|
...
|
|
kamcmd mqueue.get_size xyz
|
|
kamcmd mqueue.get_size xyz
|
|
...
|
|
...
|
|
@@ -238,7 +268,7 @@ kamcmd mqueue.get_size xyz
|
|
Parameters:
|
|
Parameters:
|
|
* name - the name of memory queue
|
|
* name - the name of memory queue
|
|
|
|
|
|
- Example 1.7. mqueue.fetch usage
|
|
|
|
|
|
+ Example 1.8. mqueue.fetch usage
|
|
...
|
|
...
|
|
kamcmd mqueue.fetch xyz
|
|
kamcmd mqueue.fetch xyz
|
|
...
|
|
...
|