Debian Codegraph @

src/modules/ims_charging/README

raw
1 The IMS Charging Module
2
3 Jason Penton
4
5 Smile Communications
6 <[email protected]>
7
8 Carsten Bock
9
10 ng-voice GmbH
11 <[email protected]>
12
13 Carlos Ruiz Diaz
14
15 ng-voice GmbH
16 <[email protected]>
17
18 Copyright © 2013 Smile Communications
19
20 Copyright © 2013-2017 ng-voice GmbH
21 __________________________________________________________________
22
23 Table of Contents
24
25 1. Admin Guide
26
27 1. Overview
28 2. Dependencies
29
30 2.1. Kamailio Modules
31 2.2. External Libraries or Applications
32
33 3. Understanding Charging in the IP-Multimedia-Subsystem (IMS)
34
35 3.1. Offline Charging (Rf)
36 3.2. Online Charging (Ro)
37 3.3. Online Charging (Ro): A practical example
38
39 4. Parameters
40
41 4.1. hash_size(int)
42 4.2. db_mode (int)
43 4.3. db_url (string)
44 4.4. interim_update_credits(int)
45 4.5. timer_buffer(int)
46 4.6. ro_forced_peer(string)
47 4.7. ro_auth_expiry(integer)
48 4.8. cdp_event_latency(integer)
49 4.9. cdp_event_threshold(integer)
50 4.10. cdp_event_latency_log(integer)
51 4.11. single_ro_session_per_dialog(integer)
52 4.12. origin_host(string)
53 4.13. origin_realm(string)
54 4.14. destination_host(string)
55 4.15. destination_realm(string)
56 4.16. service_context_id_root(string)
57 4.17. service_context_id_ext(string)
58 4.18. service_context_id_mnc(string)
59 4.19. voice_service_identifier(string)
60 4.20. voice_rating_group(string)
61 4.21. video_service_identifier(string)
62 4.22. video_rating_group(string)
63 4.23. service_context_id_mcc(string)
64 4.24. service_context_id_release(string)
65 4.25. custom_user_avp (avp string)
66 4.26. app_provided_party_avp (avp string)
67 4.27. vendor_specific_chargeinfo (int)
68 4.28. vendor_specific_id (int)
69 4.29. strip_plus_from_e164 (int)
70 4.30. use_pani_from_term_invite (int)
71 4.31. node_func (int)
72
73 5. Functions
74
75 5.1. Ro_CCR(route_name, direction, reservation_units,
76 incoming_trunk_id, outgoing_trunk_id)
77
78 5.2. Ro_set_session_id_avp()
79
80 6. Statistics
81
82 6.1. Initial CCRs (initial_ccrs)
83 6.2. Interim CCRs (interim_ccrs)
84 6.3. Final CCRs (final_ccrs)
85 6.4. Successful initial CCRs (successful_initial_ccrs)
86 6.5. Successful interim CCRs (successful_interim_ccrs)
87 6.6. Successful final CCRs (successful_final_ccrs)
88 6.7. Failed initial CCRs (failed_initial_ccrs)
89 6.8. Failed interim CCRs (failed_interim_ccrs)
90 6.9. Failed final CCRs (failed_final_ccrs)
91 6.10. CCRs average response time (ccr_avg_response_time)
92 6.11. CCRs responses time (ccr_responses_time)
93 6.12. CCRs requests, which ended with a timeout
94 (ccr_timeouts)
95
96 6.13. Billed seconds (billed_secs)
97 6.14. Killed calls (killed_calls)
98
99 List of Examples
100
101 1.1. hash_sizeparameter usage
102 1.2. db_modeparameter usage
103 1.3. db_urlparameter usage
104 1.4. interim_update_creditsparameter usage
105 1.5. timer_bufferparameter usage
106 1.6. ro_forced_peerparameter usage
107 1.7. ro_auth_expiryparameter usage
108 1.8. cdp_event_latencyparameter usage
109 1.9. cdp_event_thresholdparameter usage
110 1.10. cdp_event_latency_logparameter usage
111 1.11. single_ro_session_per_dialogparameter usage
112 1.12. origin_hostparameter usage
113 1.13. origin_realmparameter usage
114 1.14. destination_hostparameter usage
115 1.15. destination_realmparameter usage
116 1.16. service_context_id_rootparameter usage
117 1.17. service_context_id_extparameter usage
118 1.18. service_context_id_mncparameter usage
119 1.19. voice_service_identifierparameter usage
120 1.20. voice_rating_groupparameter usage
121 1.21. video_service_identifierparameter usage
122 1.22. video_rating_groupparameter usage
123 1.23. service_context_id_mccparameter usage
124 1.24. service_context_id_releaseparameter usage
125 1.25. custom_user_avpparameter usage
126 1.26. app_provided_party_avpparameter usage
127 1.27. vendor_specific_chargeinfoparameter usage
128 1.28. vendor_specific_idparameter usage
129 1.29. strip_plus_from_e164parameter usage
130 1.30. use_pani_from_term_inviteparameter usage
131 1.31. node_funcparameter usage
132 1.32. Ro_CCR
133 1.33. Ro_set_session_id_avp
134
135 Chapter 1. Admin Guide
136
137 Table of Contents
138
139 1. Overview
140 2. Dependencies
141
142 2.1. Kamailio Modules
143 2.2. External Libraries or Applications
144
145 3. Understanding Charging in the IP-Multimedia-Subsystem (IMS)
146
147 3.1. Offline Charging (Rf)
148 3.2. Online Charging (Ro)
149 3.3. Online Charging (Ro): A practical example
150
151 4. Parameters
152
153 4.1. hash_size(int)
154 4.2. db_mode (int)
155 4.3. db_url (string)
156 4.4. interim_update_credits(int)
157 4.5. timer_buffer(int)
158 4.6. ro_forced_peer(string)
159 4.7. ro_auth_expiry(integer)
160 4.8. cdp_event_latency(integer)
161 4.9. cdp_event_threshold(integer)
162 4.10. cdp_event_latency_log(integer)
163 4.11. single_ro_session_per_dialog(integer)
164 4.12. origin_host(string)
165 4.13. origin_realm(string)
166 4.14. destination_host(string)
167 4.15. destination_realm(string)
168 4.16. service_context_id_root(string)
169 4.17. service_context_id_ext(string)
170 4.18. service_context_id_mnc(string)
171 4.19. voice_service_identifier(string)
172 4.20. voice_rating_group(string)
173 4.21. video_service_identifier(string)
174 4.22. video_rating_group(string)
175 4.23. service_context_id_mcc(string)
176 4.24. service_context_id_release(string)
177 4.25. custom_user_avp (avp string)
178 4.26. app_provided_party_avp (avp string)
179 4.27. vendor_specific_chargeinfo (int)
180 4.28. vendor_specific_id (int)
181 4.29. strip_plus_from_e164 (int)
182 4.30. use_pani_from_term_invite (int)
183 4.31. node_func (int)
184
185 5. Functions
186
187 5.1. Ro_CCR(route_name, direction, reservation_units,
188 incoming_trunk_id, outgoing_trunk_id)
189
190 5.2. Ro_set_session_id_avp()
191
192 6. Statistics
193
194 6.1. Initial CCRs (initial_ccrs)
195 6.2. Interim CCRs (interim_ccrs)
196 6.3. Final CCRs (final_ccrs)
197 6.4. Successful initial CCRs (successful_initial_ccrs)
198 6.5. Successful interim CCRs (successful_interim_ccrs)
199 6.6. Successful final CCRs (successful_final_ccrs)
200 6.7. Failed initial CCRs (failed_initial_ccrs)
201 6.8. Failed interim CCRs (failed_interim_ccrs)
202 6.9. Failed final CCRs (failed_final_ccrs)
203 6.10. CCRs average response time (ccr_avg_response_time)
204 6.11. CCRs responses time (ccr_responses_time)
205 6.12. CCRs requests, which ended with a timeout (ccr_timeouts)
206 6.13. Billed seconds (billed_secs)
207 6.14. Killed calls (killed_calls)
208
209 1. Overview
210
211 This module contains all methods related to the IMS charging control
212 functions performed by a network element (e.g. a S-CSCF) over the Ro
213 interface. This module is dependent on the CDP (C Diameter Peer)
214 modules for communicating with a Charging-Server as specified in 3GPP
215 specification TS xx.xxx.
216
217 Please also refer to RFC 4006 (Diameter Credit-Control Application)
218
219 2. Dependencies
220
221 2.1. Kamailio Modules
222 2.2. External Libraries or Applications
223
224 2.1. Kamailio Modules
225
226 The Following modules must be loaded before this module:
227 * ims_dialog
228 * TM - Transaction Manager
229 * CDP - C Diameter Peer
230 * CDP_AVP - CDP AVP Applications
231
232 2.2. External Libraries or Applications
233
234 This module requires the internal IMS library.
235
236 3. Understanding Charging in the IP-Multimedia-Subsystem (IMS)
237
238 3.1. Offline Charging (Rf)
239 3.2. Online Charging (Ro)
240 3.3. Online Charging (Ro): A practical example
241
242 Before each service usage, the charging system must be asked for
243 permission (credit authorization). The charging server must make a
244 decision: Either authorize or deny the session. For postpaid scenarios
245 this is fairly easy: The charging-server only needs to collect the
246 usage data for processing it at the end of the month. As no realtime
247 account updating is needed, this is often called "offline-charging".
248 For prepaid scenarios the charging server needs to know the user's
249 account balance and it will need to update the account in real-time.
250 This is often referred to as "online-charging".
251
252 Question: What is the double of the Radius? Answer: It's the Diameter!
253
254 As quite often, we use the Diameter-Protocol to do the Charging in the
255 IMS. And as quite often, IMS uses a huge bunch of acronyms to describe
256 the different interfaces: We call the diameter-interface for
257 offline-charging the "Rf"-interface and the interface for online
258 charging the "Ro"-interface.
259
260 Each system, that needs this credit authorization, have to be equipped
261 with a proper charging trigger, a so-called charging-trigger-function
262 (CTF) in order to communicate with the charging-server (also called
263 charging-function):
264 [charging1.png]
265
266 3.1. Offline Charging (Rf)
267
268 For the offline charging (Rf), we have the following two
269 diameter-messages:
270 * ACR - Accounting Request
271 * ACA - Accounting Answer
272
273 Each request can have the following Accounting-Record-Type:
274 * START_RECORD - used to start an accounting session, typically when
275 the application receives a SIP 200 OK acknowledging an initial SIP
276 INVITE.
277 * INTERIM_RECORD - used to update a session, for example, in the case
278 of SIP RE-INVITE and/or UPDATE in the current SIP dialog.
279 * STOP_RECORD - used to stop an accounting session, for example, when
280 the application receives a SIP BYE message.
281 * EVENT_RECORD - used for event-based accounting, e.g. a short
282 message or similar
283
284 3.2. Online Charging (Ro)
285
286 For online charging (Ro), this get's a little bit more complicated. The
287 charging function needs to perform credit control before allowing
288 resource usage. The prepaid subscriber needs to exist in the
289 charging-server and all activities must be monitored by the
290 charging-server. We must distinguish between the following two cases:
291 * Direct debiting - the amount is immediately deducted from the
292 user's account in one single transaction. This could be for example
293 a SMS or the ordering of a movie in case of Video-on-Demand.
294 * Unit reservation - an amount is reserved by the charging-server.
295 This is done, because the charging-server does not know yet, how
296 many units are needed to provide the service. During the session,
297 the used amount may be deducted and more units can be requested; at
298 the end of the session the used sessions are reported in the final
299 request. These sessions could be typically a voice- or video-call
300 or a Pay-TV session, if you pay per usage.
301
302 As a result, we have the following three scenarios:
303 * Immediate Event Charging (IEC) - used for simple Event-based
304 charging
305 * Event Charging with Unit Reservation (ECUR) (of type Event-based
306 charging)
307 * Session Charging with Unit Reservation (SCUR) (of type
308 Session-based charging)
309
310 3.3. Online Charging (Ro): A practical example
311
312 But how does it look in reality? Let us make a more practical example:
313
314 Let us assume we have a subscriber, who has sufficient credit for 75
315 seconds of talking. The subscriber initiates a call; as we do not know,
316 how long the call will take, we start with requesting credit for 30
317 seconds (CCR-Request, we could request any duration, e.g. 2 hours, but
318 it would probably block other calls if we reserve all the required
319 credit).
320
321 The call proceeds, so after 30 seconds we send another CCR-Request with
322 the indication that we used the reserved 30 seconds and that we request
323 another 30 seconds. We reduce the account of the subscriber by 30
324 seconds, so he has a credit of 45 seconds. Since 45 seconds is more
325 than the requested 30 seconds, this second request can also easily be
326 accepted and another 30 seconds can be granted. After this request, the
327 account is at 45 seconds and we still (or again) have 30 seconds
328 reserved.
329
330 Meanwhile the subscriber initiates a second call. We try to request
331 again 30 seconds from the charging-server, but as our account is at 45
332 seconds of speaking time and since we reserved another 30 seconds for
333 the first call, we can only grant 15 seconds for the second call. The
334 last 15 seconds are now reserved for this subscriber; we have 45
335 seconds on the account of which 45 seconds are reserved.
336
337 Now the first call gets terminated: We only used 20 seconds from the
338 granted 30 seconds. So we decrease the account of the subscriber by 20
339 seconds and we reduce the amount of reserved units by 30. We have 25
340 seconds in the account and we have still reserved 15 seconds for the
341 second call.
342
343 As the second call is still proceeding, we will try to request another
344 30 seconds and we indicate, that we used the granted 15 seconds. The
345 account is deducted by 15 seconds (the used units) and we can grant
346 another 10 seconds for the second call, as this is the remains on the
347 account.
348
349 After 10 seconds, no more units can be granted, so the call is teared
350 down.
351
352 The following diagram is a graphical representation of the above
353 example:
354 [charging2.png]
355
356 4. Parameters
357
358 4.1. hash_size(int)
359 4.2. db_mode (int)
360 4.3. db_url (string)
361 4.4. interim_update_credits(int)
362 4.5. timer_buffer(int)
363 4.6. ro_forced_peer(string)
364 4.7. ro_auth_expiry(integer)
365 4.8. cdp_event_latency(integer)
366 4.9. cdp_event_threshold(integer)
367 4.10. cdp_event_latency_log(integer)
368 4.11. single_ro_session_per_dialog(integer)
369 4.12. origin_host(string)
370 4.13. origin_realm(string)
371 4.14. destination_host(string)
372 4.15. destination_realm(string)
373 4.16. service_context_id_root(string)
374 4.17. service_context_id_ext(string)
375 4.18. service_context_id_mnc(string)
376 4.19. voice_service_identifier(string)
377 4.20. voice_rating_group(string)
378 4.21. video_service_identifier(string)
379 4.22. video_rating_group(string)
380 4.23. service_context_id_mcc(string)
381 4.24. service_context_id_release(string)
382 4.25. custom_user_avp (avp string)
383 4.26. app_provided_party_avp (avp string)
384 4.27. vendor_specific_chargeinfo (int)
385 4.28. vendor_specific_id (int)
386 4.29. strip_plus_from_e164 (int)
387 4.30. use_pani_from_term_invite (int)
388 4.31. node_func (int)
389
390 4.1. hash_size(int)
391
392 The size of the hash table internally used to keep the
393 Diameter-Ro-Session. A larger table is much faster but consumes more
394 memory. The hash size must be a power of two number.
395
396 IMPORTANT: If Ro-Session's information should be stored in a database,
397 a constant hash_size should be used, otherwise the restoring process
398 will not take place. If you really want to modify the hash_size you
399 must delete all table's rows before restarting the server.
400
401 Default value is 4096.
402
403 Example 1.1. hash_sizeparameter usage
404 ...
405 modparam("ims_charging", "hash_size", 1024)
406 ...
407
408 4.2. db_mode (int)
409
410 Should a database be used to store dialog information.
411
412 Available database modes: 0 for no database, 1 for real-time mode and 2
413 for shutdown mode.
414
415 Default value is 0 - no database is used.
416
417 Example 1.2. db_modeparameter usage
418 ...
419 modparam("ims_charging", "db_mode", 0)
420 ...
421
422 4.3. db_url (string)
423
424 Default value is “mysql://kamailio:kamailiorw@localhost/kamailio”
425
426 Example 1.3. db_urlparameter usage
427 ...
428 modparam("ims_charging", "db_url", "dbdriver://username:password@dbhost/dbname")
429 ...
430
431 4.4. interim_update_credits(int)
432
433 How much credit should be requested interim request? At the start of
434 the call, we request the amount of seconds as per Command. For each
435 interim request, we would request credit for "interim_update_credits".
436
437 Default value is 30.
438
439 Example 1.4. interim_update_creditsparameter usage
440 ...
441 modparam("ims_charging", "interim_update_credits", 600)
442 ...
443
444 4.5. timer_buffer(int)
445
446 How many seconds before expiry of our credit should we request more
447 credit?
448
449 Default value is 8.
450
451 Example 1.5. timer_bufferparameter usage
452 ...
453 modparam("ims_charging", "timer_buffer", 10)
454 ...
455
456 4.6. ro_forced_peer(string)
457
458 FQDN of Diameter Peer (OCS) to use for communication (CCR). If you use
459 this, the routing defined in your diameter xml configuration file (CDP)
460 will be ignored and as a result you will lose the benefits of load
461 balancing and failover.
462
463 Default value is ''.
464
465 Example 1.6. ro_forced_peerparameter usage
466 ...
467 modparam("ims_charging", "ro_forced_peer", "ocs.ims.smilecoms.com")
468 ...
469
470 4.7. ro_auth_expiry(integer)
471
472 This is the expiry length in seconds of the initiated Diameter
473 sessions.
474
475 Default value is 7200.
476
477 Example 1.7. ro_auth_expiryparameter usage
478 ...
479 modparam("ims_charging", "ro_auth_expiry", 14400)
480 ...
481
482 4.8. cdp_event_latency(integer)
483
484 This is a flag to determine whether or slow CDP responses should be
485 reported in the log file. 1 is enabled and 0 is disabled.
486
487 Default value is 1.
488
489 Example 1.8. cdp_event_latencyparameter usage
490 ...
491 modparam("ims_charging", "cdp_event_latency", 1)
492 ...
493
494 4.9. cdp_event_threshold(integer)
495
496 This time in milliseconds is the limit we should report a CDP response
497 as slow. i.e. if a CDP response exceeds this limit it will be reported
498 in the log file. This is only relevant is cdp_event_latency is enabled
499 (set to 0).
500
501 Default value is 500.
502
503 Example 1.9. cdp_event_thresholdparameter usage
504 ...
505 modparam("ims_charging", "cdp_event_threshold", 500)
506 ...
507
508 4.10. cdp_event_latency_log(integer)
509
510 This time log level at which we should report slow CDP responses. 0 is
511 ERROR, 1 is WARN, 2 is INFO and 3 is DEBUG. This is only relevant is
512 cdp_event_latency is enabled (set to 0)
513
514 Default value is 0.
515
516 Example 1.10. cdp_event_latency_logparameter usage
517 ...
518 modparam("ims_charging", "cdp_event_latency_log", 1)
519 ...
520
521 4.11. single_ro_session_per_dialog(integer)
522
523 This tells the module whether it should do a single ro session per
524 dialog no matter how many times Ro_send_CCR is called from the config
525 file or initiate an ro session each time Ro_send_CCR is called. It is
526 useful for IMS charging where you might want to charge for on-net
527 originating and off-net originating calls but always have only a single
528 ro session.
529
530 Default value is 0.
531
532 Example 1.11. single_ro_session_per_dialogparameter usage
533 ...
534 modparam("ims_charging", "single_ro_session_per_dialog", 1)
535 ...
536
537 4.12. origin_host(string)
538
539 Origin host to be used in Diameter messages to charging-server.
540
541 Default value is "".
542
543 Example 1.12. origin_hostparameter usage
544 ...
545 modparam("ims_charging", "origin_host", "scscf.kamailio-ims.org")
546 ...
547
548 4.13. origin_realm(string)
549
550 Origin Realm to be used in Diameter messages to charging-server.
551
552 Default value is "".
553
554 Example 1.13. origin_realmparameter usage
555 ...
556 modparam("ims_charging", "origin_realm", "kamailio-ims.org")
557 ...
558
559 4.14. destination_host(string)
560
561 Destination host to be used in Diameter messages to charging-server.
562
563 Default value is "".
564
565 Example 1.14. destination_hostparameter usage
566 ...
567 modparam("ims_charging", "destination_host", "ocs.kamailio-ims.org")
568 ...
569
570 4.15. destination_realm(string)
571
572 Destination realm to be used in Diameter messages to charging-server.
573
574 Default value is "".
575
576 Example 1.15. destination_realmparameter usage
577 ...
578 modparam("ims_charging", "destination_realm", "kamailio-ims.org")
579 ...
580
581 4.16. service_context_id_root(string)
582
583 This defines a root-element of the Service-Context-Id AVP used in the
584 diameter-message
585
586 The Service-Context-Id AVP is of type UTF8String (AVP Code 461) and
587 contains a unique identifier of the Diameter credit-control service
588 specific document that applies to the request (as defined in section
589 RFC 4006 4.1.2). This is an identifier allocated by the service
590 provider, by the service element manufacturer, or by a standardization
591 body, and MUST uniquely identify a given Diameter credit-control
592 service specific document. The format of the Service-Context-Id is:
593 "service-context" "@" "domain" service-context = Token
594
595 The Token is an arbitrary string of characters and digits.
596
597 'domain' represents the entity that allocated the Service-Context-Id.
598 It can be ietf.org, 3gpp.org, etc., if the identifier is allocated by a
599 standardization body, or it can be the FQDN of the service provider
600 (e.g., provider.example.com) or of the vendor (e.g.,
601 vendor.example.com) if the identifier is allocated by a private entity.
602
603 Service-specific documents that are for private use only (i.e., to one
604 provider's own use, where no interoperability is deemed useful) may
605 define private identifiers without need of coordination. However, when
606 interoperability is wanted, coordination of the identifiers via, for
607 example, publication of an informational RFC is RECOMMENDED in order to
608 make Service-Context-Id globally available.
609
610 Default value is "[email protected]".
611
612 Example 1.16. service_context_id_rootparameter usage
613 ...
614 modparam("ims_charging", "service_context_id_root", "[email protected]")
615 ...
616
617 4.17. service_context_id_ext(string)
618
619 This defines the extension of the Service-Context-Id AVP used in the
620 diameter-message.
621
622 Default value is "ext".
623
624 Example 1.17. service_context_id_extparameter usage
625 ...
626 modparam("ims_charging", "service_context_id_ext", "ext2")
627 ...
628
629 4.18. service_context_id_mnc(string)
630
631 This defines Mobile-Network-Code (MNC) of the Service-Context-Id AVP
632 used in the diameter-message.
633
634 Default value is "01".
635
636 Example 1.18. service_context_id_mncparameter usage
637 ...
638 modparam("ims_charging", "service_context_id_mnc", "42")
639 ...
640
641 4.19. voice_service_identifier(string)
642
643 This defines the service identifier to be used for charging voice.
644
645 Default value is "1000".
646
647 Example 1.19. voice_service_identifierparameter usage
648 ...
649 modparam("ims_charging", "voice_service_identifier", "1000")
650 ...
651
652 4.20. voice_rating_group(string)
653
654 This defines the rating group to be used for charging voice.
655
656 Default value is "100".
657
658 Example 1.20. voice_rating_groupparameter usage
659 ...
660 modparam("ims_charging", "voice_rating_group", "100")
661 ...
662
663 4.21. video_service_identifier(string)
664
665 This defines the service identifier to be used for charging video.
666
667 Default value is "1001".
668
669 Example 1.21. video_service_identifierparameter usage
670 ...
671 modparam("ims_charging", "video_service_identifier", "1000")
672 ...
673
674 4.22. video_rating_group(string)
675
676 This defines the rating group to be used for charging video.
677
678 Default value is "200".
679
680 Example 1.22. video_rating_groupparameter usage
681 ...
682 modparam("ims_charging", "video_rating_group", "100")
683 ...
684
685 4.23. service_context_id_mcc(string)
686
687 This defines Mobile-Country-Code (MCC) of the Service-Context-Id AVP
688 used in the diameter-message.
689
690 see https://en.wikipedia.org/wiki/Mobile_country_code_(MCC) for
691 details.
692
693 Default value is "001".
694
695 Example 1.23. service_context_id_mccparameter usage
696 ...
697 modparam("ims_charging", "service_context_id_mcc", "262")
698 ...
699
700 4.24. service_context_id_release(string)
701
702 This defines Release of the Service-Context-Id AVP used in the
703 diameter-message.
704
705 Default value is "8" (Release 8).
706
707 Example 1.24. service_context_id_releaseparameter usage
708 ...
709 modparam("ims_charging", "service_context_id_release", "262")
710 ...
711
712 4.25. custom_user_avp (avp string)
713
714 When this parameter is set and the contents of the AVP is not empty,
715 the User-AVP in the Ro-Charging-Request will be based on the this
716 parameter rather than on the P-Asserted or From-Header.
717
718 This parameter allows you to set up an AVP with which you can customise
719 the user to be used in the Diameter-Request.
720
721 Default value: if not set, P-Asserted-Identity with a fallback to the
722 From-Header is used.
723
724 Example 1.25. custom_user_avpparameter usage
725 ...
726 modparam("ims_charging", "custom_user_avp", "$avp(from_user)")
727 ...
728
729 4.26. app_provided_party_avp (avp string)
730
731 When this parameter is set and the contents of the AVP is not empty, an
732 Application-Provided-Called Party-Address AVP will be addedd to
733 charging related requests. This is required for special cases e.g.
734 related to roaming for some diameter server.
735
736 Default value: if not set, the
737 Application-Provided-Called-Party-Address AVP will be not set.
738
739 Example 1.26. app_provided_party_avpparameter usage
740 ...
741 modparam("ims_charging", "app_provided_party_avp", "$avp(app_user)")
742 ...
743
744 4.27. vendor_specific_chargeinfo (int)
745
746 This parameter can be used to activate or deactivate the addition of
747 Vendor-Specific-Termination-Clause and
748 Vendor-Specific-Termination-Reason AVPs to the requests. To activate
749 set this parameter to 1.
750
751 Default value is "0" (deactivated).
752
753 Example 1.27. vendor_specific_chargeinfoparameter usage
754 ...
755 modparam("ims_charging", "vendor_specific_chargeinfo", 1)
756 ...
757
758 4.28. vendor_specific_id (int)
759
760 To set the ID of the Vendor-Specific information, not implemented right
761 now.
762
763 Default value is "10".
764
765 Example 1.28. vendor_specific_idparameter usage
766 ...
767 modparam("ims_charging", "vendor_specific_id", 10)
768 ...
769
770 4.29. strip_plus_from_e164 (int)
771
772 Strip + from subscription id when E.164 format is used. This is
773 according to spec, but this parameter is to keep existing behavior as
774 the default.
775
776 Default value is 0.
777
778 Example 1.29. strip_plus_from_e164parameter usage
779 ...
780 modparam("ims_charging", "strip_plus_from_e164", 1)
781 ...
782
783 4.30. use_pani_from_term_invite (int)
784
785 P-Access-Network-Info is normally relevant for the "orig" scenario
786 where it's extracted from INVITE. This setting instruct Kamailio to
787 include it in "term" scenario too, where it might have been added to
788 the INVITE based on info from a REGISTER. Normally used to start a
789 charging session when the user is roaming.
790
791 Default value is 0.
792
793 Example 1.30. use_pani_from_term_inviteparameter usage
794 ...
795 modparam("ims_charging", "use_pani_from_term_invite", 1)
796 ...
797
798 4.31. node_func (int)
799
800 Defines what should be sent as Node-Functionality (862) in the Diameter
801 Ro request. Possible values are: 0 (S-CSCF), 1 (P-CSCF), 2 (I-CSCF), 3
802 (MRFC), 4 (MGCF), 5 (BFCF) or 6 (AS)
803
804 Default value is 0 (S-CSCF).
805
806 Example 1.31. node_funcparameter usage
807 ...
808 modparam("ims_charging", "node_func", 1)
809 ...
810
811 5. Functions
812
813 5.1. Ro_CCR(route_name, direction, reservation_units,
814 incoming_trunk_id, outgoing_trunk_id)
815
816 5.2. Ro_set_session_id_avp()
817
818 5.1. Ro_CCR(route_name, direction, reservation_units, incoming_trunk_id,
819 outgoing_trunk_id)
820
821 Perform a CCR on Diameter Ro interface for Charging
822
823 Meaning of the parameters is as follows:
824 * route_name route to be executed upon reception of charging requests
825 * direction "orig"inating or "term"inating
826 * reservation_units how many units (at the moment seconds) should be
827 reserved at the moment.
828 * incoming_trunk_id Identifies the trunk group from which this
829 originates.
830 * outgoing_trunk_id Identifies the trunk group where this will be
831 terminated.
832
833 This function can be used from REQUEST_ROUTE.
834
835 This method is executed asynchronously. See example on how to retrieve
836 return value.
837
838 Example 1.32. Ro_CCR
839 ...
840 xlog("L_DBG","Sending initial CCR Request for call\n");
841 Ro_CCR("RO_ASYNC_TERM_REPLY", "term", 30, "1", "1");
842 }
843
844 route[CHARGING_CCR_REPLY]
845 xlog("L_DBG","cca_return code is $avp(s:cca_return_code)\n");
846 switch ($avp(s:cca_return_code)) {
847 case 1: #success
848 xlog("L_DBG", "CCR success - will route message\n");
849 route(Finalize_Orig);
850 break;
851 case -1: #failure
852 xlog("L_ERR", "CCR failure - error response sent from module\n");
853 sl_send_reply("402","Payment required");
854 break;
855 case -2: #error
856 xlog("L_ERR", "CCR error - error response sent from module\n");
857 sl_send_reply("500", "Charging Error");
858 break;
859 default:
860 xlog("L_ERR", "Unknown return code from CCR: [$avp(s:cca_return_code)] \
861 n");
862 break;
863 }
864 exit;
865 }
866 ...
867
868 5.2. Ro_set_session_id_avp()
869
870 Sets the Ro session ID to an AVP for use in the config file
871
872 This function can be used from REQUEST_ROUTE or ONREPLY_ROUTE.
873
874 Example 1.33. Ro_set_session_id_avp
875 ...
876 Ro_set_session_id_avp();
877 xlog("L_DBG","Ro session AVP has been set: $avp(ro_session_id)\n");
878 ...
879
880 6. Statistics
881
882 6.1. Initial CCRs (initial_ccrs)
883 6.2. Interim CCRs (interim_ccrs)
884 6.3. Final CCRs (final_ccrs)
885 6.4. Successful initial CCRs (successful_initial_ccrs)
886 6.5. Successful interim CCRs (successful_interim_ccrs)
887 6.6. Successful final CCRs (successful_final_ccrs)
888 6.7. Failed initial CCRs (failed_initial_ccrs)
889 6.8. Failed interim CCRs (failed_interim_ccrs)
890 6.9. Failed final CCRs (failed_final_ccrs)
891 6.10. CCRs average response time (ccr_avg_response_time)
892 6.11. CCRs responses time (ccr_responses_time)
893 6.12. CCRs requests, which ended with a timeout (ccr_timeouts)
894 6.13. Billed seconds (billed_secs)
895 6.14. Killed calls (killed_calls)
896
897 6.1. Initial CCRs (initial_ccrs)
898
899 The number of initial CCRs, i.e., the CCRs that were sent for the
900 initial INVITEs.
901
902 6.2. Interim CCRs (interim_ccrs)
903
904 The number of CCRs sent within established sessions.
905
906 6.3. Final CCRs (final_ccrs)
907
908 The number of CCRs sent to terminate a session.
909
910 6.4. Successful initial CCRs (successful_initial_ccrs)
911
912 Initial CCRs that ended with DIAMETER_SUCCESS response code.
913
914 6.5. Successful interim CCRs (successful_interim_ccrs)
915
916 Interim CCRs that ended with DIAMETER_SUCCESS response code.
917
918 6.6. Successful final CCRs (successful_final_ccrs)
919
920 Final CCRs that ended with DIAMETER_SUCCESS response code.
921
922 6.7. Failed initial CCRs (failed_initial_ccrs)
923
924 Initial CCRs that ended with no DIAMETER_SUCCESS response or with some
925 other error during processing.
926
927 6.8. Failed interim CCRs (failed_interim_ccrs)
928
929 Interim CCRs that ended with no DIAMETER_SUCCESS response or with some
930 other error during processing.
931
932 6.9. Failed final CCRs (failed_final_ccrs)
933
934 Final CCRs that ended with no DIAMETER_SUCCESS response or with some
935 other error during processing.
936
937 6.10. CCRs average response time (ccr_avg_response_time)
938
939 Average CCA arrival time in milliseconds.
940
941 6.11. CCRs responses time (ccr_responses_time)
942
943 Total CCA arrival time in milliseconds.
944
945 6.12. CCRs requests, which ended with a timeout (ccr_timeouts)
946
947 Number of CCR-Requests, which ran into a timeout.
948
949 6.13. Billed seconds (billed_secs)
950
951 Number of seconds billed in total.
952
953 6.14. Killed calls (killed_calls)
954
955 Number of calls that were killed due to lack of credit.