diff options
author | Matthew Jordan <mjordan@digium.com> | 2014-06-27 13:50:02 +0000 |
---|---|---|
committer | Matthew Jordan <mjordan@digium.com> | 2014-06-27 13:50:02 +0000 |
commit | 15dcaeef82ce4fc013668392838f8ff9e0ec8075 (patch) | |
tree | fe66165bc3eeb12dbef6a71a86f9fbdd41938780 /res/res_pjsip/pjsip_configuration.c | |
parent | 512e505dc3e7a8f20a5054c5ee364c7c46d8976f (diff) |
res_pjsip: Add ActionID to events created as a result of PJSIP AMI actions
A number of various PJSIP AMI actions were failing to parse out and place the
ActionID into their responses. This patch updates the various PJSIP actions
such that the passed in ActionID is emitted on any event list complete events,
as well as any intermediate events created as a result of the action.
#ASTERISK-23947 #close
Reported by: Mark Michelson
Review: https://reviewboard.asterisk.org/r/3675/
........
Merged revisions 417460 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417461 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_pjsip/pjsip_configuration.c')
-rw-r--r-- | res/res_pjsip/pjsip_configuration.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c index ea3326969..b2ce4fe7e 100644 --- a/res/res_pjsip/pjsip_configuration.c +++ b/res/res_pjsip/pjsip_configuration.c @@ -1024,6 +1024,9 @@ struct ast_str *ast_sip_create_ami_event(const char *event, struct ast_sip_ami * } ast_str_set(&buf, 0, "Event: %s\r\n", event); + if (!ast_strlen_zero(ami->action_id)) { + ast_str_append(&buf, 0, "ActionID: %s\r\n", ami->action_id); + } return buf; } @@ -1104,7 +1107,7 @@ 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 }; + struct ast_sip_ami ami = { .s = s, .m = m, .action_id = astman_get_header(m, "ActionID"), }; RAII_VAR(struct ast_sip_endpoint *, endpoint, NULL, ao2_cleanup); const char *endpoint_name = astman_get_header(m, "Endpoint"); int count = 0; @@ -1136,9 +1139,11 @@ static int ami_show_endpoint(struct mansession *s, const struct message *m) endpoint_name); } - astman_append(s, - "Event: EndpointDetailComplete\r\n" - "EventList: Complete\r\n" + astman_append(s, "Event: EndpointDetailComplete\r\n"); + if (!ast_strlen_zero(ami.action_id)) { + 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); return 0; } @@ -1197,7 +1202,7 @@ static int format_ami_endpoints(void *obj, void *arg, int flags) static int ami_show_endpoints(struct mansession *s, const struct message *m) { - struct ast_sip_ami ami = { .s = s, .m = m }; + struct ast_sip_ami ami = { .s = s, .m = m, .action_id = astman_get_header(m, "ActionID"), }; RAII_VAR(struct ao2_container *, endpoints, NULL, ao2_cleanup); int num; @@ -1216,9 +1221,11 @@ static int ami_show_endpoints(struct mansession *s, const struct message *m) ao2_callback(endpoints, OBJ_NODATA, format_ami_endpoints, &ami); - astman_append(s, - "Event: EndpointListComplete\r\n" - "EventList: Complete\r\n" + astman_append(s, "Event: EndpointListComplete\r\n"); + if (!ast_strlen_zero(ami.action_id)) { + astman_append(s, "ActionID: %s\r\n", ami.action_id); + } + astman_append(s, "EventList: Complete\r\n" "ListItems: %d\r\n\r\n", num); return 0; } |