diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_agent_pool.c | 9 | ||||
-rw-r--r-- | apps/app_confbridge.c | 16 | ||||
-rw-r--r-- | apps/app_meetme.c | 17 | ||||
-rw-r--r-- | apps/app_queue.c | 33 | ||||
-rw-r--r-- | apps/app_voicemail.c | 18 |
5 files changed, 46 insertions, 47 deletions
diff --git a/apps/app_agent_pool.c b/apps/app_agent_pool.c index ad1745d8d..a36c77143 100644 --- a/apps/app_agent_pool.c +++ b/apps/app_agent_pool.c @@ -2525,13 +2525,14 @@ static int action_agents(struct mansession *s, const struct message *m) struct ao2_iterator iter; struct agent_pvt *agent; struct ast_str *out = ast_str_alloca(4096); + int num_agents = 0; if (!ast_strlen_zero(id)) { snprintf(id_text, sizeof(id_text), "ActionID: %s\r\n", id); } else { id_text[0] = '\0'; } - astman_send_ack(s, m, "Agents will follow"); + astman_send_listack(s, m, "Agents will follow", "start"); iter = ao2_iterator_init(agents, 0); for (; (agent = ao2_iterator_next(&iter)); ao2_ref(agent, -1)) { @@ -2586,12 +2587,12 @@ static int action_agents(struct mansession *s, const struct message *m) astman_append(s, "Event: Agents\r\n" "%s%s\r\n", ast_str_buffer(out), id_text); + ++num_agents; } ao2_iterator_destroy(&iter); - astman_append(s, "Event: AgentsComplete\r\n" - "%s" - "\r\n", id_text); + astman_send_list_complete_start(s, m, "AgentsComplete", num_agents); + astman_send_list_complete_end(s); return 0; } diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c index 3f982a515..7c9f0c5a1 100644 --- a/apps/app_confbridge.c +++ b/apps/app_confbridge.c @@ -2894,12 +2894,8 @@ static int action_confbridgelist(struct mansession *s, const struct message *m) ao2_unlock(conference); ao2_ref(conference, -1); - astman_append(s, - "Event: ConfbridgeListComplete\r\n" - "EventList: Complete\r\n" - "ListItems: %d\r\n" - "%s" - "\r\n", total, id_text); + astman_send_list_complete_start(s, m, "ConfbridgeListComplete", total); + astman_send_list_complete_end(s); return 0; } @@ -2949,12 +2945,8 @@ static int action_confbridgelistrooms(struct mansession *s, const struct message ao2_iterator_destroy(&iter); /* Send final confirmation */ - astman_append(s, - "Event: ConfbridgeListRoomsComplete\r\n" - "EventList: Complete\r\n" - "ListItems: %d\r\n" - "%s" - "\r\n", totalitems, id_text); + astman_send_list_complete_start(s, m, "ConfbridgeListRoomsComplete", totalitems); + astman_send_list_complete_end(s); return 0; } diff --git a/apps/app_meetme.c b/apps/app_meetme.c index bc30f29be..907770e22 100644 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -5577,13 +5577,10 @@ static int action_meetmelist(struct mansession *s, const struct message *m) ao2_iterator_destroy(&user_iter); } AST_LIST_UNLOCK(&confs); + /* Send final confirmation */ - astman_append(s, - "Event: MeetmeListComplete\r\n" - "EventList: Complete\r\n" - "ListItems: %d\r\n" - "%s" - "\r\n", total, idText); + astman_send_list_complete_start(s, m, "MeetmeListComplete", total); + astman_send_list_complete_end(s); return 0; } @@ -5645,12 +5642,8 @@ static int action_meetmelistrooms(struct mansession *s, const struct message *m) AST_LIST_UNLOCK(&confs); /* Send final confirmation */ - astman_append(s, - "Event: MeetmeListRoomsComplete\r\n" - "EventList: Complete\r\n" - "ListItems: %d\r\n" - "%s" - "\r\n", totalitems, idText); + astman_send_list_complete_start(s, m, "MeetmeListRoomsComplete", totalitems); + astman_send_list_complete_end(s); return 0; } diff --git a/apps/app_queue.c b/apps/app_queue.c index 185b2d43a..081a98330 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -9337,19 +9337,21 @@ static int manager_queues_summary(struct mansession *s, const struct message *m) int qmemavail = 0; int qchancount = 0; int qlongestholdtime = 0; + int qsummaries = 0; const char *id = astman_get_header(m, "ActionID"); const char *queuefilter = astman_get_header(m, "Queue"); - char idText[256] = ""; + char idText[256]; struct call_queue *q; struct queue_ent *qe; struct member *mem; struct ao2_iterator queue_iter; struct ao2_iterator mem_iter; - astman_send_ack(s, m, "Queue summary will follow"); + astman_send_listack(s, m, "Queue summary will follow", "start"); time(&now); + idText[0] = '\0'; if (!ast_strlen_zero(id)) { - snprintf(idText, 256, "ActionID: %s\r\n", id); + snprintf(idText, sizeof(idText), "ActionID: %s\r\n", id); } queue_iter = ao2_iterator_init(queues, 0); while ((q = ao2_t_iterator_next(&queue_iter, "Iterate through queues"))) { @@ -9392,15 +9394,15 @@ static int manager_queues_summary(struct mansession *s, const struct message *m) "%s" "\r\n", q->name, qmemcount, qmemavail, qchancount, q->holdtime, q->talktime, qlongestholdtime, idText); + ++qsummaries; } ao2_unlock(q); queue_t_unref(q, "Done with iterator"); } ao2_iterator_destroy(&queue_iter); - astman_append(s, - "Event: QueueSummaryComplete\r\n" - "%s" - "\r\n", idText); + + astman_send_list_complete_start(s, m, "QueueSummaryComplete", qsummaries); + astman_send_list_complete_end(s); return RESULT_SUCCESS; } @@ -9410,10 +9412,11 @@ static int manager_queues_status(struct mansession *s, const struct message *m) { time_t now; int pos; + int q_items = 0; const char *id = astman_get_header(m,"ActionID"); const char *queuefilter = astman_get_header(m,"Queue"); const char *memberfilter = astman_get_header(m,"Member"); - char idText[256] = ""; + char idText[256]; struct call_queue *q; struct queue_ent *qe; float sl = 0; @@ -9421,8 +9424,9 @@ static int manager_queues_status(struct mansession *s, const struct message *m) struct ao2_iterator queue_iter; struct ao2_iterator mem_iter; - astman_send_ack(s, m, "Queue status will follow"); + astman_send_listack(s, m, "Queue status will follow", "start"); time(&now); + idText[0] = '\0'; if (!ast_strlen_zero(id)) { snprintf(idText, sizeof(idText), "ActionID: %s\r\n", id); } @@ -9450,6 +9454,8 @@ static int manager_queues_status(struct mansession *s, const struct message *m) "\r\n", q->name, q->maxlen, int2strat(q->strategy), q->count, q->holdtime, q->talktime, q->callscompleted, q->callsabandoned, q->servicelevel, sl, q->weight, idText); + ++q_items; + /* List Queue Members */ mem_iter = ao2_iterator_init(q->members, 0); while ((mem = ao2_iterator_next(&mem_iter))) { @@ -9469,10 +9475,12 @@ static int manager_queues_status(struct mansession *s, const struct message *m) "\r\n", q->name, mem->membername, mem->interface, mem->state_interface, mem->dynamic ? "dynamic" : "static", mem->penalty, mem->calls, (int)mem->lastcall, mem->status, mem->paused, idText); + ++q_items; } ao2_ref(mem, -1); } ao2_iterator_destroy(&mem_iter); + /* List Queue Entries */ pos = 1; for (qe = q->head; qe; qe = qe->next) { @@ -9494,6 +9502,7 @@ static int manager_queues_status(struct mansession *s, const struct message *m) S_COR(ast_channel_connected(qe->chan)->id.number.valid, ast_channel_connected(qe->chan)->id.number.str, "unknown"), S_COR(ast_channel_connected(qe->chan)->id.name.valid, ast_channel_connected(qe->chan)->id.name.str, "unknown"), (long) (now - qe->start), idText); + ++q_items; } } ao2_unlock(q); @@ -9501,10 +9510,8 @@ static int manager_queues_status(struct mansession *s, const struct message *m) } ao2_iterator_destroy(&queue_iter); - astman_append(s, - "Event: QueueStatusComplete\r\n" - "%s" - "\r\n",idText); + astman_send_list_complete_start(s, m, "QueueStatusComplete", q_items); + astman_send_list_complete_end(s); return RESULT_SUCCESS; } diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 8cc7b60d4..6311263a4 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -13049,10 +13049,13 @@ static int manager_list_voicemail_users(struct mansession *s, const struct messa { struct ast_vm_user *vmu = NULL; const char *id = astman_get_header(m, "ActionID"); - char actionid[128] = ""; + char actionid[128]; + int num_users = 0; - if (!ast_strlen_zero(id)) + actionid[0] = '\0'; + if (!ast_strlen_zero(id)) { snprintf(actionid, sizeof(actionid), "ActionID: %s\r\n", id); + } AST_LIST_LOCK(&users); @@ -13062,20 +13065,20 @@ static int manager_list_voicemail_users(struct mansession *s, const struct messa return RESULT_SUCCESS; } - astman_send_ack(s, m, "Voicemail user list will follow"); + astman_send_listack(s, m, "Voicemail user list will follow", "start"); AST_LIST_TRAVERSE(&users, vmu, list) { char dirname[256]; - #ifdef IMAP_STORAGE int new, old; + inboxcount(vmu->mailbox, &new, &old); #endif make_dir(dirname, sizeof(dirname), vmu->context, vmu->mailbox, "INBOX"); astman_append(s, - "%s" "Event: VoicemailUserEntry\r\n" + "%s" "VMContext: %s\r\n" "VoiceMailbox: %s\r\n" "Fullname: %s\r\n" @@ -13144,8 +13147,11 @@ static int manager_list_voicemail_users(struct mansession *s, const struct messa count_messages(vmu, dirname) #endif ); + ++num_users; } - astman_append(s, "Event: VoicemailUserEntryComplete\r\n%s\r\n", actionid); + + astman_send_list_complete_start(s, m, "VoicemailUserEntryComplete", num_users); + astman_send_list_complete_end(s); AST_LIST_UNLOCK(&users); |