... | ... |
@@ -12,9 +12,9 @@ Edited by |
12 | 12 |
|
13 | 13 |
Juha Heinanen |
14 | 14 |
|
15 |
- Copyright © 2007-2008 Voice Sistem SRL |
|
15 |
+ Copyright � 2007-2008 Voice Sistem SRL |
|
16 | 16 |
|
17 |
- Copyright © 2008-2010 Juha Heinanen |
|
17 |
+ Copyright � 2008-2010 Juha Heinanen |
|
18 | 18 |
__________________________________________________________________ |
19 | 19 |
|
20 | 20 |
Table of Contents |
... | ... |
@@ -23,7 +23,7 @@ Juha Heinanen |
23 | 23 |
|
24 | 24 |
1. Overview |
25 | 25 |
2. How it works |
26 |
- 3. Usage cases |
|
26 |
+ 3. Dialplan use cases |
|
27 | 27 |
4. Dependencies |
28 | 28 |
|
29 | 29 |
4.1. Kamailio Modules |
... | ... |
@@ -86,7 +86,7 @@ Chapter 1. Admin Guide |
86 | 86 |
|
87 | 87 |
1. Overview |
88 | 88 |
2. How it works |
89 |
- 3. Usage cases |
|
89 |
+ 3. Dialplan use cases |
|
90 | 90 |
4. Dependencies |
91 | 91 |
|
92 | 92 |
4.1. Kamailio Modules |
... | ... |
@@ -126,16 +126,16 @@ Chapter 1. Admin Guide |
126 | 126 |
1. Overview |
127 | 127 |
|
128 | 128 |
This module implements generic string translations based on matching |
129 |
- and replacement rules. It can be used to manipulate Request URI or a PV |
|
130 |
- and to translated to a new format/value. |
|
129 |
+ and replacement rules. It can be used to manipulate the request URI or |
|
130 |
+ a PV and to translate to a new format/value. |
|
131 | 131 |
|
132 | 132 |
2. How it works |
133 | 133 |
|
134 | 134 |
At startup, the module will load a set of transformation rules from a |
135 |
- database. Every database row will be stored in memory as a translation |
|
136 |
- rule. Each rule will describe how the matching should be made, how the |
|
137 |
- input value should be modified and which attributes should be set for |
|
138 |
- the matching transformation. |
|
135 |
+ database. Rules are grouped into dialplans. Every database row will be |
|
136 |
+ stored in memory as a translation rule. Each rule will describe how the |
|
137 |
+ matching will be made, how the input value will be modified and which |
|
138 |
+ attributes that will be set for the matching transformation. |
|
139 | 139 |
|
140 | 140 |
The module expects an input value which will be matched against a rule |
141 | 141 |
by using regular expressions (see 'man pcresyntax' for syntax), string |
... | ... |
@@ -144,18 +144,19 @@ Chapter 1. Admin Guide |
144 | 144 |
the defined transformation (if any) is applied and the result is |
145 | 145 |
returned as output value. Also, if any string attribute is associated |
146 | 146 |
to the rule, this will be returned to the script along with the output |
147 |
- value. |
|
147 |
+ value. This can be used to identify the used rule. |
|
148 | 148 |
|
149 | 149 |
The first matching rule will be processed. |
150 | 150 |
|
151 |
-3. Usage cases |
|
151 |
+3. Dialplan use cases |
|
152 | 152 |
|
153 |
- The module can be used to implement dialplans - do to auto completion |
|
154 |
- of the dial numbers (like national to international), to convert |
|
155 |
- generic numbers to specific numbers (like for emergency numbers). |
|
153 |
+ The module can be used to implement multiple dialplans - do to |
|
154 |
+ auto-completion of dialed numbers (like national to international), to |
|
155 |
+ convert generic numbers to specific numbers (like for emergency |
|
156 |
+ numbers). |
|
156 | 157 |
|
157 |
- The module can also be used for detecting range or sets of numbers |
|
158 |
- mapped on a service/case - attribute string can be used here to store |
|
158 |
+ The module can also be used for detecting a range or sets of numbers |
|
159 |
+ mapped on a service/case - the attribute string can be used to store |
|
159 | 160 |
extra information about the service/case. |
160 | 161 |
|
161 | 162 |
Non-SIP string translation can be implemented - like converting country |
... | ... |
@@ -173,7 +174,7 @@ Chapter 1. Admin Guide |
173 | 174 |
4.1. Kamailio Modules |
174 | 175 |
|
175 | 176 |
The following modules must be loaded before this module: |
176 |
- * None |
|
177 |
+ * A database module |
|
177 | 178 |
|
178 | 179 |
4.2. External Libraries or Applications |
179 | 180 |
|
... | ... |
@@ -200,7 +201,7 @@ Chapter 1. Admin Guide |
200 | 201 |
|
201 | 202 |
The translation rules will be loaded using this database URL. |
202 | 203 |
|
203 |
- Default value is “mysql://openser:openserrw@localhost/openser”. |
|
204 |
+ Default value is "mysql://kamailio:kamailiorw@localhost/kamailio". |
|
204 | 205 |
|
205 | 206 |
Example 1.1. Set db_url parameter |
206 | 207 |
... |
... | ... |
@@ -211,7 +212,7 @@ modparam("dialplan", "db_url", "mysql://user:passwb@localhost/db") |
211 | 212 |
|
212 | 213 |
The table's name from which to load the translation rules. |
213 | 214 |
|
214 |
- Default value is “dialplan”. |
|
215 |
+ Default value is "dialplan". |
|
215 | 216 |
|
216 | 217 |
Example 1.2. Set table_name parameter |
217 | 218 |
... |
... | ... |
@@ -220,9 +221,9 @@ modparam("dialplan", "table_name", "my_table") |
220 | 221 |
|
221 | 222 |
5.3. dpid_col (string) |
222 | 223 |
|
223 |
- The column name used to store the dialplan ID group. |
|
224 |
+ The column name used to store the dialplan group ID. |
|
224 | 225 |
|
225 |
- Default value is “dpid”. |
|
226 |
+ Default value is "dpid". |
|
226 | 227 |
|
227 | 228 |
Example 1.3. Set dpid_col parameter |
228 | 229 |
... |
... | ... |
@@ -234,7 +235,7 @@ modparam("dialplan", "dpid_col", "column_name") |
234 | 235 |
The column name used to store the priority of the corresponding rule |
235 | 236 |
from the database row. |
236 | 237 |
|
237 |
- Default value is “pr”. |
|
238 |
+ Default value is "pr". |
|
238 | 239 |
|
239 | 240 |
Example 1.4. Set pr_col parameter |
240 | 241 |
... |
... | ... |
@@ -245,7 +246,7 @@ modparam("dialplan", "pr_col", "column_name") |
245 | 246 |
|
246 | 247 |
The column name used to store the type of matching of the rule. |
247 | 248 |
|
248 |
- Default value is “match_op”. |
|
249 |
+ Default value is "match_op". |
|
249 | 250 |
|
250 | 251 |
Example 1.5. Set match_op_col parameter |
251 | 252 |
... |
... | ... |
@@ -256,7 +257,7 @@ modparam("dialplan", "match_op_col", "column_name") |
256 | 257 |
|
257 | 258 |
The column name to store the rule match expression. |
258 | 259 |
|
259 |
- Default value is “match_exp”. |
|
260 |
+ Default value is "match_exp". |
|
260 | 261 |
|
261 | 262 |
Example 1.6. Set match_exp_col parameter |
262 | 263 |
... |
... | ... |
@@ -268,7 +269,7 @@ modparam("dialplan", "match_exp_col", "column_name") |
268 | 269 |
The column name to store the length of a string matching the match |
269 | 270 |
expression. |
270 | 271 |
|
271 |
- Default value is “match_len”. |
|
272 |
+ Default value is "match_len". |
|
272 | 273 |
|
273 | 274 |
Example 1.7. Set pr_col parameter |
274 | 275 |
... |
... | ... |
@@ -279,7 +280,7 @@ modparam("dialplan", "match_len_col", "column_name") |
279 | 280 |
|
280 | 281 |
The column name to store the rule's substitution expression. |
281 | 282 |
|
282 |
- Default value is “subst_exp”. |
|
283 |
+ Default value is "subst_exp". |
|
283 | 284 |
|
284 | 285 |
Example 1.8. Set pr_col parameter |
285 | 286 |
... |
... | ... |
@@ -290,7 +291,7 @@ modparam("dialplan", "subst_exp_col", "column_name") |
290 | 291 |
|
291 | 292 |
The column name to store the rule's replacement expression. |
292 | 293 |
|
293 |
- Default value is “repl_exp”. |
|
294 |
+ Default value is "repl_exp". |
|
294 | 295 |
|
295 | 296 |
Example 1.9. Set repl_exp_col parameter |
296 | 297 |
... |
... | ... |
@@ -302,7 +303,7 @@ modparam("dialplan", "repl_exp_col", "column_name") |
302 | 303 |
The column name to store the rule's attributes to be set to the |
303 | 304 |
message. |
304 | 305 |
|
305 |
- Default value is “attrs”. |
|
306 |
+ Default value is "attrs". |
|
306 | 307 |
|
307 | 308 |
Example 1.10. Set attrs_col parameter |
308 | 309 |
... |
... | ... |
@@ -315,7 +316,7 @@ modparam("dialplan", "attrs_col", "column_name") |
315 | 316 |
(dp_translate() succeeds). This parameter can be an AVP or a SCRIPT |
316 | 317 |
VAR. |
317 | 318 |
|
318 |
- Default value is “NULL”. |
|
319 |
+ Default value is "NULL". |
|
319 | 320 |
|
320 | 321 |
Example 1.11. Set attrs_pvar parameter |
321 | 322 |
... |
... | ... |
@@ -326,7 +327,7 @@ modparam("dialplan", "attrs_pvar", "$avp(s:dest)") |
326 | 327 |
|
327 | 328 |
The number of rows to be fetched at once from database |
328 | 329 |
|
329 |
- Default value is “1000”. |
|
330 |
+ Default value is "1000". |
|
330 | 331 |
|
331 | 332 |
Example 1.12. Set fetch_rows parameter |
332 | 333 |
... |
... | ... |
@@ -337,11 +338,11 @@ modparam("dialplan", "fetch_rows", 4000) |
337 | 338 |
|
338 | 339 |
6.1. dp_translate(id, [src[/dest]]) |
339 | 340 |
|
340 |
-6.1. dp_translate(id, [src[/dest]]) |
|
341 |
+6.1. dp_translate(id, [src[/dest]]) |
|
341 | 342 |
|
342 | 343 |
Will try to translate src into dest according to the translation rules |
343 | 344 |
with dialplan ID equal to id. If src/dest is missing the default |
344 |
- parameter “ruri.user/ruri.user” will be used, thus translating the |
|
345 |
+ parameter "ruri.user/ruri.user" will be used, thus translating the |
|
345 | 346 |
request uri user part. If only dest is missing, only matching and |
346 | 347 |
storing of matching rule's attributes is done. |
347 | 348 |
|
... | ... |
@@ -458,7 +459,7 @@ xlog("translated to var $var(y) \n"); |
458 | 459 |
the complete database documentation on the project webpage, |
459 | 460 |
http://www.kamailio.org/docs/db-tables/kamailio-db-devel.html. |
460 | 461 |
|
461 |
- Some sample records fromd dialplan table are presented in the next |
|
462 |
+ Some sample records from a dialplan table are presented in the next |
|
462 | 463 |
figure. |
463 | 464 |
|
464 | 465 |
Example 1.15. Example of rules |
... | ... |
@@ -470,10 +471,10 @@ match_exp: ^0([1-9][0-9]+)$ |
470 | 471 |
match_len: 0 |
471 | 472 |
subst_exp: ^0([1-9][0-9]+)$ |
472 | 473 |
repl_exp: 0049\1 |
473 |
-attrs: xyz |
|
474 |
+attrs: de |
|
474 | 475 |
... |
475 | 476 |
dpid: 1 |
476 |
-pr: 1 |
|
477 |
+pr: 2 |
|
477 | 478 |
match_op: 1 |
478 | 479 |
match_exp: ^0([1-9][0-9]+)$ |
479 | 480 |
match_len: 0 |
... | ... |
@@ -485,12 +486,12 @@ attrs: xyz |
485 | 486 |
Note that you can use config variables in the replacement expression |
486 | 487 |
(repl_exp) field. However, not all of config variables are safe to use |
487 | 488 |
there - specifically the variables that have in their name other |
488 |
- variables (variables with dinamic name). References to sip message, |
|
489 |
+ variables (variables with dynamic name). References to SIP message, |
|
489 | 490 |
private variables ($var(...)) and AVPs with static name are among those |
490 | 491 |
that are safe to use in replacement expressions. |
491 | 492 |
|
492 |
- The match_op field specify matching operator, valid value being: 0 - |
|
493 |
- string comparison; 1 - regular expression matching (pcre); 2 - fnmatch |
|
493 |
+ The match_op field specify matching operator, valid values: 0 - string |
|
494 |
+ comparison; 1 - regular expression matching (pcre); 2 - fnmatch |
|
494 | 495 |
(shell-like pattern) matching. |
495 | 496 |
|
496 | 497 |
Chapter 2. Developer's Guide |
... | ... |
@@ -17,8 +17,8 @@ |
17 | 17 |
<title>Overview</title> |
18 | 18 |
<para> |
19 | 19 |
This module implements generic string translations based on matching and |
20 |
- replacement rules. It can be used to manipulate Request URI or a PV and to |
|
21 |
- translated to a new format/value. |
|
20 |
+ replacement rules. It can be used to manipulate the request URI or a PV and to |
|
21 |
+ translate to a new format/value. |
|
22 | 22 |
</para> |
23 | 23 |
</section> |
24 | 24 |
|
... | ... |
@@ -26,10 +26,10 @@ |
26 | 26 |
<title>How it works</title> |
27 | 27 |
<para> |
28 | 28 |
At startup, the module will load a set of transformation rules from a |
29 |
- database. Every database row will be stored in memory as a translation |
|
30 |
- rule. Each rule will describe how the matching should be made, how the |
|
31 |
- input value should be modified and which attributes should be set for |
|
32 |
- the matching transformation. |
|
29 |
+ database. Rules are grouped into dialplans. Every database row will be |
|
30 |
+ stored in memory as a translation rule. Each rule will describe how the |
|
31 |
+ matching will be made, how the input value will be modified and which |
|
32 |
+ attributes that will be set for the matching transformation. |
|
33 | 33 |
</para> |
34 | 34 |
<para> |
35 | 35 |
The module expects an input value which will be matched against a rule |
... | ... |
@@ -39,7 +39,7 @@ |
39 | 39 |
Once a rule is matched, the defined transformation (if any) is applied and |
40 | 40 |
the result is returned as output value. Also, if any string attribute is |
41 | 41 |
associated to the rule, this will be returned to the script along with |
42 |
- the output value. |
|
42 |
+ the output value. This can be used to identify the used rule. |
|
43 | 43 |
</para> |
44 | 44 |
<para> |
45 | 45 |
<emphasis> The first matching rule will be processed.</emphasis> |
... | ... |
@@ -47,15 +47,15 @@ |
47 | 47 |
</section> |
48 | 48 |
|
49 | 49 |
<section> |
50 |
- <title>Usage cases</title> |
|
50 |
+ <title>Dialplan use cases</title> |
|
51 | 51 |
<para> |
52 |
- The module can be used to implement dialplans - do to auto completion of |
|
53 |
- the dial numbers (like national to international), to convert generic |
|
54 |
- numbers to specific numbers (like for emergency numbers). |
|
52 |
+ The module can be used to implement multiple dialplans - do to |
|
53 |
+ auto-completion of dialed numbers (like national to international), |
|
54 |
+ to convert generic numbers to specific numbers (like for emergency numbers). |
|
55 | 55 |
</para> |
56 | 56 |
<para> |
57 |
- The module can also be used for detecting range or sets of numbers mapped |
|
58 |
- on a service/case - attribute string can be used here to store extra |
|
57 |
+ The module can also be used for detecting a range or sets of numbers mapped |
|
58 |
+ on a service/case - the attribute string can be used to store extra |
|
59 | 59 |
information about the service/case. |
60 | 60 |
</para> |
61 | 61 |
<para> |
... | ... |
@@ -78,7 +78,7 @@ |
78 | 78 |
<itemizedlist> |
79 | 79 |
<listitem> |
80 | 80 |
<para> |
81 |
- <emphasis>None</emphasis> |
|
81 |
+ <emphasis>A database module</emphasis> |
|
82 | 82 |
</para> |
83 | 83 |
</listitem> |
84 | 84 |
</itemizedlist> |
... | ... |
@@ -149,7 +149,7 @@ modparam("dialplan", "table_name", "my_table") |
149 | 149 |
<section> |
150 | 150 |
<title><varname>dpid_col</varname> (string)</title> |
151 | 151 |
<para> |
152 |
- The column name used to store the dialplan ID group. |
|
152 |
+ The column name used to store the dialplan group ID. |
|
153 | 153 |
</para> |
154 | 154 |
<para> |
155 | 155 |
<emphasis> |
... | ... |
@@ -366,7 +366,7 @@ modparam("dialplan", "fetch_rows", 4000) |
366 | 366 |
missing the default parameter <quote>ruri.user/ruri.user</quote> will |
367 | 367 |
be used, thus translating the request uri user part. If only dest is |
368 | 368 |
missing, only matching and storing of matching rule's |
369 |
- attributes is done. |
|
369 |
+ attributes is done. |
|
370 | 370 |
|
371 | 371 |
</para> |
372 | 372 |
<para> |
... | ... |
@@ -571,7 +571,7 @@ xlog("translated to var $var(y) \n"); |
571 | 571 |
project webpage, &kamailiodbdocslink;. |
572 | 572 |
</para> |
573 | 573 |
<para> |
574 |
- Some sample records fromd dialplan table are presented in the next |
|
574 |
+ Some sample records from a dialplan table are presented in the next |
|
575 | 575 |
figure. |
576 | 576 |
</para> |
577 | 577 |
<example> |
... | ... |
@@ -585,10 +585,10 @@ match_exp: ^0([1-9][0-9]+)$ |
585 | 585 |
match_len: 0 |
586 | 586 |
subst_exp: ^0([1-9][0-9]+)$ |
587 | 587 |
repl_exp: 0049\1 |
588 |
-attrs: xyz |
|
588 |
+attrs: de |
|
589 | 589 |
... |
590 | 590 |
dpid: 1 |
591 |
-pr: 1 |
|
591 |
+pr: 2 |
|
592 | 592 |
match_op: 1 |
593 | 593 |
match_exp: ^0([1-9][0-9]+)$ |
594 | 594 |
match_len: 0 |
... | ... |
@@ -602,12 +602,12 @@ attrs: xyz |
602 | 602 |
Note that you can use config variables in the replacement expression |
603 | 603 |
(repl_exp) field. However, not all of config variables are safe to use |
604 | 604 |
there - specifically the variables that have in their name other |
605 |
- variables (variables with dinamic name). References to sip message, |
|
605 |
+ variables (variables with dynamic name). References to SIP message, |
|
606 | 606 |
private variables ($var(...)) and AVPs with static name are among |
607 | 607 |
those that are safe to use in replacement expressions. |
608 | 608 |
</para> |
609 | 609 |
<para> |
610 |
- The match_op field specify matching operator, valid value being: |
|
610 |
+ The match_op field specify matching operator, valid values: |
|
611 | 611 |
0 - string comparison; 1 - regular expression matching (pcre); |
612 | 612 |
2 - fnmatch (shell-like pattern) matching. |
613 | 613 |
</para> |