===
===========================================================
From 12.0 to 12.1:
-* The per console verbose level feature as previously implemented caused a
+
+- The per console verbose level feature as previously implemented caused a
large performance penalty. The fix required some minor incompatibilities
if the new rasterisk is used to connect to an earlier version. If the new
rasterisk connects to an older Asterisk version then the root console verbose
an older version of rasterisk connects to the new version then the
"core set verbose" command will have no effect.
+CDRs:
+ - The "endbeforehexten" setting now defaults to "yes", instead of "no".
+ When set to "no", yhis setting will cause a new CDR to be generated when a
+ channel enters into hangup logic (either the 'h' extension or a hangup
+ handler subroutine). In general, this is not the preferred default: this
+ causes extra CDRs to be generated for a channel in many common dialplans.
+
CLI commands:
- "core show settings" now lists the current console verbosity in addition
to the root console verbosity.
modem options.
Realtime Configuration:
- * New columns have been added to realtime tables for 'support_path' on
+ - New columns have been added to realtime tables for 'support_path' on
ps_registrations and ps_aors and for 'path' on ps_contacts for the new
SIP Path support in chan_pjsip.
- * The following new tables have been added for pjsip realtime: 'ps_systems',
+ - The following new tables have been added for pjsip realtime: 'ps_systems',
'ps_globals', 'ps_tranports', 'ps_registrations'.
- * The following columns were added to the 'ps_aors' realtime table:
+ - The following columns were added to the 'ps_aors' realtime table:
'maximum_expiration', 'outbound_proxy', and 'support_path'.
- * The following columns were added to the 'ps_contacts' realtime table:
+ - The following columns were added to the 'ps_contacts' realtime table:
'outbound_proxy' and 'path'.
- * New columns have been added to the ps_endpoints realtime table for the
+ - New columns have been added to the ps_endpoints realtime table for the
'media_address', 'redirect_method' and 'set_var' options. Also the
'mwi_fromuser' column was renamed to 'mwi_from_user'.
- * WARNING: The database migration script that adds the 'extensions' table for
+ - WARNING: The database migration script that adds the 'extensions' table for
realtime had to be modified due to an error when installing for MySQL. The
'extensions' table's 'id' column was changed to be a primary key. This could
potentially cause a migration problem. If so, it may be necessary to
manually alter the affected table/column to bring it back in line with the
migration scripts.
- * A new column was added to the 'ps_globals' realtime table for the 'debug'
+ - A new column was added to the 'ps_globals' realtime table for the 'debug'
option.
From 11 to 12:
}
}
peer = c;
- ast_channel_publish_dial(in, peer, NULL, "ANSWER");
+ /* Inform everyone else that they've been canceled.
+ * The dial end event for the peer will be sent out after
+ * other Dial options have been handled.
+ */
publish_dial_end_event(in, out_chans, peer, "CANCEL");
ast_copy_flags64(peerflags, o,
OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER |
}
if ( (ast_test_flag64(&opts, OPT_PRIVACY) || ast_test_flag64(&opts, OPT_SCREENING)) && pa.privdb_val == AST_PRIVACY_UNKNOWN) {
if (do_privacy(chan, peer, &opts, opt_args, &pa)) {
+ ast_channel_publish_dial(chan, peer, NULL, pa.status);
res = 0;
goto out;
}
if (continue_exec)
*continue_exec = 1;
res = 0;
+ ast_channel_publish_dial(chan, peer, NULL, "ANSWER");
goto done;
}
ast_channel_exten_set(peer, ast_channel_exten(chan));
ast_channel_unlock(peer);
ast_channel_unlock(chan);
-
ast_replace_subargument_delimiter(opt_args[OPT_ARG_CALLEE_MACRO]);
res = ast_app_exec_macro(chan, peer, opt_args[OPT_ARG_CALLEE_MACRO]);
ast_set_flag64(peerflags, OPT_GO_ON);
}
}
+ ast_channel_publish_dial(chan, peer, NULL, macro_result);
} else {
ast_channel_unlock(peer);
}
ast_set_flag64(peerflags, OPT_GO_ON);
}
}
+ ast_channel_publish_dial(chan, peer, NULL, gosub_result);
} else {
ast_channel_unlock(peer);
ast_channel_unlock(chan);
}
if (!res) {
+
+ /* None of the Dial options changed our status; inform
+ * everyone that this channel answered
+ */
+ ast_channel_publish_dial(chan, peer, NULL, "ANSWER");
+
if (!ast_tvzero(calldurationlimit)) {
struct timeval whentohangup = ast_tvadd(ast_tvnow(), calldurationlimit);
ast_channel_lock(peer);
channel. Any statistics are gathered from this new CDR. By enabling
this option, no new CDR is created for the dialplan logic that is
executed in <literal>h</literal> extensions or attached hangup handler
- subroutines. The default value is <literal>no</literal>, indicating
+ subroutines. The default value is <literal>yes</literal>, indicating
that a CDR will be generated during hangup logic.</para>
</description>
</configOption>
#define DEFAULT_BATCHMODE "0"
#define DEFAULT_UNANSWERED "0"
#define DEFAULT_CONGESTION "0"
-#define DEFAULT_END_BEFORE_H_EXTEN "0"
+#define DEFAULT_END_BEFORE_H_EXTEN "1"
#define DEFAULT_INITIATED_SECONDS "0"
#define DEFAULT_BATCH_SIZE "100"
/*! \brief The parent topic for all topics we want to aggregate for CDRs */
static struct stasis_topic *cdr_topic;
+/*! \brief A message type used to synchronize with the CDR topic */
+STASIS_MESSAGE_TYPE_DEFN_LOCAL(cdr_sync_message_type);
+
struct cdr_object;
/*! \brief Return types for \ref process_bridge_enter functions */
/* Don't create records for CDRs where the party A was a dialed channel */
if (snapshot_is_dialed(it_cdr->party_a.snapshot) && !it_cdr->party_b.snapshot) {
- CDR_DEBUG(mod_cfg, "%p - %s is dialed and has no Party B; discarding\n", it_cdr,
+ ast_debug(1, "CDR for %s is dialed and has no Party B; discarding\n",
it_cdr->party_a.snapshot->name);
continue;
}
RAII_VAR(struct module_config *, mod_cfg, ao2_global_obj_ref(module_configs), ao2_cleanup);
ast_assert(strcasecmp(snapshot->name, cdr->party_a.snapshot->name) == 0);
+
cdr_object_swap_snapshot(&cdr->party_a, snapshot);
+ /* Ignore any snapshots from a dead or dying channel */
+ if (ast_test_flag(&snapshot->softhangup_flags, AST_SOFTHANGUP_HANGUP_EXEC)
+ && ast_test_flag(&mod_cfg->general->settings, CDR_END_BEFORE_H_EXTEN)) {
+ cdr_object_check_party_a_hangup(cdr);
+ return 0;
+ }
/* When Party A is originated to an application and the application exits, the stack
* will attempt to clear the application and restore the dummy originate application
&& !ast_test_flag(&cdr->flags, AST_CDR_LOCK_APP)) {
ast_string_field_set(cdr, appl, snapshot->appl);
ast_string_field_set(cdr, data, snapshot->data);
+
+ /* Dial (app_dial) is a special case. Because pre-dial handlers, which
+ * execute before the dial begins, will alter the application/data to
+ * something people typically don't want to see, if we see a channel enter
+ * into Dial here, we set the appl/data accordingly and lock it.
+ */
+ if (!strcmp(snapshot->appl, "Dial")) {
+ ast_set_flag(&cdr->flags, AST_CDR_LOCK_APP);
+ }
}
ast_string_field_set(cdr, linkedid, snapshot->linkedid);
cdr_object_swap_snapshot(&cdr->party_b, peer);
CDR_DEBUG(mod_cfg, "%p - Updated Party B %s snapshot\n", cdr,
cdr->party_b.snapshot->name);
+
+ /* If we have two parties, lock the application that caused the
+ * two parties to be associated. This prevents mid-call event
+ * macros/gosubs from perturbing the CDR application/data
+ */
+ ast_set_flag(&cdr->flags, AST_CDR_LOCK_APP);
} else if (!strcasecmp(cdr->party_a.snapshot->name, peer->name)) {
/* We're the entity being dialed, i.e., outbound origination */
cdr_object_swap_snapshot(&cdr->party_a, peer);
RAII_VAR(struct module_config *, mod_cfg,
ao2_global_obj_ref(module_configs), ao2_cleanup);
- /* If we ignore hangup logic, indicate that we don't need a new CDR */
- if (ast_test_flag(&mod_cfg->general->settings, CDR_END_BEFORE_H_EXTEN)
- && ast_test_flag(&snapshot->softhangup_flags, AST_SOFTHANGUP_HANGUP_EXEC)) {
+ if (ast_test_flag(&snapshot->softhangup_flags, AST_SOFTHANGUP_HANGUP_EXEC)
+ && ast_test_flag(&mod_cfg->general->settings, CDR_END_BEFORE_H_EXTEN)) {
return 0;
}
continue;
}
CDR_DEBUG(mod_cfg, "%p - Processing Dial Begin message for channel %s, peer %s\n",
- cdr,
+ it_cdr,
caller ? caller->name : "(none)",
peer ? peer->name : "(none)");
res &= it_cdr->fn_table->process_dial_begin(it_cdr,
continue;
}
CDR_DEBUG(mod_cfg, "%p - Processing Dial End message for channel %s, peer %s\n",
- cdr,
+ it_cdr,
caller ? caller->name : "(none)",
peer ? peer->name : "(none)");
it_cdr->fn_table->process_dial_end(it_cdr,
RAII_VAR(struct module_config *, mod_cfg,
ao2_global_obj_ref(module_configs), ao2_cleanup);
- if (!new_snapshot) {
- return 0;
- }
-
- if (ast_test_flag(&new_snapshot->flags, AST_FLAG_DEAD)) {
+ /* If we're dead, we don't need a new CDR */
+ if (!new_snapshot
+ || (ast_test_flag(&new_snapshot->softhangup_flags, AST_SOFTHANGUP_HANGUP_EXEC)
+ && ast_test_flag(&mod_cfg->general->settings, CDR_END_BEFORE_H_EXTEN))) {
return 0;
}
/* Party A */
ao2_lock(cdr);
for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->next) {
+
if (!it_cdr->fn_table->process_bridge_leave) {
continue;
}
}
+/*!
+ * \brief Handler for a synchronization message
+ * \param data Passed on
+ * \param sub The stasis subscription for this message callback
+ * \param topic The topic this message was published for
+ * \param message A blank ao2 object
+ * */
+static void handle_cdr_sync_message(void *data, struct stasis_subscription *sub,
+ struct stasis_message *message)
+{
+ return;
+}
+
struct ast_cdr_config *ast_cdr_get_config(void)
{
RAII_VAR(struct module_config *, mod_cfg, ao2_global_obj_ref(module_configs), ao2_cleanup);
new_cdr->fn_table = cdr_obj->fn_table;
ast_string_field_set(new_cdr, bridge, cdr->bridge);
new_cdr->flags = cdr->flags;
+ /* Explicitly clear the AST_CDR_LOCK_APP flag - we want
+ * the application to be changed on the new CDR if the
+ * dialplan demands it
+ */
+ ast_clear_flag(&new_cdr->flags, AST_CDR_LOCK_APP);
/* If there's a Party B, copy it over as well */
if (cdr_obj->party_b.snapshot) {
ao2_cleanup(cdr_topic);
cdr_topic = NULL;
+ STASIS_MESSAGE_TYPE_CLEANUP(cdr_sync_message_type);
+
ao2_callback(active_cdrs_by_channel, OBJ_NODATA, cdr_object_dispatch_all_cb,
NULL);
finalize_batch_mode();
if (!stasis_router) {
return -1;
}
+
+ if (STASIS_MESSAGE_TYPE_INIT(cdr_sync_message_type)) {
+ return -1;
+ }
+
stasis_message_router_add_cache_update(stasis_router, ast_channel_snapshot_type(), handle_channel_cache_message, NULL);
stasis_message_router_add(stasis_router, ast_channel_dial_type(), handle_dial_message, NULL);
stasis_message_router_add(stasis_router, ast_channel_entered_bridge_type(), handle_bridge_enter_message, NULL);
stasis_message_router_add(stasis_router, ast_channel_left_bridge_type(), handle_bridge_leave_message, NULL);
stasis_message_router_add(stasis_router, ast_parked_call_type(), handle_parked_call_message, NULL);
+ stasis_message_router_add(stasis_router, cdr_sync_message_type(), handle_cdr_sync_message, NULL);
active_cdrs_by_channel = ao2_container_alloc(NUM_CDR_BUCKETS,
cdr_object_channel_hash_fn, cdr_object_channel_cmp_fn);
void ast_cdr_engine_term(void)
{
RAII_VAR(struct module_config *, mod_cfg, ao2_global_obj_ref(module_configs), ao2_cleanup);
+ RAII_VAR(void *, payload, ao2_alloc(sizeof(*payload), NULL), ao2_cleanup);
+ RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
/* Since this is called explicitly during process shutdown, we might not have ever
* been initialized. If so, the config object will be NULL.
if (!mod_cfg) {
return;
}
- if (!ast_test_flag(&mod_cfg->general->settings, CDR_BATCHMODE)) {
+
+ /* Make sure we have the needed items */
+ if (!stasis_router || !payload) {
return;
}
- cdr_submit_batch(ast_test_flag(&mod_cfg->general->batch_settings.settings, BATCH_MODE_SAFE_SHUTDOWN));
+
+ ast_debug(1, "CDR Engine termination request received; waiting on messages...\n");
+
+ message = stasis_message_create(cdr_sync_message_type(), payload);
+ if (message) {
+ stasis_message_router_publish_sync(stasis_router, message);
+ }
+
+ if (ast_test_flag(&mod_cfg->general->settings, CDR_BATCHMODE)) {
+ cdr_submit_batch(ast_test_flag(&mod_cfg->general->batch_settings.settings, BATCH_MODE_SAFE_SHUTDOWN));
+ }
}
int ast_cdr_engine_reload(void)