SWITCH_DECLARE(switch_status_t) switch_channel_set_profile_var(switch_channel_t *channel, const char *name, const char *val);
+SWITCH_DECLARE(switch_status_t) switch_channel_set_log_tag(switch_channel_t *channel, const char *tagname, const char *tagvalue);
+SWITCH_DECLARE(switch_status_t) switch_channel_get_log_tags(switch_channel_t *channel, switch_event_t **log_tags);
+
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_var_check(switch_channel_t *channel,
const char *varname, const char *value, switch_bool_t var_check);
SWITCH_DECLARE(switch_status_t) switch_channel_add_variable_var_check(switch_channel_t *channel,
switch_hold_record_t *hold_record;
switch_device_node_t *device_node;
char *device_id;
+ switch_event_t *log_tags;
};
static void process_device_hup(switch_channel_t *channel);
switch_event_destroy(&channel->api_list);
switch_event_destroy(&channel->var_list);
switch_event_destroy(&channel->app_list);
+ if (channel->log_tags) {
+ switch_event_destroy(&channel->log_tags);
+ }
switch_mutex_unlock(channel->profile_mutex);
}
switch_safe_free(data_copy);
}
+SWITCH_DECLARE(switch_status_t) switch_channel_set_log_tag(switch_channel_t *channel, const char *tagname, const char *tagvalue)
+{
+ switch_status_t status = SWITCH_STATUS_FALSE;
+ switch_assert(channel != NULL);
+ switch_mutex_lock(channel->profile_mutex);
+ if (!zstr(tagname)) {
+ if (!channel->log_tags) {
+ switch_event_create_plain(&channel->log_tags, SWITCH_EVENT_CHANNEL_DATA);
+ }
+ if (zstr(tagvalue)) {
+ switch_event_del_header(channel->log_tags, tagname);
+ } else {
+ switch_event_add_header_string(channel->log_tags, SWITCH_STACK_BOTTOM, tagname, tagvalue);
+ }
+ status = SWITCH_STATUS_SUCCESS;
+ }
+ switch_mutex_unlock(channel->profile_mutex);
+ return status;
+}
+
+SWITCH_DECLARE(switch_status_t) switch_channel_get_log_tags(switch_channel_t *channel, switch_event_t **log_tags)
+{
+ switch_status_t status = SWITCH_STATUS_FALSE;
+ switch_assert(channel != NULL);
+ switch_mutex_lock(channel->profile_mutex);
+ if (channel->log_tags && log_tags) {
+ status = switch_event_dup(log_tags, channel->log_tags);
+ }
+ switch_mutex_unlock(channel->profile_mutex);
+ return status;
+}
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_var_check(switch_channel_t *channel,
const char *varname, const char *value, switch_bool_t var_check)
switch_assert(newnode->userdata);
}
+ if (node->tags) {
+ switch_event_dup(&newnode->tags, node->tags);
+ }
+
return newnode;
}
if (node) {
switch_safe_free(node->userdata);
switch_safe_free(node->data);
+ if (node->tags) {
+ switch_event_destroy(&node->tags);
+ }
#ifdef SWITCH_LOG_RECYCLE
if (switch_queue_trypush(LOG_RECYCLE_QUEUE, node) != SWITCH_STATUS_SUCCESS) {
free(node);
node->content = content;
node->timestamp = now;
node->channel = channel;
+ node->tags = NULL;
if (channel == SWITCH_CHANNEL_ID_SESSION) {
switch_core_session_t *session = (switch_core_session_t *) userdata;
node->userdata = userdata ? strdup(switch_core_session_get_uuid(session)) : NULL;
+ if (session) {
+ switch_channel_get_log_tags(switch_core_session_get_channel(session), &node->tags);
+ }
} else {
node->userdata = !zstr(userdata) ? strdup(userdata) : NULL;
}