File: README

package info (click to toggle)
openser 1.1.0-9etch1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 9,828 kB
  • ctags: 11,809
  • sloc: ansic: 120,528; sh: 5,249; yacc: 1,716; makefile: 1,261; php: 656; perl: 205; sql: 190
file content (338 lines) | stat: -rw-r--r-- 9,687 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338

pdt Module

Elena-Ramona Modroiu

   voice-system.ro

Edited by

Elena-Ramona Modroiu

   Copyright  2003 FhG FOKUS

   Copyright  2004 voice-system.ro
     _________________________________________________________

   Table of Contents
   1. User's Guide

        1.1. Overview
        1.2. Dependencies

              1.2.1. OpenSER Modules
              1.2.2. External Libraries or Applications

        1.3. Exported Parameters

              1.3.1. db_url (string)
              1.3.2. db_table (string)
              1.3.3. sdomain_column (string)
              1.3.4. prefix_column (string)
              1.3.5. domain_column (string)
              1.3.6. prefix (string)
              1.3.7. hsize_2pow (integer)
              1.3.8. sync_time (integer)
              1.3.9. clean_time (integer)

        1.4. Exported Functions

              1.4.1. prefix2domain(mode)

        1.5. Installation & Running

              1.5.1. FIFO Commands

   2. Developer's Guide
   3. Frequently Asked Questions

   List of Examples
   1-1. prefix-domain translation
   1-2. Set db_url parameter
   1-3. Set db_table parameter
   1-4. Set sdomain_column parameter
   1-5. Set prefix_column parameter
   1-6. Set domain_column parameter
   1-7. Set prefix parameter
   1-8. Set hsize_2pow parameter
   1-9. Set sync_time parameter
   1-10. Set clean_time parameter
   1-11. prefix2domain usage
     _________________________________________________________

Chapter 1. User's Guide

1.1. Overview

   This module translates a numerical prefix into a domain and
   updates accordingly the request URI.

   The module looks up at the R-URI part of a message and if the
   user part begins with an established prefix it will update the
   URI. Updating the uri consists of: remove the prefix from the
   user part of the uri and keep the rest as the user part of the
   new uri. The host and port are changed with the domain matched
   for the leading prefix and the domain in From URI.

   <prefix><userid><:password>@<mydomain.com> ...

   and the result will be:

   <userid><:password>@<domain[:port]>...

   Example 1-1. prefix-domain translation
prefix=123, domain(FROM)=siphub.org

entry in database:
 sdomain=siphub.org
    domain[123]=alpha.org
    domain[124]=beta.org
    domain[125]=gamma.org

The RURI will be updated in the following way"
sip:12391001@mydomain.com  => sip:91001@alpha.org

   The prefix could be prefixed by other digits. These digits
   will not be used to look up the domain (the classic example,
   00 used for international calls, then follows the country
   prefix). For more information on this, see 'prefix' parameter.

     * A sample config file and the MySQL script to create the
       database needed by PDT are located in './doc/'.
     * Sample shell scripts to manage prefix-domain pairs are
       also located in './doc/' (pdt_fifo_add.sh,
       pdt_fifo_delete.sh, pdt_fifo_list.sh).
     _________________________________________________________

1.2. Dependencies

1.2.1. OpenSER Modules

   The following modules must be loaded before this module:

     * A OpenSER database module (e.g., mysql, dbtext).
     _________________________________________________________

1.2.2. External Libraries or Applications

   The following libraries or applications must be installed
   before running OpenSER with this module loaded:

     * None.
     _________________________________________________________

1.3. Exported Parameters

