summaryrefslogtreecommitdiff
path: root/res/res_pjsip/location.c
diff options
context:
space:
mode:
Diffstat (limited to 'res/res_pjsip/location.c')
-rw-r--r--res/res_pjsip/location.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c
index 2e0d84b84..16913c2c8 100644
--- a/res/res_pjsip/location.c
+++ b/res/res_pjsip/location.c
@@ -92,6 +92,7 @@ static void contact_destroy(void *obj)
struct ast_sip_contact *contact = obj;
ast_string_field_free_memory(contact);
+ ast_free(contact->aor);
ao2_cleanup(contact->endpoint);
}
@@ -99,6 +100,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 +113,18 @@ 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);
+
+ contact->aor = ast_strdup(aor);
+ if (!contact->aor) {
+ ao2_cleanup(contact);
+ return NULL;
+ }
+
return contact;
}
@@ -790,13 +806,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));