add some more reporting data to logs

This commit is contained in:
Anthony Minessale
2011-10-11 15:13:23 -05:00
parent dd5188f3a1
commit 1bf97fa7ba
10 changed files with 189 additions and 10 deletions

View File

@@ -48,11 +48,15 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(switch_memor
const char *source, const char *context, const char *destination_number)
{
switch_caller_profile_t *profile = NULL;
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
profile = switch_core_alloc(pool, sizeof(*profile));
switch_assert(profile != NULL);
memset(profile, 0, sizeof(*profile));
switch_uuid_str(uuid_str, sizeof(uuid_str));
profile->uuid_str = switch_core_strdup(pool, uuid_str);
if (!context) {
context = "default";
}
@@ -96,10 +100,15 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(switch_memor
SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_dup(switch_memory_pool_t *pool, switch_caller_profile_t *tocopy)
{
switch_caller_profile_t *profile = NULL;
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
profile = switch_core_alloc(pool, sizeof(*profile));
switch_assert(profile != NULL);
switch_uuid_str(uuid_str, sizeof(uuid_str));
profile->uuid_str = switch_core_strdup(pool, uuid_str);
profile->clone_of = switch_core_strdup(pool, tocopy->uuid_str);
profile_dup(tocopy->username, profile->username, pool);
profile_dup(tocopy->dialplan, profile->dialplan, pool);
profile_dup(tocopy->caller_id_name, profile->caller_id_name, pool);
@@ -181,6 +190,9 @@ SWITCH_DECLARE(const char *) switch_caller_get_field_by_name(switch_caller_profi
if (!strcasecmp(name, "source")) {
return caller_profile->source;
}
if (!strcasecmp(name, "transfer_source")) {
return caller_profile->transfer_source;
}
if (!strcasecmp(name, "context")) {
return caller_profile->context;
}
@@ -308,6 +320,10 @@ SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile_
switch_snprintf(header_name, sizeof(header_name), "%s-Source", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->source);
}
if (!zstr(caller_profile->transfer_source)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Transfer-Source", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->transfer_source);
}
if (!zstr(caller_profile->context)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Context", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->context);