-
Notifications
You must be signed in to change notification settings - Fork 909
/
avp.xml
543 lines (513 loc) · 18.7 KB
/
avp.xml
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
<?xml version='1.0'?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbookid/id/g/4.5/docbookx.dtd">
<refentry id="module.avp"
xmlns:serdoc="http://sip-router.org/xml/serdoc">
<refmeta>
<refentrytitle>avp</refentrytitle>
<manvolnum>7</manvolnum>
</refmeta>
<refnamediv>
<refname>avp</refname>
<refpurpose>Manipulation of Attributes</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<para>
The <command>avp</command> module provides various functions for
the manipulation of attributes.
</para>
<para>
The name is a left-over from earlier versions of SER where attributes
were called ‘attribute-value pairs’ or AVPs for short.
</para>
</refsect1>
<refsect1>
<title>Functions</title>
<refsect2 xml:id="function.append_attr_hf">
<title>
<function>append_attr_hf</function>
(<symbol>hf</symbol>,
<optional><symbol>attribute</symbol></optional>)
</title>
<para>
Allowed in request and failure processing.
</para>
<para>
The <function>append_attr_hf()</function> function appends a
new header field value to the header field named by the argument
<symbol>hf</symbol>. The new value will be populated with the
content of the attribute named by the argument
<symbol>attribute</symbol>. If the argument is missing, the content
is taken from the attribute with same name as the header field.
</para>
</refsect2>
<refsect2 xml:id="function.attr2uri">
<title>
<function>attr2uri</function>
(<symbol>attribute</symbol>,
<serdoc:optional><symbol>part</symbol></serdoc:optional>)
</title>
<para>
Allowed in request and failure processing.
</para>
<para>
The <function>attr2uri()</function> function sets the Request-URI
to the content of the attribute named by the argument
<symbol>attribute</symbol>. If the argument <symbol>part</symbol>
is present, only the part of the Request-URI identified by it
will be changed. This mimiks the behavior of many of the core
functions that allow manipulation of the Request-URI.
</para>
<para>
The following values are allowed for the <symbol>part</symbol>
argument:
</para>
<variablelist>
<varlistentry>
<term><literal>domain</literal>, <literal>host</literal></term>
<listitem>
replace the host part of the Request-URI,
</listitem>
</varlistentry>
<varlistentry>
<term>
<literal>domainport</literal>, <literal>hostport</literal>
</term>
<listitem>
replace the host and port parts of the Request-URI,
</listitem>
</varlistentry>
<varlistentry>
<term><literal>port</literal></term>
<listitem>
replace the port part of the Request-URI,
</listitem>
</varlistentry>
<varlistentry>
<term><literal>prefix</literal></term>
<listitem>
prefix the content of the attribute to the username part of
the Request-URI,
</listitem>
</varlistentry>
<varlistentry>
<term><literal>strip</literal></term>
<listitem>
the attribute contains an integer specifying the number of
characters to be stripped off the beginning of the username
part of the Request-URI,
</listitem>
</varlistentry>
<varlistentry>
<term><literal>strip_tail</literal></term>
<listitem>
the attribute contains an integer specifyin the number of
characters to be stripped off the end of the username part of
the Request-URI,
</listitem>
</varlistentry>
<varlistentry>
<term><literal>uri</literal></term>
<listitem>
replace the entire Request-URI,
</listitem>
</varlistentry>
<varlistentry>
<term><literal>user</literal>, <literal>username</literal></term>
<listitem>
replace the username part of the Request-URI,
</listitem>
</varlistentry>
<varlistentry>
<term>
<literal>userpass</literal>,
<literal>usernamepassword</literal>
</term>
<listitem>
replace the username and password parts of the Request-URI.
</listitem>
</varlistentry>
</variablelist>
</refsect2>
<refsect2 xml:id="function.attr_destination">
<title>
<function>attr_destination</function>
(<symbol>attribute</symbol>)
</title>
<para>
Allowed in request and failure processing.
</para>
<para>
The <function>attr_destination()</function> function sets the
destination URI to the content of the attribute named by the
argument <symbol>attribute</symbol>.
</para>
<para>
If the destination URI is set, the request will be send to the
address determined from that URI instead of the Request-URI. It
will carried over into branches together with the Request-URI when a
call to <serdoc:func>append_branch</serdoc:func> is made.
</para>
</refsect2>
<refsect2 xml:id="function.attr_equals">
<title>
<function>attr_equals</function>
(<symbol>attribute</symbol>, <symbol>value</symbol>)
</title>
<para>
Allowed in request, reply, and failure processing.
</para>
<para>
The <function>attr_equals()</function> function checks whether
the attribute identified by the argument <symbol>attribute</symbol>
exists and its value is identical the value given by the
argument <symbol>value</symbol>. If so, it returns
<literal>true</literal> and <literal>false</literal> otherwise.
</para>
</refsect2>
<refsect2 xml:id="function.attr_equals_xl">
<title>
<function>attr_equals_xl</function>
(<symbol>attribute</symbol>, <symbol>value</symbol>)
</title>
<para>
Allowed in request, reply, and failure processing.
</para>
<para>
The <function>attr_equals()</function> function checks whether
the attribute identified by the argument <symbol>attribute</symbol>
exists and its value is identical to the xl string given by the
argument <symbol>value</symbol>. If so, it returns
<literal>true</literal> and <literal>false</literal> otherwise.
</para>
<para>
For more information on xl strings, see
<serdoc:module>xprint</serdoc:module>.
</para>
</refsect2>
<refsect2 xml:id="function.attr_exists">
<title>
<function>attr_exists</function>
(<symbol>attribute</symbol>)
</title>
<para>
Allowed in request, reply, and failure processing.
</para>
<para>
The <function>attr_exists()</function> function checks whether
an attribute by the name given by the name of
<symbol>attribute</symbol> exists and returns
<literal>true</literal> in this case or <literal>false</literal>
otherwise.
</para>
</refsect2>
<refsect2 xml:id="function.attr_to_reply">
<title>
<function>attr_to_reply</function>
(<symbol>hf</symbol>,
<serdoc:optional><symbol>attribute</symbol></serdoc:optional>)
</title>
<para>
Allowed in request and failure processing.
</para>
<para>
The <function>attr_to_reply()</function> function adds a new
header fields value to the final response that will eventually
be sent upstream. The name of the header field is given by the
argument <symbol>hf</symbol>. The content will be taken from an
attribute. If the argument <symbol>attribute</symbol> is present,
it contains the name of the attribute. Otherwise, the header field
name from the argument <symbol>hf</symbol> will be taken as the
name.
</para>
</refsect2>
<refsect2 xml:id="function.del_attr">
<title>
<function>del_attr</function>
(<symbol>attribute</symbol>)
</title>
<para>
Allowed in request, reply, and failure processing.
</para>
<para>
The <function>del_attr</function> function deletes the attribute
identified by the argument <symbol>attribute</symbol>.
</para>
</refsect2>
<refsect2 xml:id="function.del_attrs">
<title>
<function>del_attrs</function>
(<symbol>group</symbol>)
</title>
<para>
Allowed in request, reply, and failure processing.
</para>
<para>
The <function>del_attrs()</function> function deletes all
attributes from the group of attributes identified by the
attribute prefix given through the argument <symbol>group</symbol>.
For example, to delete all attributes of the From user, call
</para>
<programlisting>
del_attrs("$fu");
</programlisting>
</refsect2>
<refsect2 xml:id="function.dump_attrs">
<title>
<function>dump_attrs</function>
(<serdoc:optional><symbol>group</symbol></serdoc:optional>)
</title>
<para>
Allowed in request, reply, and failure processing.
</para>
<para>
The <function>dump_attrs()</function> dumps a list of the existing
attributes and their values to the system log. If the
<symbol>group</symbol> argument is present, it contains an
attribute namespace prefix and limits the output to the attrbutes
in that namespace.
</para>
</refsect2>
<refsect2 xml:id="function.flags2attr">
<title>
<function>flags2attr</function>
(<symbol>attribute</symbol>)
</title>
<para>
Allowed in request, reply, and failure processing.
</para>
<para>
The <function>flags2attr()</function> function stores the current
state of all the flags in compact form in the attribute identified
by the argument <symbol>attribute</symbol>.
</para>
</refsect2>
<refsect2 xml:id="function.insert_attr_hf">
<title>
<function>insert_attr_hf</function>
(<symbol>hf</symbol>,
<serdoc:optional><symbol>attribute</symbol></serdoc:optional>)
</title>
<para>
Allowed in request and failure processing.
</para>
<para>
The <function>insert_attr_hf()</function> function inserts a
header field value to the header field named by the argument
<symbol>hf</symbol> with the value of the attribute identified
by the argument <symbol>attribute</symbol>. If there are already
values for that header field, the new value will be prepended
before any existing value.
</para>
<para>
If the optional argument <symbol>attribute</symbol> is missing,
the name of the attribute is taken from the name of the header
field in argument <symbol>hf</symbol>.
</para>
</refsect2>
<refsect2 xml:id="function.print_attr">
<title>
<function>print_attr</function>
(<symbol>attribute</symbol>)
</title>
<para>
Allowed in request, reply, and failure processing.
</para>
<para>
The <function>print_attr()</function> function prints the content
of the attribute identified by the argument
<symbol>attribute</symbol> to the system log.
</para>
<para>
For a more flexible way of printing messages to the system log
that allows to print extra information together with the attribute
value, see the <serdoc:module>xprint</serdoc:module> module.
</para>
</refsect2>
<refsect2 xml:id="function.replace_attr_hf">
<title>
<function>replace_attr_hf</function>
(<symbol>hf</symbol>,
<serdoc:optional><symbol>attribute</symbol></serdoc:optional>)
</title>
<para>
Allowed in request and failure processing.
</para>
<para>
The <function>replace_attr_hf()</function> function removes all
header field values of the header field named by the argument
<symbol>hf</symbol> and adds a new header field value with the
content of the attribute identified by the argument
<symbol>attribute</symbol>. If the argument
<symbol>attribute</symbol> is missing, the content of the new
header field value will be taken from an argument with the same
name as the header field.
</para>
</refsect2>
<refsect2 xml:id="function.set_attr">
<title>
<function>set_attr</function>
(<symbol>attribute</symbol>, <symbol>value</symbol>)
</title>
<para>
Allowed in request, reply, and failure processing.
</para>
<para>
The <function>set_attr()</function> function is a synonym for
the <serdoc:func>set_sattr</serdoc:func> function and sets the
attribute identified by the argument <symbol>attribute</symbol>
to the string contained in the argument <symbol>value</symbol>.
</para>
<para>
Like <serdoc:func>set_sattr</serdoc:func>, it is identical to
assinging an string using the assignment operator and is
deprecated.
</para>
</refsect2>
<refsect2 xml:id="function.set_iattr">
<title>
<function>set_iattr</function>
(<symbol>attribute</symbol>, <symbol>value</symbol>)
</title>
<para>
Allowed in request, reply, and failure processing.
</para>
<para>
The <function>set_iattr()</function> function sets the attribute
identified by the argument <symbol>attribute</symbol> to the
integer value contained in the argument <symbol>value</symbol>.
If the attribute does not yet exist, it is created.
</para>
<para>
This function is identical to assinging an integer using the
assignment operator and
is only kept to retain compatibility with earlier versions of SER.
It therefore is deprecated and may be removed in the future.
</para>
</refsect2>
<refsect2 xml:id="function.set_sattr">
<title>
<function>set_sattr</function>
(<symbol>attribute</symbol>, <symbol>value</symbol>)
</title>
<para>
Allowed in request, reply, and failure processing.
</para>
<para>
The <function>set_sattr()</function> function sets the attribute
identified by the argument <symbol>attribute</symbol> to the
string contained in the argument <symbol>value</symbol>. If the
attribute does not yet exist, it is created.
</para>
<para>
This function is identical to assinging an string using the
assignment operator and
is only kept to retain compatibility with earlier versions of SER.
It therefore is deprecated and may be removed in the future.
</para>
</refsect2>
<refsect2 xml:id="function.subst_attr">
<title>
<function>subst_attr</function>
(<symbol>attribute</symbol>, <symbol>subst</symbol>)
</title>
<para>
Allowed in request, reply, and failure processing.
</para>
<para>
The <function>subst_attr()</function> function manipulates the
content of the attribute identified by the argument
<symbol>attribute</symbol> using a subst expression.
</para>
<para>
A subst expression is identical to the expression used by the
<serdoc:bin>sed</serdoc:bin> program’s s command.
</para>
<!-- XXX We should either explain them in detail here, or in textops
or in the admin guide. In any case, there needs to be a
reference to the explanation.
-->
</refsect2>
<refsect2 xml:id="function.xlfix_attr">
<title>
<function>xlfix_attr</function>
(<symbol>attribute</symbol>)
</title>
<para>
Allowed in request, reply, and failure processing.
</para>
<para>
The <function>xlfix_attr()</function> function evaluates the xl
string contained in the attributed identified by the argument
<symbol>attribute</symbol> and stores the result of the evaluation
in the same attribute.
</para>
<para>
For more information on xl strings, see
<serdoc:module>xprint</serdoc:module>.
</para>
</refsect2>
<refsect2 xml:id="function.xlset_attr">
<title>
<function>xlset_attr</function>
(<symbol>attribute</symbol>, <symbol>value</symbol>)
</title>
<para>
Allowed in request, reply, and failure processing.
</para>
<para>
The <function>xlset_attr()</function> function sets the attribute
identified by the argument <symbol>attribute</symbol> to the
evaluated xl string given by the argument <symbol>value</symbol>.
</para>
<para>
For more information on xl strings, see
<serdoc:module>xprint</serdoc:module>.
</para>
</refsect2>
<refsect2 xml:id="function.xlset_destination">
<title>
<function>xlset_destination</function>
(<symbol>value</symbol>)
</title>
<para>
Allowed in request processing only.
</para>
<para>
The <function>xlset_destination()</function> function sets the
destination URI to the evaluated content of the xl string given
by the argument <symbol>value</symbol>.
</para>
<para>
For details on xl strings, see <serdoc:module>xprint</serdoc:module>.
</para>
</refsect2>
</refsect1>
<refsect1>
<title>Module Parameters</title>
<refsect2 xml:id="module.avp.xlbuf_size">
<title><parameter>xlbuf_size</parameter></title>
<serdoc:paraminfo>
<serdoc:paramtype>integer</serdoc:paramtype>
<serdoc:paramdefault>256</serdoc:paramdefault>
</serdoc:paraminfo>
<para>
The <parameter>xlbuf_size</parameter> parameter defines the size
of the buffer that used for evaluation of xl strings. The evaluated
string cannot be larger than the size given by this parameter.
</para>
</refsect2>
</refsect1>
<refsect1 role="manpage">
<title>See Also</title>
<simplelist type="inline">
<member><serdoc:sbin>ser</serdoc:sbin></member>
<member><serdoc:file>ser.cfg</serdoc:file></member>
<member><serdoc:module>avp_db</serdoc:module></member>
<member><serdoc:module>avp_radius</serdoc:module></member>
</simplelist>
</refsect1>
</refentry>
<!-- vim:sw=2 sta et sts=2 ai tw=76
-->