|
96 | 96 | any loading of backend CDR modules. Default is "yes".</para>
|
97 | 97 | </description>
|
98 | 98 | </configOption>
|
| 99 | + <configOption name="channeldefaultenabled"> |
| 100 | + <synopsis>Whether CDR is enabled on a channel by default</synopsis> |
| 101 | + <description><para>Define whether or not CDR should be enabled on a channel by default. |
| 102 | + Setting this to "yes" will enable CDR on every channel unless it is explicitly disabled. |
| 103 | + Setting this to "no" will disable CDR on every channel unless it is explicitly enabled. |
| 104 | + Default is "yes".</para> |
| 105 | + <para>Note that CDR must still be globally enabled (<literal>enable = yes</literal>) for this |
| 106 | + option to have any effect. This only applies to whether CDR is enabled or disabled on |
| 107 | + newly created channels, which can be changed in the dialplan during a call.</para> |
| 108 | + <para>If this is set to "yes", you should use <literal>Set(CDR_PROP(disable)=1)</literal> |
| 109 | + to disable CDR for a call.</para> |
| 110 | + <para>If this is set to "no", you should use <literal>Set(CDR_PROP(disable)=0)</literal> |
| 111 | + to undisable (enable) CDR for a call.</para> |
| 112 | + </description> |
| 113 | + </configOption> |
99 | 114 | <configOption name="unanswered">
|
100 | 115 | <synopsis>Log calls that are never answered and don't set an outgoing party.</synopsis>
|
101 | 116 | <description><para>
|
|
192 | 207 | #define DEFAULT_CONGESTION "0"
|
193 | 208 | #define DEFAULT_END_BEFORE_H_EXTEN "1"
|
194 | 209 | #define DEFAULT_INITIATED_SECONDS "0"
|
| 210 | +#define DEFAULT_CHANNEL_ENABLED "1" |
195 | 211 |
|
196 | 212 | #define DEFAULT_BATCH_SIZE "100"
|
197 | 213 | #define MAX_BATCH_SIZE 1000
|
@@ -2281,12 +2297,25 @@ static void handle_channel_snapshot_update_message(void *data, struct stasis_sub
|
2281 | 2297 | }
|
2282 | 2298 |
|
2283 | 2299 | if (update->new_snapshot && !update->old_snapshot) {
|
| 2300 | + struct module_config *mod_cfg = NULL; |
| 2301 | + |
2284 | 2302 | cdr = cdr_object_alloc(update->new_snapshot, stasis_message_timestamp(message));
|
2285 | 2303 | if (!cdr) {
|
2286 | 2304 | return;
|
2287 | 2305 | }
|
| 2306 | + mod_cfg = ao2_global_obj_ref(module_configs); |
2288 | 2307 | cdr->is_root = 1;
|
2289 | 2308 | ao2_link(active_cdrs_master, cdr);
|
| 2309 | + |
| 2310 | + /* If CDR should be disabled unless enabled on a per-channel basis, then disable |
| 2311 | + CDR, right from the get go */ |
| 2312 | + if (mod_cfg) { |
| 2313 | + if (!ast_test_flag(&mod_cfg->general->settings, CDR_CHANNEL_DEFAULT_ENABLED)) { |
| 2314 | + ast_debug(3, "Disable CDR by default\n"); |
| 2315 | + ast_set_flag(&cdr->flags, AST_CDR_FLAG_DISABLE_ALL); |
| 2316 | + } |
| 2317 | + ao2_cleanup(mod_cfg); |
| 2318 | + } |
2290 | 2319 | } else {
|
2291 | 2320 | cdr = ao2_find(active_cdrs_master, update->new_snapshot->base->uniqueid, OBJ_SEARCH_KEY);
|
2292 | 2321 | }
|
@@ -4168,6 +4197,7 @@ static char *handle_cli_status(struct ast_cli_entry *e, int cmd, struct ast_cli_
|
4168 | 4197 | ast_cli(a->fd, " Logging: %s\n", ast_test_flag(&mod_cfg->general->settings, CDR_ENABLED) ? "Enabled" : "Disabled");
|
4169 | 4198 | ast_cli(a->fd, " Mode: %s\n", ast_test_flag(&mod_cfg->general->settings, CDR_BATCHMODE) ? "Batch" : "Simple");
|
4170 | 4199 | if (ast_test_flag(&mod_cfg->general->settings, CDR_ENABLED)) {
|
| 4200 | + ast_cli(a->fd, " Log calls by default: %s\n", ast_test_flag(&mod_cfg->general->settings, CDR_CHANNEL_DEFAULT_ENABLED) ? "Yes" : "No"); |
4171 | 4201 | ast_cli(a->fd, " Log unanswered calls: %s\n", ast_test_flag(&mod_cfg->general->settings, CDR_UNANSWERED) ? "Yes" : "No");
|
4172 | 4202 | ast_cli(a->fd, " Log congestion: %s\n\n", ast_test_flag(&mod_cfg->general->settings, CDR_CONGESTION) ? "Yes" : "No");
|
4173 | 4203 | if (ast_test_flag(&mod_cfg->general->settings, CDR_BATCHMODE)) {
|
@@ -4348,6 +4378,7 @@ static int process_config(int reload)
|
4348 | 4378 | aco_option_register(&cfg_info, "safeshutdown", ACO_EXACT, general_options, DEFAULT_BATCH_SAFE_SHUTDOWN, OPT_BOOLFLAG_T, 1, FLDSET(struct ast_cdr_config, batch_settings.settings), BATCH_MODE_SAFE_SHUTDOWN);
|
4349 | 4379 | aco_option_register(&cfg_info, "size", ACO_EXACT, general_options, DEFAULT_BATCH_SIZE, OPT_UINT_T, PARSE_IN_RANGE, FLDSET(struct ast_cdr_config, batch_settings.size), 0, MAX_BATCH_SIZE);
|
4350 | 4380 | aco_option_register(&cfg_info, "time", ACO_EXACT, general_options, DEFAULT_BATCH_TIME, OPT_UINT_T, PARSE_IN_RANGE, FLDSET(struct ast_cdr_config, batch_settings.time), 1, MAX_BATCH_TIME);
|
| 4381 | + aco_option_register(&cfg_info, "channeldefaultenabled", ACO_EXACT, general_options, DEFAULT_CHANNEL_ENABLED, OPT_BOOLFLAG_T, 1, FLDSET(struct ast_cdr_config, settings), CDR_CHANNEL_DEFAULT_ENABLED); |
4351 | 4382 | }
|
4352 | 4383 |
|
4353 | 4384 | if (aco_process_config(&cfg_info, reload) == ACO_PROCESS_ERROR) {
|
|
0 commit comments