summaryrefslogtreecommitdiff
path: root/res/res_pjsip_pubsub.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2015-01-09 17:54:49 +0000
committerRichard Mudgett <rmudgett@digium.com>2015-01-09 17:54:49 +0000
commit4b363688d4fb16f2f5cfdcffb43df28a84f1d99b (patch)
treec70c4a0ac2eded6ae2371fed848a97ea680248c7 /res/res_pjsip_pubsub.c
parenteb9ce791d8e59d2aa63fe13518436f46b61b4a44 (diff)
AMI: Make AMI actions that generate event lists consistent.
* Made the following AMI actions use list API calls for consistency: Agents BridgeInfo BridgeList BridgeTechnologyList ConfbridgeLIst ConfbridgeLIstRooms CoreShowChannels DAHDIShowChannels DBGet DeviceStateList ExtensionStateList FAXSessions Hangup IAXpeerlist IAXpeers IAXregistry MeetmeList MeetmeListRooms MWIGet ParkedCalls Parkinglots PJSIPShowEndpoint PJSIPShowEndpoints PJSIPShowRegistrationsInbound PJSIPShowRegistrationsOutbound PJSIPShowResourceLists PJSIPShowSubscriptionsInbound PJSIPShowSubscriptionsOutbound PresenceStateList PRIShowSpans QueueStatus QueueSummary ShowDialPlan SIPpeers SIPpeerstatus SIPshowregistry SKINNYdevices SKINNYlines Status VoicemailUsersList * Incremented the AMI version to 2.7.0. * Changed astman_send_listack() to not use the listflag parameter and always set the value to "Start" so the start capitalization is consistent. i.e., The FAXSessions used "Start" while the rest of the system used "start". The corresponding complete event always used "Complete". * Fixed ami_show_resource_lists() "PJSIPShowResourceLists" to output the AMI ActionID for all of its list events. * Fixed off-nominal AMI protocol error in manager_bridge_info(), manager_parking_status_single_lot(), and manager_parking_status_all_lots(). Use of astman_send_error() after responding to the original AMI action request violates the action response pattern by sending two responses. * Fixed minor protocol error in action_getconfig() when no requested categories are found. Each line needs to be formatted as "Header: text". * Fixed off-nominal memory leak in manager_build_parked_call_string(). * Eliminated unnecessary use of RAII_VAR() in ami_subscription_detail(). ASTERISK-24049 #close Reported by: Jonathan Rose Review: https://reviewboard.asterisk.org/r/4315/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@430434 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_pjsip_pubsub.c')
-rw-r--r--res/res_pjsip_pubsub.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c
index 23f04bb04..f143fa015 100644
--- a/res/res_pjsip_pubsub.c
+++ b/res/res_pjsip_pubsub.c
@@ -3232,15 +3232,16 @@ static int ami_subscription_detail(struct sip_subscription_tree *sub_tree,
struct ast_sip_ami *ami,
const char *event)
{
- RAII_VAR(struct ast_str *, buf,
- ast_sip_create_ami_event(event, ami), ast_free);
+ struct ast_str *buf;
+ buf = ast_sip_create_ami_event(event, ami);
if (!buf) {
return -1;
}
sip_subscription_to_ami(sub_tree, &buf);
astman_append(ami->s, "%s\r\n", ast_str_buffer(buf));
+ ast_free(buf);
return 0;
}
@@ -3266,12 +3267,8 @@ static int ami_show_subscriptions_inbound(struct mansession *s, const struct mes
num = for_each_subscription(ami_subscription_detail_inbound, &ami);
- astman_append(s, "Event: InboundSubscriptionDetailComplete\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);
+ astman_send_list_complete_start(s, m, "InboundSubscriptionDetailComplete", num);
+ astman_send_list_complete_end(s);
return 0;
}
@@ -3285,12 +3282,8 @@ static int ami_show_subscriptions_outbound(struct mansession *s, const struct me
num = for_each_subscription(ami_subscription_detail_outbound, &ami);
- astman_append(s, "Event: OutboundSubscriptionDetailComplete\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);
+ astman_send_list_complete_start(s, m, "OutboundSubscriptionDetailComplete", num);
+ astman_send_list_complete_end(s);
return 0;
}
@@ -3317,7 +3310,7 @@ static int format_ami_resource_lists(void *obj, void *arg, int flags)
static int ami_show_resource_lists(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"), };
int num;
struct ao2_container *lists;
@@ -3334,10 +3327,8 @@ static int ami_show_resource_lists(struct mansession *s, const struct message *m
ao2_callback(lists, OBJ_NODATA, format_ami_resource_lists, &ami);
- astman_append(s,
- "Event: ResourceListDetailComplete\r\n"
- "EventList: Complete\r\n"
- "ListItems: %d\r\n\r\n", num);
+ astman_send_list_complete_start(s, m, "ResourceListDetailComplete", num);
+ astman_send_list_complete_end(s);
return 0;
}