[r10376]: branches / 1.8 / modules / uri / doc / uri_admin.xml Maximize Restore History

Download this file

uri_admin.xml    618 lines (598 with data), 14.8 kB

  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
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
<!-- Module User's Guide -->
<chapter>
<title>&adminguide;</title>
<section>
<title>Overview</title>
<para>Various checks related to &sip; &uri;.</para>
<para>This module implements some URI related AAA or DB based tests.</para>
</section>
<section>
<title>Dependencies</title>
<section>
<title>&osips; Modules</title>
<para>
At least one of the following modules must be loaded before this module:
<itemizedlist>
<listitem>
<para>
<emphasis>a &osips; database module </emphasis>.
</para>
</listitem>
<listitem>
<para>
<emphasis>an aaa protocol module </emphasis>.
</para>
</listitem>
</itemizedlist>
</para>
</section>
<section>
<title>External Libraries or Applications</title>
<para>
The following libraries or applications must be installed before running
&osips; with this module loaded:
<itemizedlist>
<listitem>
<para>
<emphasis>None</emphasis>.
</para>
</listitem>
</itemizedlist>
</para>
</section>
</section>
<section>
<title>Exported Parameters</title>
<section>
<title><varname>aaa_url</varname> (string)</title>
<para>
This is the url representing the AAA protocol used and the location of the configuration file of this protocol.
</para>
<example>
<title>Set <varname>aaa_url</varname> parameter</title>
<programlisting format="linespecific">
...
modparam("uri", "aaa_url", "radius:/etc/radiusclient-ng/radiusclient.conf")
...
</programlisting>
</example>
</section>
<section>
<title><varname>service_type</varname> (integer)</title>
<para>
AAA service type used in
<function>aaa_does_uri_exist</function> and <function>aaa_does_uri_user_exist</function> checks.
</para>
<para>
<emphasis>
Default value is 10 (Call-Check).
</emphasis>
</para>
<example>
<title>Set <varname>service_type</varname> parameter</title>
<programlisting format="linespecific">
...
modparam("uri", "service_type", 11)
...
</programlisting>
</example>
</section>
<section>
<title><varname>use_sip_uri_host</varname> (integer)</title>
<para>
If zero, <function>aaa_does_uri_exist</function>
sends to AAA server Request URI user@host in UserName
attribute. If non-zero, <function>aaa_does_uri_exist</function>
sends to AAA server Request URI user in UserName attribute
and host in SIP-URI-Host attribute.
</para>
<para>
<emphasis>
Default value is 0.
</emphasis>
</para>
<example>
<title>Set <varname>use_sip_uri_host</varname> parameter</title>
<programlisting format="linespecific">
...
modparam("uri", "use_sip_uri_host", 1)
...
</programlisting>
</example>
</section>
<section>
<title><varname>db_url</varname> (string)</title>
<para>
&url; of the database to be used.
</para>
<para>
If the db_url string is not set, you will not be able to use
the DB related functions.
</para>
<para>
<emphasis>
Default value is <quote>>NULL</quote>.
</emphasis>
</para>
<example>
<title>Set <varname>db_url</varname> parameter</title>
<programlisting format="linespecific">
...
modparam("uri", "db_url", "mysql://username:password@localhost/opensips")
...
</programlisting>
</example>
</section>
<section>
<title><varname>db_table</varname> (string)</title>
<para>
The DB table that should be used. Its possible to use the
<quote>subscriber</quote> and <quote>uri</quote> table. If the
<quote>uri</quote> table should be used, an additional parameter
(<xref linkend="use-uri-table"/>) must be set.
</para>
<para>
<emphasis>
Default value is <quote>subscriber</quote>.
</emphasis>
</para>
<example>
<title>Set <varname>uri_table</varname> parameter</title>
<programlisting format="linespecific">
...
modparam("uri", "db_table", "uri")
...
</programlisting>
</example>
</section>
<section>
<title><varname>user_column</varname> (string)</title>
<para>
Column holding usernames in the table.
</para>
<para>
<emphasis>
Default value is <quote>username</quote>.
</emphasis>
</para>
<example>
<title>Set <varname>user_column</varname> parameter</title>
<programlisting format="linespecific">
...
modparam("uri", "user_column", "username")
...
</programlisting>
</example>
</section>
<section>
<title><varname>domain_column</varname> (string)</title>
<para>
Column holding domain in the table.
</para>
<para>
<emphasis>
Default value is <quote>domain</quote>.
</emphasis>
</para>
<example>
<title>Set <varname>domain_column</varname> parameter</title>
<programlisting format="linespecific">
...
modparam("uri", "domain_column", "domain")
...
</programlisting>
</example>
</section>
<section>
<title><varname>uriuser_column</varname> (string)</title>
<para>
Column holding &uri; username in the table.
</para>
<para>
<emphasis>
Default value is <quote>uri_user</quote>.
</emphasis>
</para>
<example>
<title>Set <varname>uriuser_column</varname> parameter</title>
<programlisting format="linespecific">
...
modparam("uri", "uriuser_column", "uri_user")
...
</programlisting>
</example>
</section>
<section id="use-uri-table">
<title><varname>use_uri_table</varname> (integer)</title>
<para>
Specify if the <quote>uri</quote> table should be used for checkings
instead of <quote>subscriber</quote> table. A non-zero value means true.
</para>
<para>
<emphasis>
Default value is <quote>0 (false)</quote>.
</emphasis>
</para>
<example>
<title>Set <varname>use_uri_table</varname> parameter</title>
<programlisting format="linespecific">
...
modparam("uri", "use_uri_table", 1)
...
</programlisting>
</example>
</section>
<section>
<title><varname>use_domain</varname> (integer)</title>
<para>
Specify if the domain part of the URI should be used to identify the
users (along with username). This is useful in multi domain setups, a
non-zero value means true.
</para>
<para>This parameter is only evaluated for calls to <quote>does_uri_exist</quote>,
all other functions checks the digest username and realm against the
given username, if the <quote>uri</quote> table is used.
</para>
<para>
<emphasis>
Default value is <quote>0 (false)</quote>.
</emphasis>
</para>
<example>
<title>Set <varname>use_domain</varname> parameter</title>
<programlisting format="linespecific">
...
modparam("uri", "use_domain", 1)
...
</programlisting>
</example>
</section>
</section>
<section>
<title>Exported Functions</title>
<section>
<title>
<function moreinfo="none">db_check_to()</function>
</title>
<para>
Check To username against &uri; table (if use_uri_table is set) or
digest credentials (no DB backend required).
</para>
<para>
This function can be used from REQUEST_ROUTE.
</para>
<example>
<title><function>db_check_to</function> usage</title>
<programlisting format="linespecific">
...
if (db_check_to()) {
...
};
...
</programlisting>
</example>
</section>
<section>
<title>
<function moreinfo="none">db_check_from()</function>
</title>
<para>
Check From username against &uri; table (if use_uri_table is set) or
digest credentials (no DB backend required).
</para>
<para>
This function can be used from REQUEST_ROUTE.
</para>
<example>
<title><function>db_check_from</function> usage</title>
<programlisting format="linespecific">
...
if (db_check_from()) {
...
};
...
</programlisting>
</example>
</section>
<section>
<title>
<function moreinfo="none">db_does_uri_exist()</function>
</title>
<para>
Check if username in the request &uri; belongs to an existing user.
</para>
<para>
As the checking is done against &uri; table (if use_uri_table is set)
or subscriber table.
</para>
<para>
This function can be used from REQUEST_ROUTE.
</para>
<example>
<title><function>db_does_uri_exist</function> usage</title>
<programlisting format="linespecific">
...
if (db_does_uri_exist()) {
...
};
...
</programlisting>
</example>
</section>
<section>
<title>
<function moreinfo="none">db_get_auth_id(string, var, var)</function>
</title>
<para>
Checks given uri-string username against &uri; table (if use_uri_table is set) or
subscriber table (database backend required).
Returns true if the user exists in the database, and sets the given variables to
the authentication id and realm corresponding to the given uri.
</para>
<para>
This function can be used from REQUEST_ROUTE.
</para>
<example>
<title><function>db_get_auth_id</function> usage</title>
<programlisting format="linespecific">
...
if (db_get_auth_id("$ru", "$avp(auth_id)", "$avp(auth_realm)")) {
...
};
...
</programlisting>
</example>
</section>
<section>
<title>
<function moreinfo="none">aaa_does_uri_exist([pvar])</function>
</title>
<para>
Checks from Radius if user@host in Request-&uri; or in
URI stored in pseudo variable argument belongs
to a local user. Can be used to decide if 404 or 480 should
be returned after lookup has failed. If yes, loads AVP
based on SIP-AVP reply items returned from Radius. Each
SIP-AVP reply item must have a string value of form:
</para>
<para>
<itemizedlist>
<listitem><para><emphasis>
value = SIP_AVP_NAME SIP_AVP_VALUE
</emphasis></para></listitem>
<listitem><para><emphasis>
SIP_AVP_NAME = STRING_NAME | '#'ID_NUMBER
</emphasis></para></listitem>
<listitem><para><emphasis>
SIP_AVP_VALUE = ':'STRING_VALUE | '#'NUMBER_VALUE
</emphasis></para></listitem>
</itemizedlist>
</para>
<para>
Returns 1 if Radius returns Access-Accept, -1 if Radius
returns Access-Reject, and -2 in case of internal
error.
</para>
<para>
This function can be used from REQUEST_ROUTE.
</para>
<example>
<title><function>aaa_does_uri_exist</function> usage</title>
<programlisting format="linespecific">
...
if (aaa_does_uri_exist()) {
...
};
...
</programlisting>
</example>
</section>
<section>
<title>
<function moreinfo="none">aaa_does_uri_user_exist([pvar])</function>
</title>
<para>
Similar to aaa_does_uri_exist, but check is done
based only on Request-URI user part or user stored in
pseudo variable argument. User should thus
be unique among all users, such as an E.164 number.
</para>
<para>
This function can be used from REQUEST_ROUTE.
</para>
<example>
<title><function>aaa_does_uri_user_exist</function> usage</title>
<programlisting format="linespecific">
...
if (aaa_does_uri_user_exist()) {
...
};
...
</programlisting>
</example>
</section>
<section>
<title>
<function moreinfo="none">is_user(username)</function>
</title>
<para>
Check if the username in credentials matches the given username.
</para>
<para>Meaning of the parameters is as follows:</para>
<itemizedlist>
<listitem>
<para><emphasis>username</emphasis> - Username string.
</para>
</listitem>
</itemizedlist>
<para>
This function can be used from REQUEST_ROUTE.
</para>
<example>
<title><function>is_user</function> usage</title>
<programlisting format="linespecific">
...
if (is_user("john")) {
...
};
...
</programlisting>
</example>
</section>
<section>
<title>
<function moreinfo="none">has_totag()</function>
</title>
<para>
Check if To header field uri contains tag parameter.
</para>
<para>
This function can be used from REQUEST_ROUTE.
</para>
<example>
<title><function>has_totag</function> usage</title>
<programlisting format="linespecific">
...
if (has_totag()) {
...
};
...
</programlisting>
</example>
</section>
<section>
<title>
<function moreinfo="none">uri_param(param)</function>
</title>
<para>
Find if Request URI has a given parameter with no value
</para>
<para>Meaning of the parameters is as follows:</para>
<itemizedlist>
<listitem>
<para><emphasis>param</emphasis> - parameter name to look for.
</para>
</listitem>
</itemizedlist>
<para>
This function can be used from REQUEST_ROUTE.
</para>
<example>
<title><function>uri_param</function> usage</title>
<programlisting format="linespecific">
...
if (uri_param("param1")) {
...
};
...
</programlisting>
</example>
</section>
<section>
<title>
<function moreinfo="none">uri_param(param,value)</function>
</title>
<para>
Find if Request URI has a given parameter with matching value
</para>
<para>Meaning of the parameters is as follows:</para>
<itemizedlist>
<listitem>
<para><emphasis>param</emphasis> - parameter name to look for.
</para>
</listitem>
<listitem>
<para><emphasis>value</emphasis> - parameter value to match.
</para>
</listitem>
</itemizedlist>
<para>
This function can be used from REQUEST_ROUTE.
</para>
<example>
<title><function>uri_param</function> usage</title>
<programlisting format="linespecific">
...
if (uri_param("param1","value1")) {
...
};
...
</programlisting>
</example>
</section>
<section>
<title>
<function moreinfo="none">add_uri_param(param)</function>
</title>
<para>
Add to RURI a parameter (name=value);
</para>
<para>Meaning of the parameters is as follows:</para>
<itemizedlist>
<listitem>
<para><emphasis>param</emphasis> - parameter to be appended in
<quote>name=value</quote> format.
</para>
</listitem>
</itemizedlist>
<para>
This function can be used from REQUEST_ROUTE.
</para>
<example>
<title><function>add_uri_param</function> usage</title>
<programlisting format="linespecific">
...
add_uri_param("nat=yes");
...
</programlisting>
</example>
</section>
<section>
<title>
<function moreinfo="none">tel2sip()</function>
</title>
<para>
Converts RURI, if it is tel URI, to SIP URI. Returns true, only if
conversion succeeded or if no conversion was needed (like RURI
was not tel URI.
</para>
<para>
This function can be used from REQUEST_ROUTE.
</para>
<example>
<title><function>tel2sip</function> usage</title>
<programlisting format="linespecific">
...
tel2sip();
...
</programlisting>
</example>
</section>
<section>
<title>
<function moreinfo="none">is_uri_user_e164(pseudo-variable)</function>
</title>
<para>
Checks if userpart of URI stored in pseudo variable is
E164 number.
</para>
<para>
This function can be used from REQUEST_ROUTE and FAILURE_ROUTE.
</para>
<example>
<title><function>is_uri_user_e164</function> usage</title>
<programlisting format="linespecific">
...
if (is_uri_user_e164("$fu")) { # Check From header URI user part
...
}
if (is_uri_user_e164("$avp(called)") {
# Check user part of URI stored in avp called
...
};
...
</programlisting>
</example>
</section>
</section>
</chapter>