aboutsummaryrefslogtreecommitdiffstats
path: root/manager.c
diff options
context:
space:
mode:
authorjeremy <jeremy@f38db490-d61c-443f-a65b-d21fe96a405b>2003-06-09 21:40:20 +0000
committerjeremy <jeremy@f38db490-d61c-443f-a65b-d21fe96a405b>2003-06-09 21:40:20 +0000
commit3e768fd8a29d516dc9419eefd6a69020ce093f6b (patch)
tree5a10aebd2be7926d9f12730156be7ea00f72861d /manager.c
parent2c1a803388eca961d68eb51eb44d569533bc6ba5 (diff)
implement action: AbsoluteTimeout
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1080 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'manager.c')
-rwxr-xr-xmanager.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/manager.c b/manager.c
index 15b51681d..11293df8d 100755
--- a/manager.c
+++ b/manager.c
@@ -475,6 +475,35 @@ static int action_extensionstate(struct mansession *s, struct message *m)
return 0;
}
+static int action_timeout(struct mansession *s, struct message *m)
+{
+ struct ast_channel *c = NULL;
+ char *name = astman_get_header(m, "Channel");
+ int timeout = atoi(astman_get_header(m, "Timeout"));
+ if (!strlen(name)) {
+ astman_send_error(s, "No channel specified");
+ return 0;
+ }
+ if (!timeout) {
+ astman_send_error(s, "No timeout specified");
+ return 0;
+ }
+ c = ast_channel_walk(NULL);
+ while(c) {
+ if (!strcasecmp(c->name, name)) {
+ break;
+ }
+ c = ast_channel_walk(c);
+ }
+ if (!c) {
+ astman_send_error(s, "No such channel");
+ return 0;
+ }
+ ast_channel_setwhentohangup(c, timeout);
+ astman_send_ack(s, "Timeout Set");
+ return 0;
+}
+
static int process_message(struct mansession *s, struct message *m)
{
char action[80];
@@ -764,6 +793,7 @@ int init_manager(void)
ast_manager_register( "MailboxStatus", EVENT_FLAG_CALL, action_mailboxstatus, "Check Mailbox" );
ast_manager_register( "Command", EVENT_FLAG_COMMAND, action_command, "Execute Command" );
ast_manager_register( "ExtensionState", EVENT_FLAG_CALL, action_extensionstate, "Check Extension Status" );
+ ast_manager_register( "AbsoluteTimeout", EVENT_FLAG_CALL, action_timeout, "Set Absolute Timeout" );
ast_cli_register(&show_mancmds_cli);
ast_cli_register(&show_manconn_cli);