- Now use Response: success
- New header "Ping: pong" :-)
- The Events action
- Now use Response: Success
- The new status is reported as "Events: On" or "Events: Off"
- Report if manager is enabled in the reload event
Small cleanups...
From moremanager
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@91420
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
#include "asterisk/version.h"
#include "asterisk/threadstorage.h"
#include "asterisk/linkedlists.h"
#include "asterisk/version.h"
#include "asterisk/threadstorage.h"
#include "asterisk/linkedlists.h"
+#include "asterisk/version.h"
#include "asterisk/term.h"
#include "asterisk/astobj2.h"
#include "asterisk/term.h"
#include "asterisk/astobj2.h"
static int action_ping(struct mansession *s, const struct message *m)
{
static int action_ping(struct mansession *s, const struct message *m)
{
- astman_send_response(s, m, "Pong", NULL);
+ astman_send_response(s, m, "Success", "Ping: Pong\r\n");
res = set_eventmask(s, mask);
if (res > 0)
res = set_eventmask(s, mask);
if (res > 0)
- astman_send_response(s, m, "Events On", NULL);
+ astman_send_response(s, m, "Success", "Events: On\r\n");
- astman_send_response(s, m, "Events Off", NULL);
+ astman_send_response(s, m, "Success", "Events: Off\r\n");
char bridge[256];
struct timeval now = ast_tvnow();
long elapsed_seconds = 0;
char bridge[256];
struct timeval now = ast_tvnow();
long elapsed_seconds = 0;
int all = ast_strlen_zero(name); /* set if we want all channels */
const char *id = astman_get_header(m,"ActionID");
char idText[256] = "";
int all = ast_strlen_zero(name); /* set if we want all channels */
const char *id = astman_get_header(m,"ActionID");
char idText[256] = "";
}
}
astman_send_ack(s, m, "Channel status will follow");
}
}
astman_send_ack(s, m, "Channel status will follow");
/* if we look by name, we break after the first iteration */
while (c) {
/* if we look by name, we break after the first iteration */
while (c) {
- snprintf(bridge, sizeof(bridge), "Link: %s\r\n", c->_bridge->name);
+ snprintf(bridge, sizeof(bridge), "BridgedChannel: %s\r\nBridgedUniqueid: %s\r\n", c->_bridge->name, c->_bridge->uniqueid);
else
bridge[0] = '\0';
if (c->pbx) {
else
bridge[0] = '\0';
if (c->pbx) {
"Channel: %s\r\n"
"CallerIDNum: %s\r\n"
"CallerIDName: %s\r\n"
"Channel: %s\r\n"
"CallerIDNum: %s\r\n"
"CallerIDName: %s\r\n"
- "Account: %s\r\n"
- "State: %s\r\n"
+ "Accountcode: %s\r\n"
+ "ChannelState: %d\r\n"
+ "ChannelStateDesc: %s\r\n"
"Context: %s\r\n"
"Extension: %s\r\n"
"Priority: %d\r\n"
"Context: %s\r\n"
"Extension: %s\r\n"
"Priority: %d\r\n"
- S_OR(c->cid.cid_num, "<unknown>"),
- S_OR(c->cid.cid_name, "<unknown>"),
+ S_OR(c->cid.cid_num, ""),
+ S_OR(c->cid.cid_name, ""),
ast_state2str(c->_state), c->context,
c->exten, c->priority, (long)elapsed_seconds, bridge, c->uniqueid, idText);
} else {
ast_state2str(c->_state), c->context,
c->exten, c->priority, (long)elapsed_seconds, bridge, c->uniqueid, idText);
} else {
astman_append(s,
"Event: StatusComplete\r\n"
"%s"
astman_append(s,
"Event: StatusComplete\r\n"
"%s"
+ "Items: %d\r\n"
+ "\r\n",idText, channels);
AST_RWLIST_UNLOCK(&actions);
if (!tmp) {
AST_RWLIST_UNLOCK(&actions);
if (!tmp) {
+ char buf[BUFSIZ];
+ snprintf(buf, sizeof(buf), "Invalid/unknown command: %s. Use Action: ListCommands to show available commands.", action);
ast_mutex_lock(&s->__lock);
ast_mutex_lock(&s->__lock);
- astman_send_error(s, m, "Invalid/unknown command. Use Action: ListCommands to show available commands.");
+ astman_send_error(s, m, buf);
ast_mutex_unlock(&s->__lock);
}
if (ret)
ast_mutex_unlock(&s->__lock);
}
if (ret)
if (newhttptimeout > 0)
httptimeout = newhttptimeout;
if (newhttptimeout > 0)
httptimeout = newhttptimeout;
+ manager_event(EVENT_FLAG_SYSTEM, "Reload", "Module: Manager\r\nStatus: %s\r\nMessage: Manager reload Requested\r\n", manager_enabled ? "Enabled" : "Disabled");
+
server_start(&ami_desc);
if (ssl_setup(amis_desc.tls_cfg))
server_start(&amis_desc);
server_start(&ami_desc);
if (ssl_setup(amis_desc.tls_cfg))
server_start(&amis_desc);
int reload_manager(void)
{
int reload_manager(void)
{
- manager_event(EVENT_FLAG_SYSTEM, "Reload", "Message: Reload Requested\r\n");
return __init_manager(1);
}
return __init_manager(1);
}