Debian Codegraph @

src/modules/ims_ocs/README

raw
1 IMS Online Charging Server (OCS) Module
2
3 Carsten Bock
4
5 ng-voice GmbH
6
7 Copyright © 2016 ng-voice GmbH
8 __________________________________________________________________
9
10 Table of Contents
11
12 1. Admin Guide
13
14 1. Overview
15 2. Dependencies
16
17 2.1. Kamailio Modules
18 2.2. External Libraries or Applications
19
20 3. Faked Messages
21
22 3.1. Translating SIP to Diameter
23 3.2. SIP-Information in the faked messages
24
25 4. Functions
26
27 4.1. ccr_result(resultcode, grantedunits, finalunit)
28
29 5. Event routes
30
31 5.1. ocs:ccr-orig
32 5.2. ocs:ccr-term
33
34 List of Examples
35
36 1.1. ds_select_dst usage
37
38 Chapter 1. Admin Guide
39
40 Table of Contents
41
42 1. Overview
43 2. Dependencies
44
45 2.1. Kamailio Modules
46 2.2. External Libraries or Applications
47
48 3. Faked Messages
49
50 3.1. Translating SIP to Diameter
51 3.2. SIP-Information in the faked messages
52
53 4. Functions
54
55 4.1. ccr_result(resultcode, grantedunits, finalunit)
56
57 5. Event routes
58
59 5.1. ocs:ccr-orig
60 5.2. ocs:ccr-term
61
62 1. Overview
63
64 This module provides a simple Online Charging Server Module for working
65 with the ims_charging module. It communicates with the ims_charging
66 module via the Diameter-Ro Interface.
67
68 This module is dependent on the CDP (C Diameter Peer) modules for
69 communicating with a Charging-Server as specified in 3GPP specification
70 TS xx.xxx.
71
72 Please also refer to RFC 4006 (Diameter Credit-Control Application).
73
74 The module works will create fake SIP messages and provide them to an
75 event route for further operations. It up to the script writer to do
76 the processing.
77
78 2. Dependencies
79
80 2.1. Kamailio Modules
81 2.2. External Libraries or Applications
82
83 2.1. Kamailio Modules
84
85 The Following modules must be loaded before this module:
86 * CDP - C Diameter Peer
87 * CDP_AVP - CDP AVP Applications
88
89 2.2. External Libraries or Applications
90
91 No external libraries are required.
92
93 3. Faked Messages
94
95 3.1. Translating SIP to Diameter
96 3.2. SIP-Information in the faked messages
97
98 3.1. Translating SIP to Diameter
99
100 The incoming Charging requests are translated into the following
101 methods:
102 * INVITE - For "Start" Charging Requests
103 * UPDATE - For "Interim" Charging Requests
104 * BYE - For "Stop" Charging Requests
105
106 3.2. SIP-Information in the faked messages
107
108 The faked messages contain the following information:
109 * Method - See previous section
110 * Request-URI - The dialed number of the call
111 * From-Header - The originator of the session
112 * To-Header - Same as request-URI
113 * Call-ID - The Diameter-Charging-ID (not the SIP-Call-ID)
114 * P-Requested-Units - The requested units for this call
115 * P-Used-Units - The used units for this call (only useful for
116 Interim and Stop Events)
117 * P-Access-Network-Info - The used access network - if available
118 * P-Service-Identifier - The service identifier, if you want to
119 differentiate different services (e.g. Audio and Video)
120
121 4. Functions
122
123 4.1. ccr_result(resultcode, grantedunits, finalunit)
124
125 4.1. ccr_result(resultcode, grantedunits, finalunit)
126
127 This method sets the response code of the Diameter Request.
128
129 Meaning of the parameters is as follows:
130 * resultcode - the Diameter Response code for the request. Typical
131 response codes are:
132 + “2001” - Ok
133 + “5030” - User unknown
134 + “5031” - Rating failed
135 + “4010” - End-User Service denied (e.g. Service blocked)
136 + “5006” - Resources exceeded (e.g. too many concurrent calls)
137 * grantedunits - the number of granted units for this particular user
138 * finalunit - indication, that all following requests will be denied
139 (this is the final unit for the session)
140
141 This function can be used from the event route.
142
143 Example 1.1. ds_select_dst usage
144 ...
145 ccr_result("2001", "600", "0");
146 ...
147 $var(result) = 2001;
148 $var(granted) = $hdr(P-Requested-Units);
149 $var(final) = 0;
150 ccr_result("$var(result)", "$var(granted)", "$var(final)");
151 ...
152 ccr_result("2001", "$hdr(P-Requested-Units)", "0");
153 ...
154
155 5. Event routes
156
157 5.1. ocs:ccr-orig
158 5.2. ocs:ccr-term
159
160 5.1. ocs:ccr-orig
161
162 This route is called for Charging Requests with the session-case
163 "originating" - a call from a user to another destination.
164 ...
165 event_route[ocs:ccr-orig] {
166 xlog("Session-Case: Originating\n");
167 xlog("----------------------------------------\n");
168 if (is_method("INVITE")) {
169 xlog("START - Request\n");
170 } else if (is_method("UPDATE")) {
171 xlog("INTERIM - Request\n");
172 } else if (is_method("BYE")) {
173 xlog("STOP - Request\n");
174 }
175 xlog("----------------------------------------\n");
176 xlog("From: $fu\n");
177 xlog("To: $ru\n");
178 xlog("Call-ID: $ci\n");
179 xlog("Requested Units: $hdr(P-Requested-Units)\n");
180 xlog("Used Units: $hdr(P-Used-Units)\n");
181 xlog("Access Network: $hdr(P-Access-Network-Info)\n");
182 xlog("Service Identifier: $hdr(P-Service-Identifier)\n");
183
184 ccr_result("2001", "600", "0");
185 }
186 ...
187
188 5.2. ocs:ccr-term
189
190 This route is called for Charging Requests with the session-case
191 "terminating" - a call to a user from another destination.
192
193 You can have an "originating" and a "terminating" request for a single
194 call, e.g. if a user calls another user. Since the Diameter-Session-ID
195 is provided as "Call-ID", it will have a different Call-ID, since it is
196 logical two separate sessions.
197
198 This route is optional.
199 ...
200 event_route[ocs:ccr-term] {
201 xlog("Session-Case: Terminating\n");
202 xlog("----------------------------------------\n");
203 if (is_method("INVITE")) {
204 xlog("START - Request\n");
205 } else if (is_method("UPDATE")) {
206 xlog("INTERIM - Request\n");
207 } else if (is_method("BYE")) {
208 xlog("STOP - Request\n");
209 }
210 xlog("----------------------------------------\n");
211 xlog("From: $fu\n");
212 xlog("To: $ru\n");
213 xlog("Call-ID: $ci\n");
214 xlog("Requested Units: $hdr(P-Requested-Units)\n");
215 xlog("Used Units: $hdr(P-Used-Units)\n");
216 xlog("Access Network: $hdr(P-Access-Network-Info)\n");
217 xlog("Service Identifier: $hdr(P-Service-Identifier)\n");
218
219 ccr_result("2001", "600", "0");
220 }
221 ...