Index: manager.c
===================================================================
--- manager.c (revision 399458)
+++ manager.c (working copy)
@@ -597,17 +597,30 @@
- Extension to check state on.
+ Extension 1, ,..., Extension list to check state on.
Context for extension.
- Report the extension state for given extension. If the extension has a hint,
+ Report the extension state for given list of extensions. If the extension has a hint,
will use devicestate to check the status of the device connected to the extension.
Will return an Extension Status message. The response will include
the hint for the extension and the status.
+ Message: Extension Status
+ Exten: extension 1
+ Context: context
+ Hint: hint
+ Status: status
+ Exten: extension 2
+ Context: context
+ Hint: hint
+ Status: status
+ Exten: extension n
+ Context: context
+ Hint: hint
+ Status: status
@@ -670,17 +683,25 @@
- Full mailbox ID mailbox@vm-context.
+ Full mailbox ID 1mailbox@vm-context, ,,..., separated list of mailbox id's.
- Checks a voicemail account for new messages.
- Returns number of urgent, new and old messages.
+ Checks a list of voicemail accounts for new messages.
+ Returns number of urgent, new and old messages for each voicemail account.
Message: Mailbox Message Count
- Mailbox: mailboxid
+ Mailbox: mailboxid 1
UrgentMessages: count
NewMessages: count
OldMessages: count
+ Mailbox: mailboxid 2
+ UrgentMessages: count
+ NewMessages: count
+ OldMessages: count
+ Mailbox: mailboxid n
+ UrgentMessages: count
+ NewMessages: count
+ OldMessages: count
@@ -4874,20 +4895,41 @@
{
const char *mailbox = astman_get_header(m, "Mailbox");
int newmsgs = 0, oldmsgs = 0, urgentmsgs = 0;;
+ char *box;
if (ast_strlen_zero(mailbox)) {
astman_send_error(s, m, "Mailbox not specified");
return 0;
}
- ast_app_inboxcount2(mailbox, &urgentmsgs, &newmsgs, &oldmsgs);
- astman_start_ack(s, m);
- astman_append(s, "Message: Mailbox Message Count\r\n"
+ ast_log(LOG_NOTICE, "HTTP Mailbox Count '%s'\n", mailbox);
+ if (strchr(mailbox, ',') != NULL) { /* multiple mailboxes requested */
+ astman_start_ack(s, m);
+ astman_append(s, "Message: Mailbox Message Count\r\n" );
+ box = strtok((char*)mailbox, ",");
+ while (box != NULL) {
+ ast_app_inboxcount2(box, &urgentmsgs, &newmsgs, &oldmsgs);
+ astman_append(s,
+ "Mailbox: %s\r\n"
+ "UrgMessages: %d\r\n"
+ "NewMessages: %d\r\n"
+ "OldMessages: %d\r\n",
+ box, urgentmsgs, newmsgs, oldmsgs);
+ box = strtok(NULL, ",");
+
+ }
+ astman_append(s, "\r\n");
+ } else { /* single mailbox request */
+
+ ast_app_inboxcount2(mailbox, &urgentmsgs, &newmsgs, &oldmsgs);
+ astman_start_ack(s, m);
+ astman_append(s, "Message: Mailbox Message Count\r\n"
"Mailbox: %s\r\n"
"UrgMessages: %d\r\n"
"NewMessages: %d\r\n"
"OldMessages: %d\r\n"
"\r\n",
mailbox, urgentmsgs, newmsgs, oldmsgs);
+ }
return 0;
}
@@ -4897,6 +4939,8 @@
const char *context = astman_get_header(m, "Context");
char hint[256] = "";
int status;
+ char *box;
+
if (ast_strlen_zero(exten)) {
astman_send_error(s, m, "Extension not specified");
return 0;
@@ -4904,15 +4948,33 @@
if (ast_strlen_zero(context)) {
context = "default";
}
- status = ast_extension_state(NULL, context, exten);
- ast_get_hint(hint, sizeof(hint) - 1, NULL, 0, NULL, context, exten);
- astman_start_ack(s, m);
- astman_append(s, "Message: Extension Status\r\n"
+ ast_log(LOG_NOTICE, "HTTP Extension Status '%s'\n", exten);
+ if (strchr(exten, ',') != NULL) { /* multiple extensions requested */
+ astman_start_ack(s, m);
+ astman_append(s, "Message: Extension Status\r\n");
+ box = strtok((char*)exten, ",");
+ while (box != NULL) {
+ status = ast_extension_state(NULL, context, box);
+ ast_get_hint(hint, sizeof(hint) - 1, NULL, 0, NULL, context, box);
+ astman_append(s,
+ "Exten: %s\r\n"
+ "Context: %s\r\n"
+ "Hint: %s\r\n"
+ "Status: %d\r\n\r\n",
+ box, context, hint, status);
+ box = strtok(NULL, ",");
+ }
+ } else { /* single extension requested */
+ status = ast_extension_state(NULL, context, exten);
+ ast_get_hint(hint, sizeof(hint) - 1, NULL, 0, NULL, context, exten);
+ astman_start_ack(s, m);
+ astman_append(s, "Message: Extension Status\r\n"
"Exten: %s\r\n"
"Context: %s\r\n"
"Hint: %s\r\n"
"Status: %d\r\n\r\n",
exten, context, hint, status);
+ }
return 0;
}