... | ... |
@@ -26,7 +26,7 @@ Julien Chavanton |
26 | 26 |
|
27 | 27 |
Copyright © 2010 Elena-Ramona Modroiu (asipto.com) |
28 | 28 |
|
29 |
- Copyright © 2018 Julien chavanton, Flowroute |
|
29 |
+ Copyright © 2018-2020 Julien chavanton, Flowroute |
|
30 | 30 |
__________________________________________________________________ |
31 | 31 |
|
32 | 32 |
Table of Contents |
... | ... |
@@ -41,7 +41,8 @@ Julien Chavanton |
41 | 41 |
|
42 | 42 |
3. Parameters |
43 | 43 |
|
44 |
- 3.1. mqueue (string) |
|
44 |
+ 3.1. db_url (str) |
|
45 |
+ 3.2. mqueue (string) |
|
45 | 46 |
|
46 | 47 |
4. Functions |
47 | 48 |
|
... | ... |
@@ -58,13 +59,14 @@ Julien Chavanton |
58 | 59 |
|
59 | 60 |
List of Examples |
60 | 61 |
|
61 |
- 1.1. Set mqueue parameter |
|
62 |
- 1.2. mq_add usage |
|
63 |
- 1.3. mq_fetch usage |
|
64 |
- 1.4. mq_pv_free usage |
|
65 |
- 1.5. mq_size usage |
|
66 |
- 1.6. mqueue.get_size usage |
|
67 |
- 1.7. mqueue.fetch usage |
|
62 |
+ 1.1. Set db_url parameter |
|
63 |
+ 1.2. Set mqueue parameter |
|
64 |
+ 1.3. mq_add usage |
|
65 |
+ 1.4. mq_fetch usage |
|
66 |
+ 1.5. mq_pv_free usage |
|
67 |
+ 1.6. mq_size usage |
|
68 |
+ 1.7. mqueue.get_size usage |
|
69 |
+ 1.8. mqueue.fetch usage |
|
68 | 70 |
|
69 | 71 |
Chapter 1. Admin Guide |
70 | 72 |
|
... | ... |
@@ -78,7 +80,8 @@ Chapter 1. Admin Guide |
78 | 80 |
|
79 | 81 |
3. Parameters |
80 | 82 |
|
81 |
- 3.1. mqueue (string) |
|
83 |
+ 3.1. db_url (str) |
|
84 |
+ 3.2. mqueue (string) |
|
82 | 85 |
|
83 | 86 |
4. Functions |
84 | 87 |
|
... | ... |
@@ -122,9 +125,30 @@ Chapter 1. Admin Guide |
122 | 125 |
|
123 | 126 |
3. Parameters |
124 | 127 |
|
125 |
- 3.1. mqueue (string) |
|
128 |
+ 3.1. db_url (str) |
|
129 |
+ 3.2. mqueue (string) |
|
126 | 130 |
|
127 |
-3.1. mqueue (string) |
|
131 |
+3.1. db_url (str) |
|
132 |
+ |
|
133 |
+ The URL to connect to database for loading values in mqueue table at |
|
134 |
+ start up and/or saving values at shutdown. |
|
135 |
+ |
|
136 |
+ Default value is NULL (do not connect). |
|
137 |
+ |
|
138 |
+ Example 1.1. Set db_url parameter |
|
139 |
+... |
|
140 |
+modparam("mqueue", "db_url", "mysql://kamailio:kamailiorw@localhost/kamailio") |
|
141 |
+ |
|
142 |
+# Example of table in sqlite, you have the set the fields to support the length |
|
143 |
+according to the data that will be present in the mqueue |
|
144 |
+CREATE TABLE mqueue_name ( |
|
145 |
+id INTEGER PRIMARY KEY AUTOINCREMENT, |
|
146 |
+key character varying(64) DEFAULT "" NOT NULL, |
|
147 |
+val character varying(4096) DEFAULT "" NOT NULL |
|
148 |
+); |
|
149 |
+... |
|
150 |
+ |
|
151 |
+3.2. mqueue (string) |
|
128 | 152 |
|
129 | 153 |
Definition of a memory queue |
130 | 154 |
|
... | ... |
@@ -137,11 +161,17 @@ Chapter 1. Admin Guide |
137 | 161 |
+ size: size of the queue. Specifies the maximum number of items |
138 | 162 |
in queue. If exceeded the oldest one is removed. If not set |
139 | 163 |
the queue will be limitless. |
164 |
+ + dbmode: If set to 1, the content of the queue is written to |
|
165 |
+ database table when the SIP server is stopped (i.e., ensure |
|
166 |
+ persistency over restarts). If set to 2, it is written at |
|
167 |
+ shutdown but not read at startup. If set to 3, it is read at |
|
168 |
+ sartup but not written at shutdown. Default value is 0 (no db |
|
169 |
+ table interaction). |
|
140 | 170 |
|
141 | 171 |
The parameter can be set many times, each holding the definition of one |
142 | 172 |
queue. |
143 | 173 |
|
144 |
- Example 1.1. Set mqueue parameter |
|
174 |
+ Example 1.2. Set mqueue parameter |
|
145 | 175 |
... |
146 | 176 |
modparam("mqueue", "mqueue", "name=myq;size=20;") |
147 | 177 |
modparam("mqueue", "mqueue", "name=qaz") |
... | ... |
@@ -159,7 +189,7 @@ modparam("mqueue", "mqueue", "name=qaz") |
159 | 189 |
Add a new item (key, value) in the queue. If max size of queue is |
160 | 190 |
exceeded, the oldest one is removed. |
161 | 191 |
|
162 |
- Example 1.2. mq_add usage |
|
192 |
+ Example 1.3. mq_add usage |
|
163 | 193 |
... |
164 | 194 |
mq_add("myq", "$rU", "call from $fU"); |
165 | 195 |
... |
... | ... |
@@ -172,7 +202,7 @@ mq_add("myq", "$rU", "call from $fU"); |
172 | 202 |
Return: true on success (1); false on failure (-1) or no item fetched |
173 | 203 |
(-2). |
174 | 204 |
|
175 |
- Example 1.3. mq_fetch usage |
|
205 |
+ Example 1.4. mq_fetch usage |
|
176 | 206 |
... |
177 | 207 |
while(mq_fetch("myq")) |
178 | 208 |
{ |
... | ... |
@@ -185,7 +215,7 @@ while(mq_fetch("myq")) |
185 | 215 |
Free the item fetched in pseudo-variables. It is optional, a new fetch |
186 | 216 |
frees the previous values. |
187 | 217 |
|
188 |
- Example 1.4. mq_pv_free usage |
|
218 |
+ Example 1.5. mq_pv_free usage |
|
189 | 219 |
... |
190 | 220 |
mq_pv_free("myq"); |
191 | 221 |
... |
... | ... |
@@ -197,7 +227,7 @@ mq_pv_free("myq"); |
197 | 227 |
If the mqueue is empty, the function returns -1. If the mqueue is not |
198 | 228 |
found, the function returns -2. |
199 | 229 |
|
200 |
- Example 1.5. mq_size usage |
|
230 |
+ Example 1.6. mq_size usage |
|
201 | 231 |
... |
202 | 232 |
$var(q_size) = mq_size("queue"); |
203 | 233 |
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"); |
226 | 256 |
Parameters: |
227 | 257 |
* name - the name of memory queue |
228 | 258 |
|
229 |
- Example 1.6. mqueue.get_size usage |
|
259 |
+ Example 1.7. mqueue.get_size usage |
|
230 | 260 |
... |
231 | 261 |
kamcmd mqueue.get_size xyz |
232 | 262 |
... |
... | ... |
@@ -238,7 +268,7 @@ kamcmd mqueue.get_size xyz |
238 | 268 |
Parameters: |
239 | 269 |
* name - the name of memory queue |
240 | 270 |
|
241 |
- Example 1.7. mqueue.fetch usage |
|
271 |
+ Example 1.8. mqueue.fetch usage |
|
242 | 272 |
... |
243 | 273 |
kamcmd mqueue.fetch xyz |
244 | 274 |
... |