res_pjsip: ami: Fix error in AMI output when an endpoint has no transport

When no transport is associated to an endpoint, the AMI output for
PJSIPShowEndpoint indicates an error instead of silently ignoring the
missing transport.

This patch causes the error to appear only if a transport was specified
on the endpoint and the transport doesn't exist.  It also fixes an issue
with counting the objects that were actually found.

ASTERISK-24161 #close
ASTERISK-24331 #close
Tested by: George Joseph
Review: https://reviewboard.asterisk.org/r/3998/
........

Merged revisions 423282 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@423284 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
George Joseph
2014-09-18 15:13:29 +00:00
parent 27df9b73e2
commit a2482acdce
7 changed files with 26 additions and 9 deletions

View File

@@ -1107,7 +1107,8 @@ static int format_ami_endpoint(const struct ast_sip_endpoint *endpoint,
static int ami_show_endpoint(struct mansession *s, const struct message *m)
{
struct ast_sip_ami ami = { .s = s, .m = m, .action_id = astman_get_header(m, "ActionID"), };
struct ast_sip_ami ami = { .s = s, .m = m, .action_id = astman_get_header(m, "ActionID"),
.count = 0, };
RAII_VAR(struct ast_sip_endpoint *, endpoint, NULL, ao2_cleanup);
const char *endpoint_name = astman_get_header(m, "Endpoint");
int count = 0;
@@ -1144,7 +1145,8 @@ static int ami_show_endpoint(struct mansession *s, const struct message *m)
astman_append(s, "ActionID: %s\r\n", ami.action_id);
}
astman_append(s, "EventList: Complete\r\n"
"ListItems: %d\r\n\r\n", count + 1);
"ListItems: %d\r\n\r\n", ami.count + 1);
return 0;
}