Browse code

modules: readme files regenerated - db_text ... [skip ci]

Kamailio Dev authored on 28/07/2019 19:46:42
Showing 1 changed files
... ...
@@ -10,14 +10,10 @@ Ovidiu Sas
10 10
 
11 11
    <osas@voipembedded.com>
12 12
 
13
-Edited by
14
-
15 13
 Daniel-Constantin Mierla
16 14
 
17 15
    <miconda@gmail.com>
18 16
 
19
-Edited by
20
-
21 17
 Olle E. Johansson
22 18
 
23 19
    <oej@edvina.net>
... ...
@@ -355,7 +351,7 @@ modparam("module_name", "db_url", "text:///path/to/dbtext/database")
355 351
    Here are definitions for the most important tables as well as a basic
356 352
    configuration file to use db_text with Kamailio. The table structures
357 353
    may change in time and you will have to adjust these examples. Check
358
-   the source code directory “utils/kamctl/dbtxt/kamailio” for current
354
+   the source code directory “utils/kamctl/dbtext/kamailio” for current
359 355
    definitions.
360 356
 
361 357
    You have to populate the table 'subscriber' by hand with user profiles
Browse code

modules: readme files regenerated - db_text ... [skip ci]

Kamailio Dev authored on 15/05/2019 14:32:26
Showing 1 changed files
... ...
@@ -47,6 +47,7 @@ Olle E. Johansson
47 47
               4.3. default_connection (string)
48 48
               4.4. emptystring (integer)
49 49
               4.5. file_buffer_size (integer)
50
+              4.6. max_result_rows (integer)
50 51
 
51 52
         5. Exported RPC Functions
52 53
 
... ...
@@ -69,11 +70,12 @@ Olle E. Johansson
69 70
    1.6. Set default_connection parameter
70 71
    1.7. Set emptystring parameter
71 72
    1.8. Set file_buffer_size parameter
72
-   1.9. Load the dbtext module
73
-   1.10. Definition of 'subscriber' table (one line)
74
-   1.11. Definition of 'location' and 'aliases' tables (one line)
75
-   1.12. Definition of 'version' table and sample records
76
-   1.13. Configuration file
73
+   1.9. Set max_result_rows parameter
74
+   1.10. Load the dbtext module
75
+   1.11. Definition of 'subscriber' table (one line)
76
+   1.12. Definition of 'location' and 'aliases' tables (one line)
77
+   1.13. Definition of 'version' table and sample records
78
+   1.14. Configuration file
77 79
 
78 80
 Chapter 1. Admin Guide
79 81
 
... ...
@@ -97,6 +99,7 @@ Chapter 1. Admin Guide
97 99
         4.3. default_connection (string)
98 100
         4.4. emptystring (integer)
99 101
         4.5. file_buffer_size (integer)
102
+        4.6. max_result_rows (integer)
100 103
 
101 104
    5. Exported RPC Functions
102 105
 
... ...
@@ -224,6 +227,7 @@ suser:supasswd:xxx:alpha.org:xxx
224 227
    4.3. default_connection (string)
225 228
    4.4. emptystring (integer)
226 229
    4.5. file_buffer_size (integer)
230
+   4.6. max_result_rows (integer)
227 231
 
228 232
 4.1. db_mode (integer)
229 233
 
... ...
@@ -281,13 +285,24 @@ modparam("db_text", "emptystring", 1)
281 285
    size of the buffer used to read the text file. Some presence tables
282 286
    have columns with large content.
283 287
 
284
-   Default value is “16384” (off).
288
+   Default value is “16384”.
285 289
 
286 290
    Example 1.8. Set file_buffer_size parameter
287 291
 ...
288 292
 modparam("db_text", "file_buffer_size", 8192)
289 293
 ...
290 294
 
295
+4.6. max_result_rows (integer)
296
+
297
+   number of rows to read from the text file.
298
+
299
+   Default value is “100000”.
300
+
301
+   Example 1.9. Set max_result_rows parameter
302
+...
303
+modparam("db_text", "max_result_rows", 1000000)
304
+...
305
+
291 306
 5. Exported RPC Functions
292 307
 
293 308
    5.1. db_text.dump
... ...
@@ -328,7 +343,7 @@ modparam("db_text", "file_buffer_size", 8192)
328 343
    database path. So, either you provide an absolute path to database
329 344
    directory or a relative one to “CFG_DIR” directory.
330 345
 
331
-   Example 1.9. Load the dbtext module
346
+   Example 1.10. Load the dbtext module
332 347
 ...
333 348
 loadmodule "/path/to/kamailio/modules_k/db_text.so"
334 349
 ...
... ...
@@ -347,7 +362,7 @@ modparam("module_name", "db_url", "text:///path/to/dbtext/database")
347 362
    in order to have authentication. To use with the given configuration
