-
Notifications
You must be signed in to change notification settings - Fork 909
/
ims_charging_admin.xml
1057 lines (808 loc) · 32.5 KB
/
ims_charging_admin.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
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
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
<!-- Include general documentation entities -->
<!ENTITY % docentities SYSTEM "../../../../doc/docbook/entities.xml">
%docentities;
]>
<!-- Module Admin Guide -->
<chapter>
<title>Admin Guide</title>
<section>
<title>Overview</title>
<para>This module contains all methods related to the IMS charging control
functions performed by a network element (e.g. a S-CSCF) over the Ro
interface. This module is dependent on the CDP (C Diameter Peer) modules
for communicating with a Charging-Server as specified in 3GPP
specification TS xx.xxx.</para>
<para>Please also refer to RFC 4006 (Diameter Credit-Control
Application)</para>
</section>
<section>
<title>Dependencies</title>
<section>
<title>Kamailio Modules</title>
<para>The Following modules must be loaded before this module:</para>
<itemizedlist>
<listitem>
<para>ims_dialog</para>
</listitem>
<listitem>
<para>TM - Transaction Manager</para>
</listitem>
<listitem>
<para>CDP - C Diameter Peer</para>
</listitem>
<listitem>
<para>CDP_AVP - CDP AVP Applications</para>
</listitem>
</itemizedlist>
</section>
<section>
<title>External Libraries or Applications</title>
<para>This modules requires the internal IMS library.</para>
</section>
</section>
<section>
<title>Understanding Charging in the IP-Multimedia-Subsystem (IMS)</title>
<para>Before each service usage, the charging system must be asked for
permission (credit authorization). The charging server must make a
decision: Either authorize or deny the session. For postpaid scenarios
this is fairly easy: The charging-server only needs to collect the usage
data for processing it at the end of the month. As no realtime account
updating is needed, this is often called "offline-charging". For prepaid
scenarios the charging server needs to know the user's account balance and
it will need to update the account in real-time. This is often referred to
as "online-charging".</para>
<para>Question: What is the double of the Radius? Answer: It's the
Diameter!</para>
<para>As quite often, we use the Diameter-Protocol to do the Charging in
the IMS. And as quite often, IMS uses a huge bunch of acronyms to describe
the different interfaces: We call the diameter-interface for
offline-charging the "Rf"-interface and the interface for online charging
the "Ro"-interface.</para>
<para>Each system, that needs this credit authorization, have to be
equipped with a proper charging trigger, a so-called
charging-trigger-function (CTF) in order to communicate with the
charging-server (also called charging-function):</para>
<mediaobject>
<imageobject>
<imagedata fileref="./images/charging1.png"/>
</imageobject>
</mediaobject>
<section>
<title>Offline Charging (Rf)</title>
<para>For the offline charging (Rf), we have the following two
diameter-messages:</para>
<itemizedlist>
<listitem>
<para>ACR - Accounting Request</para>
</listitem>
<listitem>
<para>ACA - Accounting Answer</para>
</listitem>
</itemizedlist>
<para>Each request can have the following Accounting-Record-Type:</para>
<itemizedlist>
<listitem>
<para>START_RECORD - used to start an accounting session, typically
when the application receives a SIP 200 OK acknowledging an initial
SIP INVITE.</para>
</listitem>
<listitem>
<para>INTERIM_RECORD - used to update a session, for example, in the
case of SIP RE-INVITE and/or UPDATE in the current SIP
dialog.</para>
</listitem>
<listitem>
<para>STOP_RECORD - used to stop an accounting session, for example,
when the application receives a SIP BYE message.</para>
</listitem>
<listitem>
<para>EVENT_RECORD - used for event-based accounting, e.g. a short
message or similar</para>
</listitem>
</itemizedlist>
</section>
<section>
<title>Online Charging (Ro)</title>
<para>For online charging (Ro), this get's a little bit more
complicated. The charging function needs to perform credit control
before allowing resource usage. The prepaid subscriber needs to exist in
the charging-server and all activities must be monitored by the
charging-server. We must distinguish between the following two
cases:</para>
<itemizedlist>
<listitem>
<para>Direct debiting - the amount is immediately deducted from the
user's account in one single transaction. This could be for example
a SMS or the ordering of a movie in case of Video-on-Demand.</para>
</listitem>
<listitem>
<para>Unit reservation - an amount is reserved by the
charging-server. This is done, because the charging-server does not
know yet, how many units are needed to provide the service. During
the session, the used amount may be deducted and more units can be
requested; at the end of the session the used sessions are reported
in the final request. These sessions could be typically a voice- or
video-call or a Pay-TV session, if you pay per usage.</para>
</listitem>
</itemizedlist>
<para>As a result, we have the following three scenarios:</para>
<itemizedlist>
<listitem>
<para>Immediate Event Charging (IEC) - used for simple Event-based
charging</para>
</listitem>
<listitem>
<para>Event Charging with Unit Reservation (ECUR) (of type
Event-based charging)</para>
</listitem>
<listitem>
<para>Session Charging with Unit Reservation (SCUR) (of type
Session-based charging)</para>
</listitem>
</itemizedlist>
</section>
<section>
<title>Online Charging (Ro): A practical example</title>
<para>But how does it look in reality? Let us make a more practical
example:</para>
<para>Let us assume we have a subscriber, who has sufficient credit for
75 seconds of talking. The subscriber initiates a call; as we do not
know, how long the call will take, we start with requesting credit for
30 seconds (CCR-Request, we could request any duration, e.g. 2 hours,
but it would probably block other calls if we reserve all the required
credit).</para>
<para>The call proceeds, so after 30 seconds we send another CCR-Request
with the indication that we used the reserved 30 seconds and that we
request another 30 seconds. We reduce the account of the subscriber by
30 seconds, so he has a credit of 45 seconds. Since 45 seconds is more
than the requested 30 seconds, this second request can also easily be
accepted and another 30 seconds can be granted. After this request, the
account is at 45 seconds and we still (or again) have 30 seconds
reserved.</para>
<para>Meanwhile the subscriber initiates a second call. We try to
request again 30 seconds from the charging-server, but as our account is
at 45 seconds of speaking time and since we reserved another 30 seconds
for the first call, we can only grant 15 seconds for the second call.
The last 15 seconds are now reserved for this subscriber; we have 45
seconds on the account of which 45 seconds are reserved.</para>
<para>Now the first call gets terminated: We only used 20 seconds from
the granted 30 seconds. So we decrease the account of the subscriber by
20 seconds and we reduce the amount of reserved units by 30. We have 25
seconds in the account and we have still reserved 15 seconds for the
second call.</para>
<para>As the second call is still proceeding, we will try to request
another 30 seconds and we indicate, that we used the granted 15 seconds.
The account is deducted by 15 seconds (the used units) and we can grant
another 10 seconds for the second call, as this is the remains on the
account.</para>
<para>After 10 seconds, no more units can be granted, so the call is
teared down.</para>
<para>The following diagram is a graphical representation of the above
example:</para>
<mediaobject>
<imageobject>
<imagedata fileref="./images/charging2.png"/>
</imageobject>
</mediaobject>
</section>
</section>
<section>
<title>Parameters</title>
<section>
<title><varname>hash_size</varname>(int)</title>
<para>The size of the hash table internally used to keep the
Diameter-Ro-Session. A larger table is much faster but consumes more
memory. The hash size must be a power of two number.</para>
<para>IMPORTANT: If Ro-Session's information should be stored in a
database, a constant hash_size should be used, otherwise the restoring
process will not take place. If you really want to modify the hash_size
you must delete all table's rows before restarting the server.</para>
<para><emphasis>Default value is 4096.</emphasis></para>
<example>
<title><varname>hash_size</varname>parameter usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "hash_size", 1024)
...
</programlisting>
</example>
</section>
<section>
<title><varname>db_mode</varname> (int)</title>
<para>Should a database be used to store dialog information.</para>
<para>Available database modes: 0 for no database, 1 for real-time mode and
2 for shutdown mode. Mode 2 seems to be not fully implemented.</para>
<para><emphasis>Default value is 0 - no database is used.</emphasis></para>
<example>
<title><varname>db_mode</varname>parameter usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "db_mode", 0)
...
</programlisting>
</example>
</section>
<section>
<title><varname>db_url</varname> (string)</title>
<para></para>
<para><emphasis>Default value is <quote>&defaultdb;</quote></emphasis></para>
<example>
<title><varname>db_url</varname>parameter usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "db_url", "&exampledb;")
...
</programlisting>
</example>
</section>
<section>
<title><varname>interim_update_credits</varname>(int)</title>
<para>How much credit should be requested interim request? At the start
of the call, we request the amount of seconds as per Command. For each
interim request, we would request credit for
"interim_update_credits".</para>
<para><emphasis>Default value is 30.</emphasis></para>
<example>
<title><varname>interim_update_credits</varname>parameter
usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "interim_update_credits", 600)
...
</programlisting>
</example>
</section>
<section>
<title><varname>timer_buffer</varname>(int)</title>
<para>How many seconds before expiry of our credit should we request
more credit?</para>
<para><emphasis>Default value is 8.</emphasis></para>
<example>
<title><varname>timer_buffer</varname>parameter usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "timer_buffer", 10)
...
</programlisting>
</example>
</section>
<section>
<title><varname>ro_forced_peer</varname>(string)</title>
<para>FQDN of Diameter Peer (OCS) to use for communication (CCR). If you
use this, the routing defined in your diameter xml configuration file
(CDP) will be ignored and as a result you will lose the benefits of load
balancing and failover. </para>
<para><emphasis>Default value is ''.</emphasis></para>
<example>
<title><varname>ro_forced_peer</varname>parameter usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "ro_forced_peer", "ocs.ims.smilecoms.com")
...
</programlisting>
</example>
</section>
<section>
<title><varname>ro_auth_expiry</varname>(integer)</title>
<para>This is the expiry length in seconds of the initiated Diameter
sessions.</para>
<para><emphasis>Default value is 7200.</emphasis></para>
<example>
<title><varname>ro_auth_expiry</varname>parameter usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "ro_auth_expiry", 14400)
...
</programlisting>
</example>
</section>
<section>
<title><varname>ro_auth_expiry</varname>(integer)</title>
<para>This is the expiry length in seconds of the initiated Diameter
sessions.</para>
<para><emphasis>Default value is 7200.</emphasis></para>
<example>
<title><varname>ro_auth_expiry</varname>parameter usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "ro_auth_expiry", 14400)
...
</programlisting>
</example>
</section>
<section>
<title><varname>cdp_event_latency</varname>(integer)</title>
<para>This is a flag to determine whether or slow CDP responses should
be reported in the log file. 1 is enabled and 0 is disabled.</para>
<para><emphasis>Default value is 1.</emphasis></para>
<example>
<title><varname>cdp_event_latency</varname>parameter usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "cdp_event_latency", 1)
...
</programlisting>
</example>
</section>
<section>
<title><varname>cdp_event_threshold</varname>(integer)</title>
<para>This time in milliseconds is the limit we should report a CDP
response as slow. i.e. if a CDP response exceeds this limit it will be
reported in the log file. This is only relevant is cdp_event_latency is
enabled (set to 0).</para>
<para><emphasis>Default value is 500.</emphasis></para>
<example>
<title><varname>cdp_event_threshold</varname>parameter usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "cdp_event_threshold", 500)
...
</programlisting>
</example>
</section>
<section>
<title><varname>cdp_event_latency_log</varname>(integer)</title>
<para>This time log level at which we should report slow CDP responses.
0 is ERROR, 1 is WARN, 2 is INFO and 3 is DEBUG. This is only relevant
is cdp_event_latency is enabled (set to 0)</para>
<para><emphasis>Default value is 0.</emphasis></para>
<example>
<title><varname>cdp_event_latency_log</varname>parameter usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "cdp_event_latency_log", 1)
...
</programlisting>
</example>
</section>
<section>
<title><varname>single_ro_session_per_dialog</varname>(integer)</title>
<para>This tells the module whether it should do a single ro session per
dialog no matter how many times Ro_send_CCR is called from the config
file or initiate an ro session each time Ro_send_CCR is called. It is
useful for IMS charging where you might want to charge for on-net
originating and off-net originating calls but always have only a single
ro session.</para>
<para><emphasis>Default value is 0.</emphasis></para>
<example>
<title><varname>single_ro_session_per_dialog</varname>parameter
usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "single_ro_session_per_dialog", 1)
...
</programlisting>
</example>
</section>
<section>
<title><varname>origin_host</varname>(string)</title>
<para>Origin host to be used in Diameter messages to
charging-server.</para>
<para><emphasis>Default value is "".</emphasis></para>
<example>
<title><varname>origin_host</varname>parameter usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "origin_host", "scscf.kamailio-ims.org")
...
</programlisting>
</example>
</section>
<section>
<title><varname>origin_realm</varname>(string)</title>
<para>Origin Realm to be used in Diameter messages to
charging-server.</para>
<para><emphasis>Default value is "".</emphasis></para>
<example>
<title><varname>origin_realm</varname>parameter usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "origin_realm", "kamailio-ims.org")
...
</programlisting>
</example>
</section>
<section>
<title><varname>destination_host</varname>(string)</title>
<para>Destination host to be used in Diameter messages to
charging-server.</para>
<para><emphasis>Default value is "".</emphasis></para>
<example>
<title><varname>destination_host</varname>parameter usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "destination_host", "ocs.kamailio-ims.org")
...
</programlisting>
</example>
</section>
<section>
<title><varname>destination_realm</varname>(string)</title>
<para>Destination realm to be used in Diameter messages to
charging-server.</para>
<para><emphasis>Default value is "".</emphasis></para>
<example>
<title><varname>destination_realm</varname>parameter usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "destination_realm", "kamailio-ims.org")
...
</programlisting>
</example>
</section>
<section>
<title><varname>service_context_id_root</varname>(string)</title>
<para>This defines a root-element of the Service-Context-Id AVP used in
the diameter-message</para>
<para>The Service-Context-Id AVP is of type UTF8String (AVP Code 461)
and contains a unique identifier of the Diameter credit-control service
specific document that applies to the request (as defined in section RFC
4006 4.1.2). This is an identifier allocated by the service provider, by
the service element manufacturer, or by a standardization body, and MUST
uniquely identify a given Diameter credit-control service specific
document. The format of the Service-Context-Id is:</para>
<programlisting format="linespecific">
"service-context" "@" "domain" service-context = Token
</programlisting>
<para>The Token is an arbitrary string of characters and digits.</para>
<para>'domain' represents the entity that allocated the
Service-Context-Id. It can be ietf.org, 3gpp.org, etc., if the
identifier is allocated by a standardization body, or it can be the FQDN
of the service provider (e.g., provider.example.com) or of the vendor
(e.g., vendor.example.com) if the identifier is allocated by a private
entity.</para>
<para>Service-specific documents that are for private use only (i.e., to
one provider's own use, where no interoperability is deemed useful) may
define private identifiers without need of coordination. However, when
interoperability is wanted, coordination of the identifiers via, for
example, publication of an informational RFC is RECOMMENDED in order to
make Service-Context-Id globally available.</para>
<para><emphasis>Default value is "32260@3gpp.org".</emphasis></para>
<example>
<title><varname>service_context_id_root</varname>parameter
usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "service_context_id_root", "calls@kamailio-ims.org")
...
</programlisting>
</example>
</section>
<section>
<title><varname>service_context_id_ext</varname>(string)</title>
<para>This defines the extension of the Service-Context-Id AVP used in
the diameter-message.</para>
<para><emphasis>Default value is "ext".</emphasis></para>
<example>
<title><varname>service_context_id_ext</varname>parameter
usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "service_context_id_ext", "ext2")
...
</programlisting>
</example>
</section>
<section>
<title><varname>service_context_id_mnc</varname>(string)</title>
<para>This defines Mobile-Network-Code (MNC) of the Service-Context-Id
AVP used in the diameter-message.</para>
<para><emphasis>Default value is "01".</emphasis></para>
<example>
<title><varname>service_context_id_mnc</varname>parameter
usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "service_context_id_mnc", "42")
...
</programlisting>
</example>
</section>
<section>
<title><varname>voice_service_identifier</varname>(string)</title>
<para>This defines the service identifier to be used for charging voice.</para>
<para><emphasis>Default value is "1000".</emphasis></para>
<example>
<title><varname>voice_service_identifier</varname>parameter
usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "voice_service_identifier", "1000")
...
</programlisting>
</example>
</section>
<section>
<title><varname>voice_rating_group</varname>(string)</title>
<para>This defines the rating group to be used for charging voice.</para>
<para><emphasis>Default value is "100".</emphasis></para>
<example>
<title><varname>voice_rating_group</varname>parameter
usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "voice_rating_group", "100")
...
</programlisting>
</example>
</section>
<section>
<title><varname>video_service_identifier</varname>(string)</title>
<para>This defines the service identifier to be used for charging video.</para>
<para><emphasis>Default value is "1001".</emphasis></para>
<example>
<title><varname>video_service_identifier</varname>parameter
usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "video_service_identifier", "1000")
...
</programlisting>
</example>
</section>
<section>
<title><varname>video_rating_group</varname>(string)</title>
<para>This defines the rating group to be used for charging video.</para>
<para><emphasis>Default value is "200".</emphasis></para>
<example>
<title><varname>video_rating_group</varname>parameter
usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "video_rating_group", "100")
...
</programlisting>
</example>
</section>
<section>
<title><varname>service_context_id_mcc</varname>(string)</title>
<para>This defines Mobile-Country-Code (MCC) of the Service-Context-Id
AVP used in the diameter-message.</para>
<para>see https://en.wikipedia.org/wiki/Mobile_country_code_(MCC) for
details.</para>
<para><emphasis>Default value is "001".</emphasis></para>
<example>
<title><varname>service_context_id_mcc</varname>parameter
usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "service_context_id_mcc", "262")
...
</programlisting>
</example>
</section>
<section>
<title><varname>service_context_id_release</varname>(string)</title>
<para>This defines Release of the Service-Context-Id AVP used in the
diameter-message.</para>
<para><emphasis>Default value is "8" (Release 8).</emphasis></para>
<example>
<title><varname>service_context_id_release</varname>parameter
usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "service_context_id_release", "262")
...
</programlisting>
</example>
</section>
<section>
<title><varname>custom_user_avp</varname> (avp string)</title>
<para>When this parameter is set and the contents of the AVP is not
empty, the User-AVP in the Ro-Charging-Request will be based on the
this parameter rather than on the P-Asserted or From-Header.</para>
<para>
This parameter allows you to setup an AVP with which you can customise
the user to be used in the Diameter-Request.</para>
<para><emphasis> Default value: if not set, P-Asserted-Identity with a
fallback to the From-Header is used. </emphasis></para>
<example>
<title><varname>custom_user_avp</varname>parameter
usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "custom_user_avp", "$avp(from_user)")
...
</programlisting>
</example>
</section>
<section>
<title><varname>app_provided_party_avp</varname> (avp string)</title>
<para>When this parameter is set and the contents of the AVP is not
empty, an Application-Provided-Called Party-Address AVP will be
addedd to charging related requests. This is required for special
cases e.g. related to roaming for some diameter server.</para>
<para><emphasis> Default value: if not set, the
Application-Provided-Called-Party-Address AVP will be not set.</emphasis></para>
<example>
<title><varname>app_provided_party_avp</varname>parameter
usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "app_provided_party_avp", "$avp(app_user)")
...
</programlisting>
</example>
</section>
<section>
<title><varname>vendor_specific_chargeinfo</varname> (int)</title>
<para>This parameter can be used to activate or deactivate the addition
of Vendor-Specific-Termination-Clause and Vendor-Specific-Termination-Reason
AVPs to the requests. To activate set this parameter to 1.</para>
<para><emphasis>Default value is "0" (deactivated).</emphasis></para>
<example>
<title><varname>vendor_specific_chargeinfo</varname>parameter
usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "vendor_specific_chargeinfo", 1)
...
</programlisting>
</example>
</section>
<section>
<title><varname>vendor_specific_id</varname> (int)</title>
<para>To set the ID of the Vendor-Specific information, not implemented right
now.</para>
<para><emphasis>Default value is "10".</emphasis></para>
<example>
<title><varname>vendor_specific_id</varname>parameter
usage</title>
<programlisting format="linespecific">
...
modparam("ims_charging", "vendor_specific_id", 10)
...
</programlisting>
</example>
</section>
</section>
<section>
<title>Functions</title>
<section>
<title><function moreinfo="none">Ro_CCR(route_name, direction,
reservation_units, incoming_trunk_id, outgoing_trunk_id)</function>
</title>
<para>Perform a CCR on Diameter Ro interface for Charging</para>
<para>Meaning of the parameters is as follows:</para>
<itemizedlist>
<listitem>
<para><emphasis>route_name</emphasis> route to be executed upon
reception of charging requests</para>
</listitem>
<listitem>
<para><emphasis>direction</emphasis> "orig"inating or
"term"inating</para>
</listitem>
<listitem>
<para><emphasis>reservation_units</emphasis> how many units (at the
moment seconds) should be reserved at the moment.</para>
</listitem>
<listitem>
<para><emphasis>incoming_trunk_id</emphasis> Identifies the trunk group
from which this originates.</para>
</listitem>
<listitem>
<para><emphasis>outgoing_trunk_id</emphasis> Identifies the trunk
group where this will be terminated.</para>
</listitem>
</itemizedlist>
<para>This function can be used from REQUEST_ROUTE.</para>
<para>This method is executed asynchronously. See example on how to
retrieve return value.</para>
<example>
<title>Ro_CCR</title>
<programlisting format="linespecific">
...
xlog("L_DBG","Sending initial CCR Request for call\n");
Ro_CCR("RO_ASYNC_TERM_REPLY", "term", 30, "1", "1");
}
route[CHARGING_CCR_REPLY]
xlog("L_DBG","cca_return code is $avp(s:cca_return_code)\n");
switch ($avp(s:cca_return_code)) {
case 1: #success
xlog("L_DBG", "CCR success - will route message\n");
route(Finalize_Orig);
break;
case -1: #failure
xlog("L_ERR", "CCR failure - error response sent from module\n");
sl_send_reply("402","Payment required");
break;
case -2: #error
xlog("L_ERR", "CCR error - error response sent from module\n");
sl_send_reply("500", "Charging Error");
break;
default:
xlog("L_ERR", "Unknown return code from CCR: [$avp(s:cca_return_code)] \n");
break;
}
exit;
}
...
</programlisting>
</example>
</section>
<section>
<title><function moreinfo="none">Ro_set_session_id_avp()</function>
</title>
<para>Sets the Ro session ID to an AVP for use in the config file</para>
<para>This function can be used from REQUEST_ROUTE or ONREPLY_ROUTE.</para>
<example>
<title>Ro_set_session_id_avp</title>
<programlisting format="linespecific">
...
Ro_set_session_id_avp();
xlog("L_DBG","Ro session AVP has been set: $avp(ro_session_id)\n");
...
</programlisting>
</example>
</section>
</section>
<section>
<title>Statistics</title>
<section>
<title>Initial CCRs (initial_ccrs)</title>
<para>The number of initial CCRs, i.e., the CCRs that were sent for the
initial INVITEs.</para>
</section>
<section>
<title>Interim CCRs (interim_ccrs)</title>
<para>The number of CCRs sent within established sessions.</para>
</section>
<section>
<title>Final CCRs (final_ccrs)</title>
<para>The number of CCRs sent to terminate a session.</para>
</section>
<section>
<title>Successful initial CCRs (successful_initial_ccrs)</title>
<para>Initial CCRs that ended with DIAMETER_SUCCESS response
code.</para>
</section>
<section>
<title>Successful interim CCRs (successful_interim_ccrs)</title>
<para>Interim CCRs that ended with DIAMETER_SUCCESS response
code.</para>
</section>
<section>