diff --git a/res/res_pjsip/pjsip_resolver.c b/res/res_pjsip/pjsip_resolver.c
index acf903c5583df6c5fe10e02fd8e4465c61bad31d..491b457a95116b3300e3cf52f447acb5fc88151b 100644
--- a/res/res_pjsip/pjsip_resolver.c
+++ b/res/res_pjsip/pjsip_resolver.c
@@ -1507,7 +1507,9 @@ static char *cli_show_tasks(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
 {
 	char addr[PJ_INET6_ADDRSTRLEN + 10];
 	struct host_cache_entry *host = NULL;
-	int idx;
+	struct dns_cache_record *current;
+	struct dns_cache_record *next;
+	int idx, cnt;
 	char tbuf[64];
 
 	switch (cmd) {
@@ -1525,11 +1527,13 @@ static char *cli_show_tasks(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
 
 	ast_cli(a->fd,
 		"<Host name.............................> "
+		"<Target name......................................> "
 		"<IP address.............> <Port> <Transport.....> "
 		"<Priority> <Weight> <Expired at>\n"
 		"============================================================="
 		"============================================================="
-		"======\n");
+		"============================================================="
+		"=====\n");
 
 	AST_LIST_LOCK(&dns_host_cache);
 	AST_LIST_TRAVERSE_SAFE_BEGIN(&dns_host_cache, host, list) {
@@ -1537,15 +1541,17 @@ static char *cli_show_tasks(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
 			ast_cli(a->fd, "%-40.40s   Resolving...\n", host->target.addr.host.ptr);
 			continue;
 		}
-		for (idx = 0; idx < host->addresses.count; ++idx) {
-			ast_cli(a->fd, "%-40.40s %-25.25s %-6d %-15.15s %10d %8d %-24s\n",
+		for (cnt = 0, current = host->a_records.first, next = current ? current->list.next : NULL; current;
+			cnt++, current = next, next = current ? current->list.next : NULL) {
+			ast_cli(a->fd, "%-40.40s %-40.40s %-25.25s %-6d %-15.15s %10d %8d %-24s\n",
 				host->target.addr.host.ptr,
-				pj_sockaddr_print(&host->addresses.entry[idx].addr, addr, sizeof(addr), 2),
-				pj_sockaddr_get_port(&host->addresses.entry[idx].addr),
+				current->name,
+				pj_sockaddr_print(&host->addresses.entry[cnt].addr, addr, sizeof(addr), 2),
+				pj_sockaddr_get_port(&host->addresses.entry[cnt].addr),
 				pjsip_transport_get_type_desc(host->target.type),
-				host->addresses.entry[idx].priority,
-				host->addresses.entry[idx].weight,
-				get_host_cache_addr_expiry(tbuf, sizeof(tbuf), host, &host->addresses.entry[idx].addr));
+				host->addresses.entry[cnt].priority,
+				host->addresses.entry[cnt].weight,
+				get_host_cache_addr_expiry(tbuf, sizeof(tbuf), host, &host->addresses.entry[cnt].addr));
 		}
 	}
 	AST_LIST_TRAVERSE_SAFE_END;