348 363
    file, the table files must be placed in the '/tmp/serdb' directory.
349 364
 
350
-   Example 1.10. Definition of 'subscriber' table (one line)
365
+   Example 1.11. Definition of 'subscriber' table (one line)
351 366
 ...
352 367
 username(str) domain(str) password(str) first_name(str) last_name(str) phone(str
353 368
 ) email_address(str) datetime_created(int) datetime_modified(int) confirmation(s
... ...
@@ -355,14 +370,14 @@ tr) flag(str) sendnotification(str) greeting(str) ha1(str) ha1b(str) perms(str)
355 370
 allow_find(str) timezone(str,null) rpid(str,null)
356 371
 ...
357 372
 
358
-   Example 1.11. Definition of 'location' and 'aliases' tables (one line)
373
+   Example 1.12. Definition of 'location' and 'aliases' tables (one line)
359 374
 ...
360 375
 username(str) domain(str,null) contact(str,null) received(str) expires(int,null)
361 376
  q(double,null) callid(str,null) cseq(int,null) last_modified(str) flags(int) us
362 377
 er_agent(str) socket(str)
363 378
 ...
364 379
 
365
-   Example 1.12. Definition of 'version' table and sample records
380
+   Example 1.13. Definition of 'version' table and sample records
366 381
 ...
367 382
 table_name(str) table_version(int)
368 383
 subscriber:3
... ...
@@ -370,7 +385,7 @@ location:6
370 385
 aliases:6
371 386
 ...
372 387
 
373
-   Example 1.13. Configuration file
388
+   Example 1.14. Configuration file
374 389
 ...
375 390
 #
376 391
 #
Browse code

modules: readme files regenerated - acc ... [skip ci]

Kamailio Dev authored on 30/03/2018 19:48:36
Showing 1 changed files
... ...
@@ -373,14 +373,13 @@ aliases:6
373 373
    Example 1.13. Configuration file
374 374
 ...
375 375
 #
376
-# $Id$
377 376
 #
378 377
 # simple quick-start config script with dbtext
379 378
 #
380 379
 
381 380
 # ----------- global configuration parameters ------------------------
382 381
 
383
-#debug=9         # debug level (cmd line: -dddddddddd)
382
+#debug=3         # debug level (cmd line: -ddd)
384 383
 #fork=yes
385 384
 #log_stderror=no        # (cmd line: -E)
386 385
 
... ...
@@ -404,7 +403,7 @@ loadmodule "modules/maxfwd/maxfwd.so"
404 403
 loadmodule "modules/usrloc/usrloc.so"
405 404
 loadmodule "modules/registrar/registrar.so"
406 405
 loadmodule "modules/textops/textops.so"
407
-loadmodule "modules/textops/mi_fifo.so"
406
+loadmodule "modules/jonrpcs/jsonrpcs.so"
408 407
 
409 408
 # modules for digest authentication
410 409
 loadmodule "modules/auth/auth.so"
... ...
@@ -412,15 +411,11 @@ loadmodule "modules/auth_db/auth_db.so"
412 411
 
413 412
 # ----------------- setting module-specific parameters ---------------
414 413
 
415
-# -- mi_fifo params --
416
-
417
-modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")
418
-
419 414
 # -- usrloc params --
420 415
 
421 416
 # use dbtext database for persistent storage
422 417
 modparam("usrloc", "db_mode", 2)
423
-modparam("usrloc|auth_db", "db_url", "dbtext:///tmp/openserdb")
418
+modparam("usrloc|auth_db", "db_url", "db_text:///tmp/kamailiodb")
424 419
 
425 420
 # -- auth params --
426 421
 #
Browse code

modules: readme files regenerated - db_text ... [skip ci]

Kamailio Dev authored on 09/05/2017 12:46:26
Showing 1 changed files
... ...
@@ -43,9 +43,10 @@ Olle E. Johansson
43 43
         4. Parameters
44 44
 
45 45
               4.1. db_mode (integer)
46
-              4.2. default_connection (string)
47
-              4.3. emptystring (integer)
48
-              4.4. file_buffer_size (integer)
46
+              4.2. db_delim (string)
47
+              4.3. default_connection (string)
48
+              4.4. emptystring (integer)
49
+              4.5. file_buffer_size (integer)
49 50
 
50 51
         5. Exported RPC Functions
51 52
 
... ...
@@ -64,14 +65,15 @@ Olle E. Johansson
64 65
    1.2. Minimal Kamailio location dbtext table definition
65 66
    1.3. Minimal Kamailio subscriber dbtext table example
66 67
    1.4. Set db_mode parameter
