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 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270
|
<!-- Acc Module User's Guide -->
<chapter>
<chapterinfo>
<revhistory>
<revision>
<revnumber>$Revision: 1.11 $</revnumber>
<date>$Date: 2006/01/13 15:05:36 $</date>
</revision>
</revhistory>
</chapterinfo>
<title>User's Guide</title>
<section>
<title>Overview</title>
<para>
acc module is used to report on transactions to syslog,
<abbrev>SQL</abbrev>, <acronym>RADIUS</acronym> and
<acronym>DIAMETER</acronym> (beta version).
</para>
<para>
To report on a transaction using syslog, use <quote>setflag</quote>
to mark a transaction you are interested in with a flag, load
accounting module and set its <quote>log_flag</quote> to the same
flag number. The acc module will then report on completed transaction
to syslog. A typical usage of the module takes no acc-specific
script command -- the functionality binds invisibly through
transaction processing. Script writers just need to mark the
transaction for accounting with proper setflag.
</para>
<para>
What is printed depends on module's <quote>log_fmt</quote> parameter.
It's a string with characters specifying which parts of request
should be printed:
<itemizedlist>
<listitem>
<para>n = Cseq number</para>
</listitem>
<listitem>
<para>c = Call-Id</para>
</listitem>
<listitem>
<para>m = Method</para>
</listitem>
<listitem>
<para>i = Inbound Request-URI</para>
</listitem>
<listitem>
<para>o = Outbound Request-URI</para>
</listitem>
<listitem>
<para>p = Username part of inbound Request-URI</para>
</listitem>
<listitem>
<para>D = Domain part of inbound Request-URI</para>
</listitem>
<listitem>
<para>f = From header</para>
</listitem>
<listitem>
<para>r = From TAG</para>
</listitem>
<listitem>
<para>F = From URI</para>
</listitem>
<listitem>
<para>0 = From URI user part</para>
</listitem>
<listitem>
<para>X = From URI domain part</para>
</listitem>
<listitem>
<para>t = To header</para>
</listitem>
<listitem>
<para>d = To TAG</para>
</listitem>
<listitem>
<para>T = To URI</para>
</listitem>
<listitem>
<para>1 = To URI user part</para>
</listitem>
<listitem>
<para>S = 3-digit Status code from reply</para>
</listitem>
<listitem>
<para>s = Status</para>
</listitem>
<listitem>
<para>U = User name (digest, From URI otherwise)</para>
</listitem>
<listitem>
<para>u = digest Username</para>
</listitem>
</itemizedlist>
If a value is not present in request, "n/a" is accounted instead.
</para>
<para>
Note that:
<itemizedlist>
<listitem>
<para>
A single INVITE may produce multiple accounting reports -- that's
due to SIP forking feature
</para>
</listitem>
<listitem>
<para>
Subsequent ACKs and other requests do not hit the server and
can't be accounted unless record-routing is enforced.
The ACKs assert very little useful information anyway and
reporting on INVITE's 200 makes most accounting scenarios happy.
</para>
</listitem>
<listitem>
<para>
There is no session accounting -- &ser; maintains no sessions.
If one needs to correlate INVITEs with BYEs for example for
purpose of billing, then it is better done in the entity which
collects accounting information. Otherwise, SIP server would
have to become sessions-stateful, which would very badly
impact its scalability.
</para>
</listitem>
<listitem>
<para>
If a UA fails in middle of conversation, a proxy will never
learn it. In general, a better practice is to account from an
end-device (such as PSTN gateway), which best knows about call
status (including media status and PSTN status in case of the
gateway).
</para>
</listitem>
</itemizedlist>
</para>
<para>
Support for SQL, RADIUS and DIAMETER works analogously. The SQL support
is compiled in the moduls. For RADIUS and DIAMETER you need to
enable it by recompiling the module with properly set defines:
uncomment the RAD_ACC or DDIAM_ACC lines in
modules/acc/Makefile. To compile RADIUS support,
you need to have radiusclient-ng (only versions higher or equal
to 0.5.0) installed on your system which is available from
<ulink url='http://developer.berlios.de/projects/radiusclient-ng/'>
http://developer.berlios.de/projects/radiusclient-ng/</ulink>.
The radius client needs to be configured properly. To do so, use the
template at etc/radiusclient.conf and make sure
that module's radius_config parameter points to its location.
In particular, accounting secret must match that one configured in
server and proper dictionary is used (one is available at
etc/sip_dictionary). Uses along with FreeRadius
(<ulink url='http://www.freeradius.org/'>
http://www.freeradius.org/</ulink>) and Radiator
(<ulink url='http://www.open.com.au/radiator/'>
http://www.open.com.au/radiator/</ulink>) servers have been
reported to us.
</para>
<para>
For Radius support, the radius libraries must be dynamically linkable.
You need to configure your OS so that &ser;, when started, will
find it. Typically, you do so by manipulating
LD_LIBRARY_PATH environment variable or configuring ld.so.
</para>
<section>
<title>General Example</title>
<programlisting format="linespecific">
loadmodule "modules/acc/acc.so"
modparam("acc", "log_level", 1)
modparam("acc", "log_flag", 1)
if (uri=~"sip:+40") /* calls to Romania */ {
if (!proxy_authorize("sip_domain.net" /* realm */,
"subscriber" /* table name */)) {
proxy_challenge("sip_domain.net" /* realm */, "0" /* no qop */ );
break;
}
if (method=="INVITE" & !check_from()) {
log("from!=digest\n");
sl_send_reply("403","Forbidden");
break;
}
setflag(1); /* set for accounting (the same value as in log_flag!)
t_relay(); /* enter stateful mode now */
};
</programlisting>
</section>
</section>
<section>
<title>Extra accounting</title>
<section>
<title>Overview</title>
<para>
Along the static information defined via FMT-s, ACC modules
allows dynamical selection of extra information to be logged.
There are two classes of information that are accessible by
extra accounting: data from SIP messages (as headers) and
internal &ser; data (as AVPs).
</para>
</section>
<section>
<title>Definitions and syntax</title>
<para>
Selection of extra information is done via
<emphasis>xxx_extra<emphasis> parameters by specifying the names
of additional information you want to log. This information is
defined via pseudo-variables and may include headers or AVPs values
or other message or system values. The syntax of the parameter is:
</para>
<itemizedlist>
<listitem><para><emphasis>
xxx_extra = extra_definition (';'extra_definition)*
</emphasis></para></listitem>
<listitem><para><emphasis>
extra_definition = log_name '=' pseudo_variable
</emphasis></para></listitem>
</itemizedlist>
<para>
The full list of supported pseudo-variables in &ser; is availabe
at:
<ulink url="http://openser.org/docs/pseudo-variables-1.1.x.html">
http://openser.org/docs/pseudo-variables-1.1.x.html</ulink>
</para>
<para>
Via <emphasis>log_name</emphasis> you define how/where the
<emphasis>data</emphasis> will be logged. Its meaning depends
of the accounting support which is used:
<itemizedlist>
<listitem><para><emphasis>LOG accounting</emphasis> - log_name
will be just printed along with the data in <emphasis>
log_name=data</emphasis> format;
</para></listitem>
<listitem><para><emphasis>DB accounting</emphasis> - log_name
will be the name of the DB column where the data will be
stored.<emphasis>IMPORTANT<emphasis>: add in db
<emphasis>acc</emphasis> table the columns corresponding to
each extra data;
</para></listitem>
<listitem><para><emphasis>RADIUS accounting</emphasis> -
log_name will be the AVP name used for packing the data into
RADIUS message. The log_name will be translated to AVP number
via the dictionary. <emphasis>IMPORTANT<emphasis>: add in
RADIUS dictionary the <emphasis>log_name</emphasis> attribute.
</para></listitem>
<listitem><para><emphasis>DIAMETER accounting</emphasis> -
log_name will be the AVP code used for packing the data
into DIAMETER message. The AVP code is given directly as
integer, since DIAMETER has no dictionary support yet.
<emphasis>IMPORTANT</emphasis>: <emphasis>log_name</emphasis>
must be a number.
</para></listitem>
</itemizedlist>
</para>
</section>
<section>
<title>How it works</title>
<para>
Some pseudo variables may return more than one value (like
headers or AVPs). In this case, the returned values are
embedded in a single string in a comma-separated format.
</para>
</section>
</section>
<section id="multi-call-legs">
<title>Multi Call-Legs accounting</title>
<section>
<title>Overview</title>
<para>
A SIP call can have multiple legs due forwarding actions. For
example user A calls user B which forwards the call to user C.
There is only one SIP call but with 2 legs ( A to B and B to C).
Accounting the legs of a call is required for proper billing of
the calls (if C is a PSTN number and the call is billed, user B
must pay for the call -as last party modifing the call
destination-, and not A -as initiator of the call. Call
forwarding on server is only one example which shows the
necessity of the having an accounting engine with multiple legs
support.
</para>
</section>
<section>
<title>Configuration</title>
<para>
First how it works? The idea is to store in several &ser; AVP
pairs the originator and destination for each call-leg. For the
A call B and B forwards to C example, the AVP pairs are (A,B) and
(B,C). There are two type of AVPs -source and destination- which
refined a call-leg. The administator must take care and to
properly insert these AVP from the script (in proper order and
with correct type).
</para>
<para>
When the accouning infomation for the call will be written/sent,
all the call-leg pairs will be added (based on found AVP pairs).
</para>
<para>
By default, the multiple call-legs support is disable - it can be
enabled via the <varname>multi_leg_enabled</varname> module
parameter. By enabling it, you will have also to define the AVPs
to be used for source and destination (which define one call-leg).
From performance reasons, the AVPs may be specified only via IDs.
</para>
</section>
<section>
<title>Logged data</title>
<para>
For each call, all the source-destination pairs (which defined a
call-leg) will be looged. How the information will be actually
logged, depends of the data backend:
</para>
<itemizedlist>
<listitem>
<para><emphasis>syslog</emphasis> -- all pairs will be added
to one record string as src_leg=xxx, dst_leg=xxxx pairs.
</para>
</listitem>
<listitem>
<para><emphasis>database</emphasis> -- each pair will be
separatly logged (due DB data structure constraints); several
records will be written, the difference between them being
only the source & destination of the corresponding call-leg.
with database support.</para>
<note><para>You will need to add in your DB (all acc related
tables) the two colums for call-leg definition (source and
destination).
</para></note>
</listitem>
<listitem>
<para><emphasis>Radius</emphasis> -- all pairs will be added
to same Radius accounting message as RADIUS AVPs - for each
call-leg two RADIUS AVPs will be added: source and
destination
</para>
<note><para>You will need to add in your dictionaty the two
RADIUS AVPs used for call-leg definition (source and
destination): Sip-Leg-Source and Sip-Leg-Destination
</para></note>
</listitem>
<listitem>
<para><emphasis>Diameter</emphasis> -- not supported.
with database support.</para>
</listitem>
</itemizedlist>
</section>
</section>
<section>
<title>Dependencies</title>
<section>
<title>&ser; Modules</title>
<para>
The module depends on the following modules (in the other words
the listed modules must be loaded before this module):
<itemizedlist>
<listitem>
<para><emphasis>tm</emphasis> -- Transaction Manager</para>
</listitem>
<listitem>
<para><emphasis>a database module</emphasis> -- If database
support is used.</para>
</listitem>
<listitem>
<para><emphasis>rr</emphasis> -- Record Route, if
<quote>detect_direction</quote> module parameter is enabled.
</para>
</listitem>
</itemizedlist>
</para>
</section>
<section>
<title>External Libraries or Applications</title>
<para>
The following libraries or applications must be installed
before running &ser; with this module loaded:
<itemizedlist>
<listitem>
<para><emphasis>radiusclient-ng</emphasis> 0.5.0 or higher --
if compiled with RADIUS support. See <ulink
url='http://developer.berlios.de/projects/radiusclient-ng/'>
http://developer.berlios.de/projects/radiusclient-ng/</ulink>.
</para>
</listitem>
</itemizedlist>
</section>
</section>
<section>
<title>Exported Parameters</title>
<!-- Generic ACC parameters -->
<section>
<title><varname>early_media</varname> (integer)</title>
<para>
Should be early media (183) accounted too ?
</para>
<para>
Default value is 0 (no).
</para>
<example>
<title>early_media example</title>
<programlisting format="linespecific">
modparam("acc", "early_media", 1)
</programlisting>
</example>
</section>
<section>
<title><varname>failed_transaction_flag</varname> (integer)</title>
<para>
Per transaction flag which says if the transaction should be
accounted also in case of failure (status>=300).
</para>
<para>
Default value is 0 (no flag).
</para>
<example>
<title>failed_transaction_flag example</title>
<programlisting format="linespecific">
modparam("acc", "failed_transaction_flag", 4)
</programlisting>
</example>
</section>
<section>
<title><varname>report_ack</varname> (integer)</title>
<para>
Shall acc attempt to account e2e ACKs too ? Note that this is really
only an attempt, as e2e ACKs may take a different path
(unless RR enabled) and mismatch original INVITE (e2e ACKs are
a separate transaction).
</para>
<para>
Default value is 1 (yes).
</para>
<example>
<title>report_ack example</title>
<programlisting format="linespecific">
modparam("acc", "report_ack", 0)
</programlisting>
</example>
</section>
<section>
<title><varname>report_cancels</varname> (integer)</title>
<para>
By default, CANCEL reporting is disabled -- most accounting
applications are happy to see INVITE's cancellation status.
Turn on if you explicitly want to account CANCEL transactions.
</para>
<para>
Default value is 0 (no).
</para>
<example>
<title>report_cancels example</title>
<programlisting format="linespecific">
modparam("acc", "report_cancels", 1)
</programlisting>
</example>
</section>
<section>
<title><varname>multi_leg_enabled</varname> (integer)</title>
<para>
If set to a non 0 value, it will enables the logging of the
call-legs. See <xref linkend="multi-call-legs"> for a
detailed description of the Multi Call-Legs accounting.
</para>
<para>
Default value is 0 (disabled).
</para>
<example>
<title>multi_leg_enabled example</title>
<programlisting format="linespecific">
modparam("acc", "multi_leg_enabled", 1)
</programlisting>
</example>
</section>
<section>
<title><varname>src_leg_avp_id</varname> (integer)</title>
<para>
Defines the AVP (ID AVP) which contains the source URI part of a
call-leg. See <xref linkend="multi-call-legs"> for a
detailed description of the Multi Call-Legs accounting.
</para>
<para>
Default value is 0 (undefined).
</para>
<example>
<title>src_leg_avp_id example</title>
<programlisting format="linespecific">
modparam("acc", "src_leg_avp_id", 110)
</programlisting>
</example>
</section>
<section>
<title><varname>dst_leg_avp_id</varname> (integer)</title>
<para>
Defines the AVP (ID AVP) which contains the destination URI part of a
call-leg. See <xref linkend="multi-call-legs"> for a
detailed description of the Multi Call-Legs accounting.
</para>
<para>
Default value is 0 (undefined).
</para>
<example>
<title>dst_leg_avp_id example</title>
<programlisting format="linespecific">
modparam("acc", "dst_leg_avp_id", 110)
</programlisting>
</example>
</section>
<!-- SYSLOG specific ACC parameters -->
<section>
<title><varname>log_flag</varname> (integer)</title>
<para>
Request flag which needs to be set to account a transaction.
</para>
<para>
Default value is 1.
</para>
<example>
<title>log_flag example</title>
<programlisting format="linespecific">
modparam("acc", "log_flag", 2)
</programlisting>
</example>
</section>
<section>
<title><varname>log_missed_flag</varname> (integer)</title>
<para>
Request flag which needs to be set to account missed calls.
</para>
<para>
Default value is 2.
</para>
<example>
<title>log_missed_flag example</title>
<programlisting format="linespecific">
modparam("acc", "log_missed_flag", 3)
</programlisting>
</example>
</section>
<section>
<title><varname>log_level</varname> (integer)</title>
<para>
Log level at which accounting messages are issued to syslog.
</para>
<para>
Default value is L_NOTICE.
</para>
<example>
<title>log_level example</title>
<programlisting format="linespecific">
modparam("acc", "log_level", 2) # Set log_level to 2
</programlisting>
</example>
</section>
<section>
<title><varname>log_fmt</varname> (string)</title>
<para>
Defines what parts of header fields will be printed to
syslog, see <quote>overview</quote> for list of accepted values.
</para>
<para>
Default value is <quote>miocfs</quote>.
</para>
<example>
<title>log_fmt example</title>
<programlisting format="linespecific">
modparam("acc", "log_fmt", "mfs")
</programlisting>
</example>
</section>
<section>
<title><varname>log_extra</varname> (string)</title>
<para>
Extra values to be logged.
</para>
<para>
Default value is NULL.
</para>
<example>
<title>log_extra example</title>
<programlisting format="linespecific">
modparam("acc", "log_extra", "ua=$hdr(User-Agent);uuid=$avp(i:123)")
</programlisting>
</example>
</section>
<!-- RADIUS specific ACC parameters -->
<section>
<title><varname>radius_config</varname> (string)</title>
<para>
<emphasis>This parameter is radius specific.</emphasis> Path to
radius client configuration file, set the referred config file
correctly and specify there address of server, shared secret
(should equal that in /usr/local/etc/raddb/clients for
freeRadius servers) and dictionary, see etc for an example of
config file and dictionary.
</para>
<para>
Default value is <quote>/usr/local/etc/radiusclient/radiusclient.conf
</quote>.
</para>
<example>
<title>radius_config example</title>
<programlisting format="linespecific">
modparam("acc", "radius_config", "/etc/radiusclient/radiusclient.conf")
</programlisting>
</example>
</section>
<section>
<title><varname>radius_flag</varname> (integer)</title>
<para>
Request flag which needs to be set to account a
transaction -- RADIUS specific.
</para>
<para>
Default value is 1.
</para>
<example>
<title>radius_flag example</title>
<programlisting format="linespecific">
modparam("acc", "radius_flag", 2)
</programlisting>
</example>
</section>
<section>
<title><varname>radius_missed_flag</varname> (integer)</title>
<para>
Request flag which needs to be set to account missed
calls -- RADIUS specific.
</para>
<para>
Default value is 2.
</para>
<example>
<title>radius_missed_flag example</title>
<programlisting format="linespecific">
modparam("acc", "radius_missed_flag", 3)
</programlisting>
</example>
</section>
<section>
<title><varname>service_type</varname> (integer)</title>
<para>
Radius service type used for accounting.
</para>
<para>
Default value is 15 (SIP).
</para>
<example>
<title>service_type example</title>
<programlisting format="linespecific">
modparam("acc", "service_type", 16)
</programlisting>
</example>
</section>
<section>
<title><varname>radius_extra</varname> (string)</title>
<para>
Extra values to be logged via RADIUS - RADIUS specific.
</para>
<para>
Default value is NULL.
</para>
<example>
<title>radius_extra example</title>
<programlisting format="linespecific">
modparam("acc", "radius_extra", "via=$hdr(Via[*]); email=$avp(s:email)")
</programlisting>
</example>
</section>
<!-- DIAMETER specific ACC parameters -->
<section>
<title><varname>diameter_flag</varname> (integer)</title>
<para>
Request flag which needs to be set to account a
transaction -- DIAMETER specific.
</para>
<para>
Default value is 1.
</para>
<example>
<title>diameter_flag example</title>
<programlisting format="linespecific">
modparam("acc", "diameter_flag", 2)
</programlisting>
</example>
</section>
<section>
<title><varname>diameter_missed_flag</varname> (integer)</title>
<para>
Request flag which needs to be set to account missed
calls -- DIAMETER specific.
</para>
<para>
Default value is 2.
</para>
<example>
<title>diameter_missed_flag example</title>
<programlisting format="linespecific">
modparam("acc", "diameter_missed_flag", 3)
</programlisting>
</example>
</section>
<section>
<title><varname>diameter_client_host</varname> (string)</title>
<para>
Hostname of the machine where the DIAMETER Client is
running -- DIAMETER specific.
</para>
<para>
Default value is <quote>localhost</quote>.
</para>
<example>
<title>diameter_client_host example</title>
<programlisting format="linespecific">
modparam("acc", "diameter_client_host", "3a_server.net")
</programlisting>
</example>
</section>
<section>
<title><varname>diameter_client_port</varname> (int)</title>
<para>
Port number where the Diameter Client is
listening -- DIAMETER specific.
</para>
<para>
Default value is 3000.
</para>
<example>
<title>diameter_client_host example</title>
<programlisting format="linespecific">
modparam("acc", "diameter_client_port", 3000)
</programlisting>
</example>
</section>
<section>
<title><varname>diamter_extra</varname> (string)</title>
<para>
Extra values to be logged via DIAMETER - DIAMETER specific.
</para>
<para>
Default value is NULL.
</para>
<example>
<title>diameter_extra example</title>
<programlisting format="linespecific">
modparam("acc", "diameter_extra", "7846=$hdr(Content-type);7847=$avp(s:email)")
</programlisting>
</example>
</section>
<!-- SQL specific ACC parameters -->
<section>
<title><varname>db_flag</varname> (integer)</title>
<para>
Request flag which needs to be set to account a
transaction -- database specific.
</para>
<para>
Default value is 1.
</para>
<example>
<title>db_flag example</title>
<programlisting format="linespecific">
modparam("acc", "db_flag", 2)
</programlisting>
</example>
</section>
<section>
<title><varname>db_missed_flag</varname> (integer)</title>
<para>
Request flag which needs to be set to account missed
calls -- database specific.
</para>
<para>
Default value is 2.
</para>
<example>
<title>db_missed_flag example</title>
<programlisting format="linespecific">
modparam("acc", "db_missed_flag", 3)
</programlisting>
</example>
</section>
<section>
<title><varname>db_table_acc</varname> (string)</title>
<para>
Table name of accounting successfull calls -- database specific.
</para>
<para>
Default value is <quote>acc</quote>
</para>
<example>
<title>db_table_acc example</title>
<programlisting format="linespecific">
modparam("acc", "db_table_acc", "myacc_table")
</programlisting>
</example>
</section>
<section>
<title><varname>db_table_missed_calls</varname> (string)</title>
<para>
Table name for accounting missed calls -- database specific.
</para>
<para>
Default value is <quote>missed_calls</quote>
</para>
<example>
<title>db_table_missed_calls example</title>
<programlisting format="linespecific">
modparam("acc", "db_table_missed_calls", "myMC_table")
</programlisting>
</example>
</section>
<section>
<title><varname>db_url</varname> (string)</title>
<para>
SQL address -- database specific. If is set to NULL or emty string,
the SQL support is disabled.
</para>
<para>
Default value is <quote>NULL</quote> (SQL disabled).
</para>
<example>
<title>db_url example</title>
<programlisting format="linespecific">
modparam("acc", "db_url", "mysql://user:password@localhost/openser")
</programlisting>
</example>
</section>
<section>
<title><varname>db_localtime</varname> (int)</title>
<para>
If DB timestamps should follow localtime or GMT time. Any non-zero value
enables this option.
</para>
<para>
Default value is <quote>0</quote>.
</para>
<example>
<title>db_localtime example</title>
<programlisting format="linespecific">
modparam("acc", "db_localtime", 1) # use GMT time
</programlisting>
</example>
</section>
<section>
<title><varname>acc_sip_from_column</varname> (string)</title>
<para>
Column name in accouting table to store the
<quote>sip_from</quote> value.
</para>
<para>
Default value is <quote>sip_from</quote>.
</para>
<example>
<title>acc_sip_from_column example</title>
<programlisting format="linespecific">
modparam("acc", "acc_sip_from_column", "sip_from")
</programlisting>
</example>
</section>
<section>
<title><varname>acc_sip_to_column</varname> (string)</title>
<para>
Column name in accouting table to store the <quote>sip_to</quote> value.
</para>
<para>
Default value is <quote>sip_to</quote>.
</para>
<example>
<title>acc_sip_to_column example</title>
<programlisting format="linespecific">
modparam("acc", "acc_sip_to_column", "sip_to")
</programlisting>
</example>
</section>
<section>
<title><varname>acc_sip_status_column</varname> (string)</title>
<para>
Column name in accouting table to store the
<quote>sip_status</quote> value.
</para>
<para>
Default value is <quote>sip_status</quote>.
</para>
<example>
<title>acc_sip_status_column example</title>
<programlisting format="linespecific">
modparam("acc", "acc_sip_status_column", "sip_status")
</programlisting>
</example>
</section>
<section>
<title><varname>acc_sip_method_column</varname> (string)</title>
<para>
Column name in accouting table to store the
<quote>sip_method</quote> value.
</para>
<para>
Default value is <quote>sip_method</quote>.
</para>
<example>
<title>acc_sip_method_column example</title>
<programlisting format="linespecific">
modparam("acc", "acc_sip_method_column", "sip_method")
</programlisting>
</example>
</section>
<section>
<title><varname>acc_i_uri_column</varname> (string)</title>
<para>
Column name in accouting table to store the
<quote>incoming_URI</quote> value.
</para>
<para>
Default value is <quote>i_uri</quote>.
</para>
<example>
<title>acc_i_uri_column example</title>
<programlisting format="linespecific">
modparam("acc", "acc_i_uri_column", "in_uri")
</programlisting>
</example>
</section>
<section>
<title><varname>acc_o_uri_column</varname> (string)</title>
<para>
Column name in accouting table to store the
<quote>outgoing_uri</quote> value.
</para>
<para>
Default value is <quote>o_uri</quote>.
</para>
<example>
<title>acc_o_uri_column example</title>
<programlisting format="linespecific">
modparam("acc", "acc_o_uri_column", "out_uri")
</programlisting>
</example>
</section>
<section>
<title><varname>acc_sip_callid_column</varname> (string)</title>
<para>
Column name in accouting table to store the
<quote>sip_callid</quote> value.
</para>
<para>
Default value is <quote>sip_callid</quote>.
</para>
<example>
<title>acc_sip_callid_column example</title>
<programlisting format="linespecific">
modparam("acc", "acc_sip_callid_column", "sip_callid")
</programlisting>
</example>
</section>
<section>
<title><varname>acc_user_column</varname> (string)</title>
<para>
Column name in accouting table to store the
<quote>username</quote> value.
</para>
<para>
Default value is <quote>username</quote>.
</para>
<example>
<title>acc_user_column example</title>
<programlisting format="linespecific">
modparam("acc", "acc_user_column", "username")
</programlisting>
</example>
</section>
<section>
<title><varname>acc_time_column</varname> (string)</title>
<para>
Column name in accouting table to store the <quote>time</quote> value.
</para>
<para>
Default value is <quote>time</quote>.
</para>
<example>
<title>acc_time_column example</title>
<programlisting format="linespecific">
modparam("acc", "acc_time_column", "time")
</programlisting>
</example>
</section>
<section>
<title><varname>acc_from_uri_column</varname> (string)</title>
<para>
Column name in accouting table to store the
<quote>from_uri</quote> value.
</para>
<para>
Default value is <quote>from_uri</quote>.
</para>
<example>
<title>acc_from_uri_column example</title>
<programlisting format="linespecific">
modparam("acc", "acc_from_uri_column", "from_uri")
</programlisting>
</example>
</section>
<section>
<title><varname>acc_to_uri_column</varname> (string)</title>
<para>
Column name in accouting table to store the <quote>to_uri</quote> value.
</para>
<para>
Default value is <quote>to_uri</quote>.
</para>
<example>
<title>acc_to_uri_column example</title>
<programlisting format="linespecific">
modparam("acc", "acc_to_uri_column", "to_uri")
</programlisting>
</example>
</section>
<section>
<title><varname>acc_totag_column</varname> (string)</title>
<para>
Column name in accouting table to store the <quote>to_tag</quote> value.
</para>
<para>
Default value is <quote>totag</quote>.
</para>
<example>
<title>acc_totag_column example</title>
<programlisting format="linespecific">
modparam("acc", "acc_totag_column", "totag")
</programlisting>
</example>
</section>
<section>
<title><varname>acc_fromtag_column</varname> (string)</title>
<para>
Column name in accouting table to store the
<quote>from_tag</quote> value.
</para>
<para>
Default value is <quote>fromtag</quote>.
</para>
<example>
<title>acc_fromtag_column example</title>
<programlisting format="linespecific">
modparam("acc", "acc_fromtag_column", "fromtag")
</programlisting>
</example>
</section>
<section>
<title><varname>acc_domain_column</varname> (string)</title>
<para>
Column name in accouting table to store the <quote>domain</quote> value.
</para>
<para>
Default value is <quote>domain</quote>.
</para>
<example>
<title>acc_domain_column example</title>
<programlisting format="linespecific">
modparam("acc", "acc_domain_column", "domain")
</programlisting>
</example>
</section>
<section>
<title><varname>acc_src_leg_column</varname> (string)</title>
<para>
Column name in accouting table to store the
<quote>source_leg</quote> value in case of multi-leg accouting.
</para>
<para>
Default value is <quote>src_leg</quote>.
</para>
<example>
<title>acc_src_leg_column example</title>
<programlisting format="linespecific">
modparam("acc", "acc_src_leg_column", "src_leg")
</programlisting>
</example>
</section>
<section>
<title><varname>acc_dst_leg_column</varname> (string)</title>
<para>
Column name in accouting table to store the
<quote>destination_leg</quote> value in case of multi-leg accouting.
</para>
<para>
Default value is <quote>dst_leg</quote>.
</para>
<example>
<title>acc_dst_leg_column example</title>
<programlisting format="linespecific">
modparam("acc", "acc_dst_leg_column", "dst_leg")
</programlisting>
</example>
</section>
<section>
<title><varname>db_extra</varname> (string)</title>
<para>
Extra values to be logged into database - DB specific.
</para>
<para>
Default value is NULL.
</para>
<example>
<title>db_extra example</title>
<programlisting format="linespecific">
modparam("acc", "db_extra", "ct=$hdr(Content-type); email=$avp(s:email)")
</programlisting>
</example>
</section>
<section>
<title><varname>detect_direction</varname> (integer)</title>
<para>
Controlles the direction detection for sequential requests. If
enabled (non zero value), for sequential requests with upstream
direction (from callee to caller), the FROM and TO will be swapped
(the direction will be preserved as in the original request).
</para>
<para>
It affects all values related to TO and FROM headers (body, URI,
username, domain, TAG).
</para>
<para>
Default value is 0 (disabled).
</para>
<example>
<title>detect_direction example</title>
<programlisting format="linespecific">
modparam("acc", "detect_direction", 1)
</programlisting>
</example>
</section>
</section>
<section>
<title>Exported Functions</title>
<section>
<title>
<function moreinfo="none">acc_log_request(comment)</function>
</title>
<para>
<function moreinfo="none">acc_request</function> reports on a request,
for example, it can be used to report on missed calls to off-line users
who are replied 404 - Not Found. To avoid multiple reports on UDP
request retransmission, you would need to embed the
action in stateful processing.
</para>
<para>
Meaning of the parameters is as follows:</para>
<itemizedlist>
<listitem>
<para><emphasis>comment</emphasis> - Comment to be appended.
</para>
</listitem>
</itemizedlist>
<para>
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
</para>
<example>
<title>acc_log_request usage</title>
<programlisting format="linespecific">
...
acc_log_request("Some comment");
...
</programlisting>
</example>
</section>
<section>
<title>
<function moreinfo="none">acc_db_request(comment, table)</function>
</title>
<para>
Like <function moreinfo="none">acc_log_request</function>,
<function moreinfo="none">acc_db_request</function> reports on a
request. The report is sent to database at <quote>db_url</quote>, in
the table referred to in the second action parameter.
</para>
<para>
Meaning of the parameters is as follows:
</para>
<itemizedlist>
<listitem>
<para><emphasis>comment</emphasis> - Comment to be appended.</para>
</listitem>
<listitem>
<para><emphasis>table</emphasis> - Database table to be used.</para>
</listitem>
</itemizedlist>
<para>
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
</para>
<example>
<title>acc_db_request usage</title>
<programlisting format="linespecific">
...
acc_log_request("Some comment", "Some table");
...
</programlisting>
</example>
</section>
<section>
<title>
<function moreinfo="none">acc_rad_request(comment)</function>
</title>
<para>
Like <function moreinfo="none">acc_log_request</function>,
<function moreinfo="none">acc_rad_request</function> reports on
a request. It reports to radius server as configured in
<quote>radius_config</quote>.
</para>
<para>
Meaning of the parameters is as follows:</para>
<itemizedlist>
<listitem>
<para><emphasis>comment</emphasis> - Comment to be appended.
</para>
</listitem>
</itemizedlist>
<para>
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
</para>
<example>
<title>acc_rad_request usage</title>
<programlisting format="linespecific">
...
acc_rad_request("Some comment");
...
</programlisting>
</example>
</section>
<section>
<title>
<function moreinfo="none">acc_diam_request(comment)</function>
</title>
<para>
Like <function moreinfo="none">acc_log_request</function>,
<function moreinfo="none">acc_diam_request</function> reports on
a request. It reports to the configured Diameter server.
</para>
<para>
Meaning of the parameters is as follows:</para>
<itemizedlist>
<listitem>
<para><emphasis>comment</emphasis> - Comment to be appended.
</para>
</listitem>
</itemizedlist>
<para>
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
</para>
<example>
<title>acc_diam_request usage</title>
<programlisting format="linespecific">
...
acc_diam_request("Some comment");
...
</programlisting>
</example>
</section>
</section>
</chapter>
<!-- Keep this element at the end of the file
Local Variables:
sgml-parent-document: ("acc.sgml" "Book" "chapter")
End:
-->
|