summaryrefslogtreecommitdiff
path: root/res/res_pjsip/location.c
diff options
context:
space:
mode:
authorGeorge Joseph <george.joseph@fairview5.com>2015-11-30 21:19:18 -0700
committerGeorge Joseph <george.joseph@fairview5.com>2015-12-02 19:37:09 -0700
commitbd265a90be0f372ce71301ce358e92cdf2a5434d (patch)
tree6e4d137adda0a5aa9909d8164ffb94e509e871ad /res/res_pjsip/location.c
parentb5281b74e0572e9ca574098937765647bf2e953a (diff)
res_pjsip: Update logging to show contact->uri in messages
An earlier commit changed the id of dynamic contacts to contain a hash instead of the uri. This patch updates status change logging to show the aor/uri instead of the id. This required adding the aor id to contact and contact_status and adding uri to contact_status. The aor id gets added to contact and contact_status in their allocators and the uri gets added to contact_status in pjsip_options when the contact_status is created or updated. ASTERISK-25598 #close Reported-by: George Joseph Tested-by: George Joseph Change-Id: I56cbec1d2ddbe8461367dd8b6da8a6f47f6fe511
Diffstat (limited to 'res/res_pjsip/location.c')
-rw-r--r--res/res_pjsip/location.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c
index 2e0d84b84..4471d7c58 100644
--- a/res/res_pjsip/location.c
+++ b/res/res_pjsip/location.c
@@ -99,6 +99,9 @@ static void contact_destroy(void *obj)
static void *contact_alloc(const char *name)
{
struct ast_sip_contact *contact = ast_sorcery_generic_alloc(sizeof(*contact), contact_destroy);
+ char *id = ast_strdupa(name);
+ char *aor = id;
+ char *aor_separator = NULL;
if (!contact) {
return NULL;
@@ -109,6 +112,14 @@ static void *contact_alloc(const char *name)
return NULL;
}
+ /* Dynamic contacts are delimited with ";@" and static ones with "@@" */
+ if ((aor_separator = strstr(id, ";@")) || (aor_separator = strstr(id, "@@"))) {
+ *aor_separator = '\0';
+ }
+ ast_assert(aor_separator != NULL);
+
+ ast_string_field_set(contact, aor, aor);
+
return contact;
}
@@ -790,13 +801,14 @@ static int cli_contact_print_body(void *obj, void *arg, int flags)
ast_assert(context->output_buffer != NULL);
indent = CLI_INDENT_TO_SPACES(context->indent_level);
- flexwidth = CLI_LAST_TABSTOP - indent - 2;
+ flexwidth = CLI_LAST_TABSTOP - indent - 2 - strlen(contact->aor) + 1;
- ast_str_append(&context->output_buffer, 0, "%*s: %-*.*s %-12.12s %11.3f\n",
+ ast_str_append(&context->output_buffer, 0, "%*s: %s/%-*.*s %-12.12s %11.3f\n",
indent,
"Contact",
+ contact->aor,
flexwidth, flexwidth,
- wrapper->contact_id,
+ contact->uri,
ast_sip_get_contact_short_status_label(status ? status->status : UNKNOWN),
(status && (status->status != UNKNOWN) ? ((long long) status->rtt) / 1000.0 : NAN));