67
-   1.5. Set default_connection parameter
68
-   1.6. Set emptystring parameter
69
-   1.7. Set file_buffer_size parameter
70
-   1.8. Load the dbtext module
71
-   1.9. Definition of 'subscriber' table (one line)
72
-   1.10. Definition of 'location' and 'aliases' tables (one line)
73
-   1.11. Definition of 'version' table and sample records
74
-   1.12. Configuration file
68
+   1.5. Set db_mode parameter
69
+   1.6. Set default_connection parameter
70
+   1.7. Set emptystring parameter
71
+   1.8. Set file_buffer_size parameter
72
+   1.9. Load the dbtext module
73
+   1.10. Definition of 'subscriber' table (one line)
74
+   1.11. Definition of 'location' and 'aliases' tables (one line)
75
+   1.12. Definition of 'version' table and sample records
76
+   1.13. Configuration file
75 77
 
76 78
 Chapter 1. Admin Guide
77 79
 
... ...
@@ -91,9 +93,10 @@ Chapter 1. Admin Guide
91 93
    4. Parameters
92 94
 
93 95
         4.1. db_mode (integer)
94
-        4.2. default_connection (string)
95
-        4.3. emptystring (integer)
96
-        4.4. file_buffer_size (integer)
96
+        4.2. db_delim (string)
97
+        4.3. default_connection (string)
98
+        4.4. emptystring (integer)
99
+        4.5. file_buffer_size (integer)
97 100
 
98 101
    5. Exported RPC Functions
99 102
 
... ...
@@ -217,9 +220,10 @@ suser:supasswd:xxx:alpha.org:xxx
217 220
 4. Parameters
218 221
 
219 222
    4.1. db_mode (integer)
220
-   4.2. default_connection (string)
221
-   4.3. emptystring (integer)
222
-   4.4. file_buffer_size (integer)
223
+   4.2. db_delim (string)
224
+   4.3. default_connection (string)
225
+   4.4. emptystring (integer)
226
+   4.5. file_buffer_size (integer)
223 227
 
224 228
 4.1. db_mode (integer)
225 229
 
... ...
@@ -235,19 +239,30 @@ suser:supasswd:xxx:alpha.org:xxx
235 239
 modparam("db_text", "db_mode", 1)
236 240
 ...
237 241
 
238
-4.2. default_connection (string)
242
+4.2. db_delim (string)
243
+
244
+   Set the delimiter inside the db_text file.
245
+
246
+   Default value is “:”.
247
+
248
+   Example 1.5. Set db_mode parameter
249
+...
250
+modparam("db_text", "db_delim", "|")
251
+...
252
+
253
+4.3. default_connection (string)
239 254
 
240 255
    connection for use with rpc query command.
241 256
 
242 257
    Default value is “none” (off).
243 258
 
244
-   Example 1.5. Set default_connection parameter
259
+   Example 1.6. Set default_connection parameter
245 260
                     ...
