| 1 |
cfgt Module |
| 2 |
|
| 3 |
Victor Seva |
| 4 |
|
| 5 |
sipwise.com |
| 6 |
|
| 7 |
Edited by |
| 8 |
|
| 9 |
Victor Seva |
| 10 |
|
| 11 |
<[email protected]> |
| 12 |
|
| 13 |
Copyright © 2015 Victor Seva (sipwise.com) |
| 14 |
__________________________________________________________________ |
| 15 |
|
| 16 |
Table of Contents |
| 17 |
|
| 18 |
1. Admin Guide |
| 19 |
|
| 20 |
1. Overview |
| 21 |
2. Dependencies |
| 22 |
|
| 23 |
2.1. Kamailio Modules |
| 24 |
2.2. External Libraries or Applications |
| 25 |
|
| 26 |
3. Parameters |
| 27 |
|
| 28 |
3.1. basedir (string) |
| 29 |
3.2. mask (int) |
| 30 |
3.3. callid_prefix (string) |
| 31 |
3.4. skip_unknown (int) |
| 32 |
3.5. route_log (int) |
| 33 |
|
| 34 |
4. RPC Commands |
| 35 |
|
| 36 |
4.1. cfgt.mask |
| 37 |
4.2. cfgt.list |
| 38 |
4.3. cfgt.clean |
| 39 |
|
| 40 |
5. Usage |
| 41 |
6. Report format |
| 42 |
|
| 43 |
List of Examples |
| 44 |
|
| 45 |
1.1. Set cfgtrace parameter |
| 46 |
1.2. Set mask parameter |
| 47 |
1.3. Set callid_prefix parameter |
| 48 |
1.4. Set skip_unknown parameter |
| 49 |
1.5. Set route_log parameter |
| 50 |
|
| 51 |
Chapter 1. Admin Guide |
| 52 |
|
| 53 |
Table of Contents |
| 54 |
|
| 55 |
1. Overview |
| 56 |
2. Dependencies |
| 57 |
|
| 58 |
2.1. Kamailio Modules |
| 59 |
2.2. External Libraries or Applications |
| 60 |
|
| 61 |
3. Parameters |
| 62 |
|
| 63 |
3.1. basedir (string) |
| 64 |
3.2. mask (int) |
| 65 |
3.3. callid_prefix (string) |
| 66 |
3.4. skip_unknown (int) |
| 67 |
3.5. route_log (int) |
| 68 |
|
| 69 |
4. RPC Commands |
| 70 |
|
| 71 |
4.1. cfgt.mask |
| 72 |
4.2. cfgt.list |
| 73 |
4.3. cfgt.clean |
| 74 |
|
| 75 |
5. Usage |
| 76 |
6. Report format |
| 77 |
|
| 78 |
1. Overview |
| 79 |
|
| 80 |
This module provides a report of the way Kamailio SIP Server Platform |
| 81 |
configuration has been executed as part of a unit test for different |
| 82 |
SIP scenarios. |
| 83 |
|
| 84 |
In order to identify different scenarios a prefix string should be used |
| 85 |
inside the Call-ID header. |
| 86 |
|
| 87 |
2. Dependencies |
| 88 |
|
| 89 |
2.1. Kamailio Modules |
| 90 |
2.2. External Libraries or Applications |
| 91 |
|
| 92 |
2.1. Kamailio Modules |
| 93 |
|
| 94 |
The following modules must be loaded before this module: |
| 95 |
* pv. |
| 96 |
|
| 97 |
2.2. External Libraries or Applications |
| 98 |
|
| 99 |
The following libraries or applications must be installed before |
| 100 |
running Kamailio with this module loaded: |
| 101 |
* None. |
| 102 |
|
| 103 |
3. Parameters |
| 104 |
|
| 105 |
3.1. basedir (string) |
| 106 |
3.2. mask (int) |
| 107 |
3.3. callid_prefix (string) |
| 108 |
3.4. skip_unknown (int) |
| 109 |
3.5. route_log (int) |
| 110 |
|
| 111 |
3.1. basedir (string) |
| 112 |
|
| 113 |
Control where the config reports should be stored. The dir must exist |
| 114 |
and Kamailio SIP Server Platform must have permissions to write on it. |
| 115 |
|
| 116 |
Default value is “/tmp”. |
| 117 |
|
| 118 |
Example 1.1. Set cfgtrace parameter |
| 119 |
... |
| 120 |
modparam("cfgt", "basedir", "/run/kamailio/cfgtest") |
| 121 |
... |
| 122 |
|
| 123 |
3.2. mask (int) |
| 124 |
|
| 125 |
mask - Control the type of vars it should display in the report: |
| 126 |
* 1 - dump null values |
| 127 |
* 2 - dump avp vars |
| 128 |
* 4 - dump script vars |
| 129 |
* 8 - dump xavp vars |
| 130 |
* 16 - dump DP_OTHER vars |
| 131 |
* 32 - dump ALL vars |
| 132 |
|
| 133 |
Default value is “32” (ALL). |
| 134 |
|
| 135 |
Example 1.2. Set mask parameter |
| 136 |
... |
| 137 |
# dump xavp(8) and avp(4) vars |
| 138 |
modparam("cfgt", "mask", 12) |
| 139 |
... |
| 140 |
|
| 141 |
3.3. callid_prefix (string) |
| 142 |
|
| 143 |
Prefix used to identify test scenario messages. Last char of the string |
| 144 |
will be used as delimiter for the scenario ID. With parameter set to |
| 145 |
“NGCP%” and Call-ID “NGCP%123%456” the scenario identified will be |
| 146 |
“123”. |
| 147 |
|
| 148 |
Default value is “NGCP%” (using “%” as delimiter). |
| 149 |
|
| 150 |
Example 1.3. Set callid_prefix parameter |
| 151 |
... |
| 152 |
# using '%' as delimiter |
| 153 |
modparam("cfgt", "callid_prefix", "TEST-ID%") |
| 154 |
... |
| 155 |
|
| 156 |
3.4. skip_unknown (int) |
| 157 |
|
| 158 |
If enabled, value different from 0, cfgt will not generate the report |
| 159 |
of any message that doesn't match the callid_prefix. |
| 160 |
|
| 161 |
Default value is “0”, false. |
| 162 |
|
| 163 |
Example 1.4. Set skip_unknown parameter |
| 164 |
... |
| 165 |
modparam("cfgt", "skip_unknown", "1") |
| 166 |
... |
| 167 |
|
| 168 |
3.5. route_log (int) |
| 169 |
|
| 170 |
If enabled, value different from 0, cfgt will log (WARN) the execution |
| 171 |
time of routes. |
| 172 |
|
| 173 |
Default value is “0”, false. |
| 174 |
|
| 175 |
Example 1.5. Set route_log parameter |
| 176 |
... |
| 177 |
modparam("cfgt", "route_log", "1") |
| 178 |
... |
| 179 |
|
| 180 |
4. RPC Commands |
| 181 |
|
| 182 |
4.1. cfgt.mask |
| 183 |
4.2. cfgt.list |
| 184 |
4.3. cfgt.clean |
| 185 |
|
| 186 |
4.1. cfgt.mask |
| 187 |
|
| 188 |
Sets mask module parameter. |
| 189 |
|
| 190 |
Name: cfgt.mask |
| 191 |
|
| 192 |
Parameters: |
| 193 |
* mask : int value |
| 194 |
|
| 195 |
Example: |
| 196 |
... |
| 197 |
kamcmd cfgt.mask 32 |
| 198 |
... |
| 199 |
|
| 200 |
4.2. cfgt.list |
| 201 |
|
| 202 |
Lists reports info in memory. |
| 203 |
|
| 204 |
Name: cfgt.list |
| 205 |
|
| 206 |
Example: |
| 207 |
... |
| 208 |
kamcmd cfgt.list |
| 209 |
{ |
| 210 |
uuid: unknown |
| 211 |
msgid: 2 |
| 212 |
} |
| 213 |
{ |
| 214 |
uuid: whatever |
| 215 |
msgid: 1 |
| 216 |
} |
| 217 |
200 ok |
| 218 |
... |
| 219 |
|
| 220 |
4.3. cfgt.clean |
| 221 |
|
| 222 |
Removes reports from disk and cleans info in memory. |
| 223 |
|
| 224 |
Name: cfgt.clean |
| 225 |
|
| 226 |
Parameters: |
| 227 |
* report : string value |
| 228 |
use 'all' to clean any report |
| 229 |
|
| 230 |
Example: |
| 231 |
... |
| 232 |
kamcmd cfgt.clean unknown |
| 233 |
... |
| 234 |
kamcmd cfgt.clean all |
| 235 |
... |
| 236 |
|
| 237 |
5. Usage |
| 238 |
|
| 239 |
This module is used by the debugger module, so it must be loaded first. |
| 240 |
To enable the generation of the reports, the debugger module must be |
| 241 |
configured by setting the cfgtest parameter to "1". |
| 242 |
|
| 243 |
Example of configuration: |
| 244 |
... |
| 245 |
#!ifdef WITH_DEBUG |
| 246 |
loadmodule "cfgt.so" |
| 247 |
loadmodule "debugger.so" |
| 248 |
#!endif |
| 249 |
... |
| 250 |
#!ifdef WITH_DEBUG |
| 251 |
# ----- cfgt params ----- |
| 252 |
modparam("cfgt", "basedir", "/tmp/kamailio/cfgtest") |
| 253 |
modparam("cfgt", "callid_prefix", "TRACE-ID%") |
| 254 |
modparam("cfgt", "mask", 32) |
| 255 |
|
| 256 |
# ----- debugger params ----- |
| 257 |
modparam("debugger", "cfgtrace", 1) |
| 258 |
modparam("debugger", "log_level_name", "exec") |
| 259 |
|
| 260 |
modparam("debugger", "cfgtest", 1) |
| 261 |
#!endif |
| 262 |
... |
| 263 |
|
| 264 |
6. Report format |
| 265 |
|
| 266 |
cfgt generates a json file per request processed. The files are created |
| 267 |
at <basedir>/<prefix>/<message_id>.json. The “message_id” is a sequence |
| 268 |
starting with 1 per scenario defined by “prefix” module parameter. |
| 269 |
|
| 270 |
The json report has three top members, “flow”, “sip_in” and “sip_out” |
| 271 |
describing, the flow of the configuration routes, the SIP message |
| 272 |
processed and the SIP messages sent during that process execution. |
| 273 |
|
| 274 |
The flow of the configuration routes is defined by an array of routes |
| 275 |
with the content of the variables controlled by “mask” module |
| 276 |
parameter. |
| 277 |
|
| 278 |
Each routename has a prefix as “start|”, “return|”, when the route |
| 279 |
finish its execution and “exit|” or “drop|” if the route finish its |
| 280 |
execution with exit or drop. |
| 281 |
{ |
| 282 |
"flow": [{ |
| 283 |
"start|DEFAULT_ROUTE": { |
| 284 |
"$var(userprov_domain)": "spce.test", |
| 285 |
"$fU": "testuser1002", |
| 286 |
[...]}, |
| 287 |
"start|ROUTE_NET_INFO": {[...]}, |
| 288 |
"return|ROUTE_NET_INFO": {[...]}, |
| 289 |
[...] |
| 290 |
"start|ROUTE_AUTH": {[...]}, |
| 291 |
"exit|ROUTE_AUTH": {[...]}, |
| 292 |
}, |
| 293 |
"sip_in": ["INVITE sip:[email protected] SIP/2.0\r\nRecord-Route: [...]\r\n"], |
| 294 |
"sip_out": ["SIP/2.0 100 Trying\r\nVia: SIP/2.0/UDP 127.0.0.1[...]\r\n", "SIP/2 |
| 295 |
.0 407 Proxy Authentication Required[...]\r\n"] |
| 296 |
} |