1.3.1. db_url (string)

   SQL URL of database--username, password, host, port and
   database (ex: mysql://username:password@hostname.com/database)

   Default value is "mysql://root@127.0.0.1/pdt". 

   Example 1-2. Set db_url parameter
...
modparam("pdt", "db_url", "mysql://user:xxx@127.0.0.1/ser")
...
     _________________________________________________________

1.3.2. db_table (string)

   Table name.

   Default value is "prefix_domain". 

   Example 1-3. Set db_table parameter
...
modparam("pdt", "db_table", "pdt")
...
     _________________________________________________________

1.3.3. sdomain_column (string)

   Name of 'sdomain' column.

   Default value is "sdomain". 

   Example 1-4. Set sdomain_column parameter
...
modparam("pdt", "domain_column", "source_domain")
...
     _________________________________________________________

1.3.4. prefix_column (string)

   Name of 'prefix' column.

   Default value is "prefix". 

   Example 1-5. Set prefix_column parameter
...
modparam("pdt", "prefix_column", "prefix")
...
     _________________________________________________________

1.3.5. domain_column (string)

   Name of 'domain' column.

   Default value is "domain". 

   Example 1-6. Set domain_column parameter
...
modparam("pdt", "domain_column", "hostname")
...
     _________________________________________________________

1.3.6. prefix (string)

   Default leading prefix who denotes what URI needs to be
   translated - if it is NULL the module will not check the R-URI
   against it and the PDT prefix is considered starting from the
   first digit. Otherwise, the module will check first if the
   R-URI starts with it and will skip it to look up the domain.

   Default value is NULL. 

   Example 1-7. Set prefix parameter
...
modparam("pdt", "prefix", "00")
...
     _________________________________________________________

1.3.7. hsize_2pow (integer)

   Number of the hash entries = 2^hash_size.

   Default value is 4. 

   Example 1-8. Set hsize_2pow parameter
...
modparam("pdt", "hsize_2pow", 4)
...
     _________________________________________________________

1.3.8. sync_time (integer)

   Time in seconds to synchronize the cache of each process with
   the changes made through FIFO. Any prefix-domain change made
   through FIFO is guaranteed to have efect after this period of
   time past.

   Default value is 600. 

   Example 1-9. Set sync_time parameter
...
modparam("pdt", "sync_time", 300)
...
     _________________________________________________________

1.3.9. clean_time (integer)

   Time in seconds to clean the changes inserted via FIFO. The
   changes will be removed from FIFO diff list only when all
   OpenSER processes applied these changes.

   Default value is 900. 

   Example 1-10. Set clean_time parameter
...
modparam("pdt", "clean_time", 600)
...
     _________________________________________________________

1.4. Exported Functions

1.4.1. prefix2domain(mode)

   Build a new URI if it is necessary. Returns 1 when the
   translation was made or there was nothing to translate (user
   part of the URI is empty, it does not match the prefix
   parameter or there is no domain associated with a possible
   prefix from user part). Returns -1 in error cases.

   The translation is done based on lookup up for a entry in the
   database where the sdomain equals the domain in FROM uri, and
   the prefix matches the beginning of the user part of the RURI.
   If such an entry is found, then the domain in RURI is updated
   with the domain of this entry (sdomain, prefix, domain).

   The "mode" parameter specifies whether to strip or not the
   prefix from user part. If the parameter is missing or it has
   the value "0", then the prefix is removed along with the
   leading prefix. If the value is "1", only the leading prefix
   is removed. If the values is "2" the user part of the URI is
   not changed.

   This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.

   Example 1-11. prefix2domain usage
...
prefix2domain();
...
prefix2domain("2");
...
     _________________________________________________________

1.5. Installation & Running

   Make sure you have created the table needed by this module.
     _________________________________________________________

1.5.1. FIFO Commands

   The modules uses only the cache to look up domains. If you
   want to add or delete a new prefix-domain pair you have to use
   FIFO commands. All changes made via FIFO are applied to
   database. The database is loaded only at OpenSER start up
   time.

   There are three FIFO commands to use with PDT.

     * pdt_add - add a new sdomain-prefix-domain entry
     * pdt_delete - remove a sdomain-prefix-domain entry
     * pdt_list - list the prefixes and the domains/sdomains

   Example shell scripts for these commands are placed in
   './doc/' (pdt_fifo_add.sh, pdt_fifo_delete.sh,
   pdt_fifo_list.sh). More about, in the comments before the
   implementation of the functions, inside the 'pdt.c' file.
     _________________________________________________________

Chapter 2. Developer's Guide

   The module does not provide any API to use in other OpenSER
   modules.
     _________________________________________________________

Chapter 3. Frequently Asked Questions

   3.1. Where can I find more about OpenSER?
   3.2. Where can I post a question about this module?
   3.3. How can I report a bug?

   3.1. Where can I find more about OpenSER?

   Take a look at http://openser.org/.

   3.2. Where can I post a question about this module?

   First at all check if your question was already answered on
   one of our mailing lists:

     * User Mailing List -
       http://openser.org/cgi-bin/mailman/listinfo/users
     * Developer Mailing List -
       http://openser.org/cgi-bin/mailman/listinfo/devel

   E-mails regarding any stable OpenSER release should be sent to
   <users@openser.org> and e-mails regarding development versions
   should be sent to <devel@openser.org>.

   If you want to keep the mail private, send it to
   <team@openser.org>.

   3.3. How can I report a bug?

   Please follow the guidelines provided at:
   http://sourceforge.net/tracker/?group_id=139143.