246 261
                     modparam("db_text", "default_connection", "text:///var/db/ka
247 262
 mailio/dbtext")
248 263
                     ...
249 264
 
250
-4.3. emptystring (integer)
265
+4.4. emptystring (integer)
251 266
 
252 267
    db_text by default handles an empty string as a NULL value. Some
253 268
    modules, like the dialplan module, does not accept NULL strings. If you
... ...
@@ -256,19 +271,19 @@ mailio/dbtext")
256 271
 
257 272
    Default value is “0” (off).
258 273
 
259
-   Example 1.6. Set emptystring parameter
274
+   Example 1.7. Set emptystring parameter
260 275
 ...
261 276
 modparam("db_text", "emptystring", 1)
262 277
 ...
263 278
 
264
-4.4. file_buffer_size (integer)
279
+4.5. file_buffer_size (integer)
265 280
 
266 281
    size of the buffer used to read the text file. Some presence tables
267 282
    have columns with large content.
268 283
 
269 284
    Default value is “16384” (off).
270 285
 
271
-   Example 1.7. Set file_buffer_size parameter
286
+   Example 1.8. Set file_buffer_size parameter
272 287
 ...
273 288
 modparam("db_text", "file_buffer_size", 8192)
274 289
 ...
... ...
@@ -313,7 +328,7 @@ modparam("db_text", "file_buffer_size", 8192)
313 328
    database path. So, either you provide an absolute path to database
314 329
    directory or a relative one to “CFG_DIR” directory.
315 330
 
316
-   Example 1.8. Load the dbtext module
331
+   Example 1.9. Load the dbtext module
317 332
 ...
318 333
 loadmodule "/path/to/kamailio/modules_k/db_text.so"
319 334
 ...
... ...
@@ -332,7 +347,7 @@ modparam("module_name", "db_url", "text:///path/to/dbtext/database")
332 347
    in order to have authentication. To use with the given configuration
333 348
    file, the table files must be placed in the '/tmp/serdb' directory.
334 349
 
335
-   Example 1.9. Definition of 'subscriber' table (one line)
350
+   Example 1.10. Definition of 'subscriber' table (one line)
336 351
 ...
337 352
 username(str) domain(str) password(str) first_name(str) last_name(str) phone(str
338 353
 ) email_address(str) datetime_created(int) datetime_modified(int) confirmation(s
... ...
@@ -340,14 +355,14 @@ tr) flag(str) sendnotification(str) greeting(str) ha1(str) ha1b(str) perms(str)
340 355
 allow_find(str) timezone(str,null) rpid(str,null)
341 356
 ...
342 357
 
343
-   Example 1.10. Definition of 'location' and 'aliases' tables (one line)
358
+   Example 1.11. Definition of 'location' and 'aliases' tables (one line)
344 359
 ...
345 360
 username(str) domain(str,null) contact(str,null) received(str) expires(int,null)
346 361
  q(double,null) callid(str,null) cseq(int,null) last_modified(str) flags(int) us
347 362
 er_agent(str) socket(str)
348 363
 ...
349 364
 
350
-   Example 1.11. Definition of 'version' table and sample records
365
+   Example 1.12. Definition of 'version' table and sample records
351 366
 ...
352 367
 table_name(str) table_version(int)
353 368
 subscriber:3
... ...
@@ -355,7 +370,7 @@ location:6
355 370
 aliases:6
356 371
 ...
357 372
 
358
-   Example 1.12. Configuration file
373
+   Example 1.13. Configuration file
359 374
 ...
360 375
 #
361 376
 # $Id$
Browse code

modules: readme files regenerated - db_text ... [skip ci]

Kamailio Dev authored on 09/03/2017 11:46:25
Showing 1 changed files
... ...
@@ -43,12 +43,14 @@ Olle E. Johansson
43 43
         4. Parameters
44 44
 
45 45
               4.1. db_mode (integer)
46
-              4.2. emptystring (integer)
47
-              4.3. file_buffer_size (integer)
46
+              4.2. default_connection (string)
47
+              4.3. emptystring (integer)
48
+              4.4. file_buffer_size (integer)
48 49
 
49 50
         5. Exported RPC Functions
50 51
 
51 52
               5.1. db_text.dump
53
+              5.2. db_text.query
52 54
 
53 55
         6. Installation and Running
54 56
 
... ...
@@ -62,13 +64,14 @@ Olle E. Johansson
62 64
    1.2. Minimal Kamailio location dbtext table definition
63 65
    1.3. Minimal Kamailio subscriber dbtext table example
64 66
    1.4. Set db_mode parameter
65
-   1.5. Set emptystring parameter
66
-   1.6. Set file_buffer_size parameter
67
-   1.7. Load the dbtext module
68
-   1.8. Definition of 'subscriber' table (one line)
69
-   1.9. Definition of 'location' and 'aliases' tables (one line)
70
-   1.10. Definition of 'version' table and sample records
71
-   1.11. Configuration file
67
+   1.5. Set default_connection parameter
68
+   1.6. Set emptystring parameter
69
+   1.7. Set file_buffer_size parameter
70
+   1.8. Load the dbtext module
71
+   1.9. Definition of 'subscriber' table (one line)
72
+   1.10. Definition of 'location' and 'aliases' tables (one line)
73
+   1.11. Definition of 'version' table and sample records
74
+   1.12. Configuration file
72 75
 
73 76
 Chapter 1. Admin Guide
74 77
 
... ...
@@ -88,12 +91,14 @@ Chapter 1. Admin Guide
88 91
    4. Parameters
89 92
 
90 93
         4.1. db_mode (integer)
91
-        4.2. emptystring (integer)
92
-        4.3. file_buffer_size (integer)
94
+        4.2. default_connection (string)
95
+        4.3. emptystring (integer)
96
+        4.4. file_buffer_size (integer)
93 97
 
94 98
    5. Exported RPC Functions
95 99
 
96 100
         5.1. db_text.dump
101
+        5.2. db_text.query
97 102
 
98 103
    6. Installation and Running
99 104
 
... ...
@@ -212,8 +217,9 @@ suser:supasswd:xxx:alpha.org:xxx
212 217
 4. Parameters
213 218
 
214 219
    4.1. db_mode (integer)
215
-   4.2. emptystring (integer)
216
-   4.3. file_buffer_size (integer)
220
+   4.2. default_connection (string)
221
+   4.3. emptystring (integer)
222
+   4.4. file_buffer_size (integer)
217 223
 
218 224
 4.1. db_mode (integer)
219 225
 
... ...
@@ -229,7 +235,19 @@ suser:supasswd:xxx:alpha.org:xxx
229 235
 modparam("db_text", "db_mode", 1)
230 236
 ...
231 237
 
232
-4.2. emptystring (integer)
238
+4.2. default_connection (string)
239
+
240
+   connection for use with rpc query command.
241
+
242
+   Default value is “none” (off).
243
+
244
+   Example 1.5. Set default_connection parameter
245
+                    ...
246
+                    modparam("db_text", "default_connection", "text:///var/db/ka
247
+mailio/dbtext")
248
+                    ...
249
+
250
+4.3. emptystring (integer)
233 251
 
234 252
    db_text by default handles an empty string as a NULL value. Some
235 253
    modules, like the dialplan module, does not accept NULL strings. If you
... ...
@@ -238,19 +256,19 @@ modparam("db_text", "db_mode", 1)
238 256
 
239 257
    Default value is “0” (off).
240 258
 
241
-   Example 1.5. Set emptystring parameter
259
+   Example 1.6. Set emptystring parameter
242 260
 ...
243 261
 modparam("db_text", "emptystring", 1)
244 262
 ...
245 263
 
246
-4.3. file_buffer_size (integer)
264
+4.4. file_buffer_size (integer)
247 265
 
248 266
    size of the buffer used to read the text file. Some presence tables
249 267
    have columns with large content.
250 268
 
251 269
    Default value is “16384” (off).
252 270
 
253
-   Example 1.6. Set file_buffer_size parameter
271
+   Example 1.7. Set file_buffer_size parameter
254 272
 ...
255 273
 modparam("db_text", "file_buffer_size", 8192)
256 274
 ...
... ...
@@ -258,6 +276,7 @@ modparam("db_text", "file_buffer_size", 8192)
258 276
 5. Exported RPC Functions
259 277
 
260 278
    5.1. db_text.dump
279
+   5.2. db_text.query
261 280
 
262 281
 5.1.  db_text.dump
263 282
 
... ...
@@ -270,6 +289,17 @@ modparam("db_text", "file_buffer_size", 8192)
270 289
    RPC Command Format:
271 290
         kamcmd db_text.dump
272 291
 
292
+5.2.  db_text.query
293
+
294
+   run sql command
295
+
296
+   Name: db_text.query
297
+
298
+   Parameters: sqlcmd
299
+
300
+   RPC Command Format:
301
+            kamcmd db_text.query 'select * from location where username="xxx"'
302
+
273 303
 6. Installation and Running
274 304
 
275 305
    6.1. Using db_text with a basic Kamailio configuration
... ...
@@ -283,7 +313,7 @@ modparam("db_text", "file_buffer_size", 8192)
283 313
    database path. So, either you provide an absolute path to database
284 314
    directory or a relative one to “CFG_DIR” directory.
285 315
 
286
-   Example 1.7. Load the dbtext module
316
+   Example 1.8. Load the dbtext module
287 317
 ...
288 318
 loadmodule "/path/to/kamailio/modules_k/db_text.so"
289 319
 ...
... ...
@@ -302,7 +332,7 @@ modparam("module_name", "db_url", "text:///path/to/dbtext/database")
302 332
    in order to have authentication. To use with the given configuration
303 333
    file, the table files must be placed in the '/tmp/serdb' directory.
304 334
 
305
-   Example 1.8. Definition of 'subscriber' table (one line)
335
+   Example 1.9. Definition of 'subscriber' table (one line)
306 336
 ...
307 337
 username(str) domain(str) password(str) first_name(str) last_name(str) phone(str
308 338
 ) email_address(str) datetime_created(int) datetime_modified(int) confirmation(s
... ...
@@ -310,14 +340,14 @@ tr) flag(str) sendnotification(str) greeting(str) ha1(str) ha1b(str) perms(str)
310 340
 allow_find(str) timezone(str,null) rpid(str,null)
311 341
 ...
312 342
 
313
-   Example 1.9. Definition of 'location' and 'aliases' tables (one line)
343
+   Example 1.10. Definition of 'location' and 'aliases' tables (one line)
314 344
 ...
315 345
 username(str) domain(str,null) contact(str,null) received(str) expires(int,null)
316 346
  q(double,null) callid(str,null) cseq(int,null) last_modified(str) flags(int) us
317 347
 er_agent(str) socket(str)
318 348
 ...
319 349
 
320
-   Example 1.10. Definition of 'version' table and sample records
350
+   Example 1.11. Definition of 'version' table and sample records
321 351
 ...
322 352
 table_name(str) table_version(int)
323 353
 subscriber:3
... ...
@@ -325,7 +355,7 @@ location:6
325 355
 aliases:6
326 356
 ...
327 357
 
328
-   Example 1.11. Configuration file
358
+   Example 1.12. Configuration file
329 359
 ...
330 360
 #
331 361
 # $Id$
Browse code

core, lib, modules: restructured source code tree

- new folder src/ to hold the source code for main project applications
- main.c is in src/
- all core files are subfolder are in src/core/
- modules are in src/modules/
- libs are in src/lib/
- application Makefiles are in src/
- application binary is built in src/ (src/kamailio)

Daniel-Constantin Mierla authored on 07/12/2016 11:03:51
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,476 @@
1
+DBTEXT Module
2
+
3
+Daniel-Constantin Mierla
4
+
5
+   <miconda@gmail.com>
6
+
7
+Edited by
8
+
9
+Ovidiu Sas
10
+
11
+   <osas@voipembedded.com>
12
+
13
+Edited by
14
+
15
+Daniel-Constantin Mierla
16
+
17
+   <miconda@gmail.com>
18
+
19
+Edited by
20
+
21
+Olle E. Johansson
22
+
23
+   <oej@edvina.net>
24
+
25
+   Copyright © 2003, 2004 FhG FOKUS
26
+     __________________________________________________________________
27
+
28
+   Table of Contents
29
+
30
+   1. Admin Guide
31
+
32
+        1. Overview
33
+
34
+              1.1. Design of dbtext engine
35
+              1.2. Internal format of a dbtext table
36
+
37
+        2. Known limitations
38
+        3. Dependencies
39
+
40
+              3.1. Kamailio modules
41
+              3.2. External libraries or applications
42
+
43
+        4. Parameters
44
+
45
+              4.1. db_mode (integer)
46
+              4.2. emptystring (integer)
47
+              4.3. file_buffer_size (integer)
48
+
49
+        5. Exported RPC Functions
50
+
51
+              5.1. db_text.dump
52
+
53
+        6. Installation and Running
54
+
55
+              6.1. Using db_text with a basic Kamailio configuration
56
+
57
+   2. Developer Guide
58
+
59
+   List of Examples
60
+
61
+   1.1. Sample of a dbtext table
62
+   1.2. Minimal Kamailio location dbtext table definition
63
+   1.3. Minimal Kamailio subscriber dbtext table example
64
+   1.4. Set db_mode parameter
65
+   1.5. Set emptystring parameter
66
+   1.6. Set file_buffer_size parameter
67
+   1.7. Load the dbtext module
68
+   1.8. Definition of 'subscriber' table (one line)
69
+   1.9. Definition of 'location' and 'aliases' tables (one line)
70
+   1.10. Definition of 'version' table and sample records
71
+   1.11. Configuration file
72
+
73
+Chapter 1. Admin Guide
74
+
75
+   Table of Contents
76
+
77
+   1. Overview
78
+
79
+        1.1. Design of dbtext engine
80
+        1.2. Internal format of a dbtext table
81
+
82
+   2. Known limitations
83
+   3. Dependencies
84
+
85
+        3.1. Kamailio modules
86
+        3.2. External libraries or applications
87
+
88
+   4. Parameters
89
+
90
+        4.1. db_mode (integer)
91
+        4.2. emptystring (integer)
92
+        4.3. file_buffer_size (integer)
93
+
94
+   5. Exported RPC Functions
95
+
96
+        5.1. db_text.dump
97
+
98
+   6. Installation and Running
99
+
100
+        6.1. Using db_text with a basic Kamailio configuration
101
+
102
+1. Overview
103
+
104
+   1.1. Design of dbtext engine
105
+   1.2. Internal format of a dbtext table
106
+
107
+   The module implements a simplified database engine based on text files.
108
+   It can be used by Kamailio DB interface instead of other database
109
+   module (like MySQL).
110
+
111
+   The module is meant for use in demos or small devices that do not
112
+   support other DB modules. It keeps everything in memory and if you deal
113
+   with large amount of data you may run out of memory quickly. Also, it
114
+   does not implement all standard database facilities (like order by), it
115
+   includes minimal functionality to work properly (who knows ?!?) with
116
+   Kamailio.
117
+
118
+   NOTE: the timestamp is printed in an integer value from time_t
119
+   structure. If you use it in a system that cannot do this conversion, it
120
+   will fail (support for such situation is in to-do list).
121
+
122
+   NOTE: even when db_text is in non-caching mode, the module does not
123
+   write back to hard drive after changes. In this mode, the module checks
124
+   if the corresponding file on disk has changed, and reloads it. The
125
+   write to disk happens at Kamailio shut down. If db_text is in caching
126
+   mode, many "reload" functions in various modules will not work.
127
+
128
+1.1. Design of dbtext engine
129
+
130
+   The dbtext database system architecture:
131
+     * A database is represented by a directory in the local file system.
132
+       NOTE: when you use dbtext in Kamailio, the database URL for modules
133
+       must be the path to the directory where the table-files are
134
+       located, prefixed by “text://”, e.g., “text:///var/dbtext/ser”. If
135
+       there is no “/” after “text://” then “CFG_DIR/” is inserted at the
136
+       beginning of the database path. So, either you provide an absolute
137
+       path to database directory or a relative one to “CFG_DIR”
138
+       directory.
139
+       Do not forget that all databases in Kamailio needs the “version”
140
+       table.
141
+     * A table is represented by a text file inside database directory.
142
+
143
+1.2. Internal format of a dbtext table
144
+
145
+   The first line is the definition of the columns. Each column must be
146
+   declared in the following format:
147
+     * the name of column must not include white spaces.
148
+     * the format of a column definition is: name(type,attr).
149
+     * between two column definitions must be a white space, e.g.,
150
+       “first_name(str) last_name(str)”.
151
+     * the type of a column can be:
152
+          + int - integer numbers.
153
+          + double - real numbers with two decimals.
154
+          + str - strings with maximum size of 4KB.
155
+     * a column can have one of the attributes:
156
+          + auto - only for 'int' columns, the maximum value in that
157
+            column is incremented and stored in this field if it is not
158
+            provided in queries.
159
+          + null - accept null values in column fields.
160
+          + if no attribute is set, the fields of the column cannot have
161
+            null value.
162
+     * each other line is a row with data. The line ends with “\n”.
163
+     * the fields are separated by “:”.
164
+     * no value between two ':' (or between ':' and start/end of a row)
165
+       means “null” value. If the parameter "emptystring" is enabled,
166
+       db_text sets a NULL string to an empty string value.
167
+     * next characters must be escaped in strings: “\n”, “\r”, “\t”, “:”.
168
+     * 0 -- the zero value must be escaped too.
169
+
170
+   Example 1.1. Sample of a dbtext table
171
+...
172
+id(int,auto) name(str) flag(double) desc(str,null)
173
+1:nick:0.34:a\tgood\: friend
174
+2:cole:-3.75:colleague
175
+3:bob:2.50:
176
+...
177
+
178
+   Example 1.2. Minimal Kamailio location dbtext table definition
179
+...
180
+username(str) contact(str) expires(int) q(double) callid(str) cseq(int)
181
+...
182
+
183
+   Example 1.3. Minimal Kamailio subscriber dbtext table example
184
+...
185
+username(str) password(str) ha1(str) domain(str) ha1b(str)
186
+suser:supasswd:xxx:alpha.org:xxx
187
+...
188
+
189
+2. Known limitations
190
+
191
+   This database interface does not support data insertion with default
192
+   values. All such values specified in the database template are ignored.
193
+   So its advisable to specify all data for a column at insertion
194
+   operations.
195
+
196
+3. Dependencies
197
+
198
+   3.1. Kamailio modules
199
+   3.2. External libraries or applications
200
+
201
+3.1. Kamailio modules
202
+
203
+   These modules must be loaded before this module:
204
+     * none.
205
+
206
+3.2. External libraries or applications
207
+
208
+   These libraries or applications must be installed before running
209
+   Kamailio with this module:
210
+     * none.
211
+
212
+4. Parameters
213
+
214
+   4.1. db_mode (integer)
215
+   4.2. emptystring (integer)
216
+   4.3. file_buffer_size (integer)
217
+
218
+4.1. db_mode (integer)
219
+
220
+   Set caching mode (0) or non-caching mode (1). In caching mode, data is
221
+   loaded at startup. In non-caching mode, the module check every time a
222
+   table is requested whether the corresponding file on disk has changed,
223
+   and if yes, will re-load the table from file.
224
+
225
+   Default value is “0”.
226
+
227
+   Example 1.4. Set db_mode parameter
228
+...
229
+modparam("db_text", "db_mode", 1)
230
+...
231
+
232
+4.2. emptystring (integer)
233
+
234
+   db_text by default handles an empty string as a NULL value. Some
235
+   modules, like the dialplan module, does not accept NULL strings. If you
236
+   enable emptystring an empty string will not be NULL, but an empty
237
+   string.
238
+
239
+   Default value is “0” (off).
240
+
241
+   Example 1.5. Set emptystring parameter
242
+...
243
+modparam("db_text", "emptystring", 1)
244
+...
245
+
246
+4.3. file_buffer_size (integer)
247
+
248
+   size of the buffer used to read the text file. Some presence tables
249
+   have columns with large content.
250
+
251
+   Default value is “16384” (off).
252
+
253
+   Example 1.6. Set file_buffer_size parameter
254
+...
255
+modparam("db_text", "file_buffer_size", 8192)
256
+...
257
+
258
+5. Exported RPC Functions
259
+
260
+   5.1. db_text.dump
261
+
262
+5.1.  db_text.dump
263
+
264
+   Write back to hard drive all modified tables.
265
+
266
+   Name: db_text.dump
267
+
268
+   Parameters: none
269
+
270
+   RPC Command Format:
271
+        kamcmd db_text.dump
272
+
273
+6. Installation and Running
274
+
275
+   6.1. Using db_text with a basic Kamailio configuration
276
+
277
+   Compile the module and load it instead of mysql or other DB modules.
278
+
279
+   REMINDER: when you use text in Kamailio, the database URL for modules
280
+   must be the path to the directory where the table-files are located,
281
+   prefixed by “text://”, e.g., “text:///var/dbtext/ser”. If there is no
282
+   “/” after “text://” then “CFG_DIR/” is inserted at the beginning of the
283
+   database path. So, either you provide an absolute path to database
284
+   directory or a relative one to “CFG_DIR” directory.
285
+
286
+   Example 1.7. Load the dbtext module
287
+...
288
+loadmodule "/path/to/kamailio/modules_k/db_text.so"
289
+...
290
+modparam("module_name", "db_url", "text:///path/to/dbtext/database")
291
+...
292
+
293
+6.1. Using db_text with a basic Kamailio configuration
294
+
295
+   Here are definitions for the most important tables as well as a basic
296
+   configuration file to use db_text with Kamailio. The table structures
297
+   may change in time and you will have to adjust these examples. Check
298
+   the source code directory “utils/kamctl/dbtxt/kamailio” for current
299
+   definitions.
300
+
301
+   You have to populate the table 'subscriber' by hand with user profiles
302
+   in order to have authentication. To use with the given configuration
303
+   file, the table files must be placed in the '/tmp/serdb' directory.
304
+
305
+   Example 1.8. Definition of 'subscriber' table (one line)
306
+...
307
+username(str) domain(str) password(str) first_name(str) last_name(str) phone(str
308
+) email_address(str) datetime_created(int) datetime_modified(int) confirmation(s
309
+tr) flag(str) sendnotification(str) greeting(str) ha1(str) ha1b(str) perms(str)
310
+allow_find(str) timezone(str,null) rpid(str,null)
311
+...
312
+
313
+   Example 1.9. Definition of 'location' and 'aliases' tables (one line)
314
+...
315
+username(str) domain(str,null) contact(str,null) received(str) expires(int,null)
316
+ q(double,null) callid(str,null) cseq(int,null) last_modified(str) flags(int) us
317
+er_agent(str) socket(str)
318
+...
319
+
320
+   Example 1.10. Definition of 'version' table and sample records
321
+...
322
+table_name(str) table_version(int)
323
+subscriber:3
324
+location:6
325
+aliases:6
326
+...
327
+
328
+   Example 1.11. Configuration file
329
+...
330
+#
331
+# $Id$
332
+#
333
+# simple quick-start config script with dbtext
334
+#
335
+
336
+# ----------- global configuration parameters ------------------------
337
+
338
+#debug=9         # debug level (cmd line: -dddddddddd)
339
+#fork=yes
340
+#log_stderror=no        # (cmd line: -E)
341
+
342
+check_via=no    # (cmd. line: -v)
343
+dns=no          # (cmd. line: -r)
344
+rev_dns=no      # (cmd. line: -R)
345
+children=4
346
+
347
+listen=10.100.100.1
348
+port=5060
349
+
350
+# ------------------ module loading ----------------------------------
351
+
352
+# use dbtext database
353
+loadmodule "modules/dbtext/dbtext.so"
354
+
355
+loadmodule "modules/sl/sl.so"
356
+loadmodule "modules/tm/tm.so"
357
+loadmodule "modules/rr/rr.so"
358
+loadmodule "modules/maxfwd/maxfwd.so"
359
+loadmodule "modules/usrloc/usrloc.so"
360
+loadmodule "modules/registrar/registrar.so"
361
+loadmodule "modules/textops/textops.so"
362
+loadmodule "modules/textops/mi_fifo.so"
363
+
364
+# modules for digest authentication
365
+loadmodule "modules/auth/auth.so"
366
+loadmodule "modules/auth_db/auth_db.so"
367
+
368
+# ----------------- setting module-specific parameters ---------------
369
+
370
+# -- mi_fifo params --
371
+
372
+modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")
373
+
374
+# -- usrloc params --
375
+
376
+# use dbtext database for persistent storage
377
+modparam("usrloc", "db_mode", 2)
378
+modparam("usrloc|auth_db", "db_url", "dbtext:///tmp/openserdb")
379
+
380
+# -- auth params --
381
+#
382
+modparam("auth_db", "calculate_ha1", 1)
383
+mod