From a3fc10473cb9e3f63ee4b34acef46288eb8eb79c Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@f38db490-d61c-443f-a65b-d21fe96a405b> Date: Mon, 28 Feb 2005 00:30:35 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'v1-0-6'. git-svn-id: http://svn.digium.com/svn/asterisk/tags/v1-0-6@5102 f38db490-d61c-443f-a65b-d21fe96a405b --- manager.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 70 insertions(+), 7 deletions(-) (limited to 'manager.c') diff --git a/manager.c b/manager.c index 4f5e568ad..39cef1683 100755 --- a/manager.c +++ b/manager.c @@ -1,6 +1,8 @@ /* * Asterisk -- A telephony toolkit for Linux. * + * The Asterisk Management Interface - AMI + * * Channel Management and more * * Copyright (C) 1999-2004, Digium, Inc. @@ -118,6 +120,9 @@ static char *authority_to_str(int authority, char *res, int reslen) running_total += strlen(perms[i].label); } } + if (ast_strlen_zero(res)) { + strncpy(res, "", reslen); + } return res; } @@ -570,6 +575,13 @@ static int action_hangup(struct mansession *s, struct message *m) return 0; } +static char mandescr_setvar[] = +"Description: Set a local channel variable.\n" +"Variables: (Names marked with * are required)\n" +" *Channel: Channel to set variable for\n" +" *Variable: Variable name\n" +" *Value: Value\n"; + static int action_setvar(struct mansession *s, struct message *m) { struct ast_channel *c = NULL; @@ -606,6 +618,13 @@ static int action_setvar(struct mansession *s, struct message *m) return 0; } +static char mandescr_getvar[] = +"Description: Get the value of a local channel variable.\n" +"Variables: (Names marked with * are required)\n" +" *Channel: Channel to read variable from\n" +" *Variable: Variable name\n" +" ActionID: Optional Action id for message matching.\n"; + static int action_getvar(struct mansession *s, struct message *m) { struct ast_channel *c = NULL; @@ -785,6 +804,11 @@ static int action_redirect(struct mansession *s, struct message *m) return 0; } +static char mandescr_command[] = +"Description: Run a CLI command.\n" +"Variables: (Names marked with * are required)\n" +" *Command: Asterisk CLI command to run\n" +" ActionID: Optional Action id for message matching.\n"; static int action_command(struct mansession *s, struct message *m) { char *cmd = astman_get_header(m, "Command"); @@ -938,6 +962,16 @@ static int action_originate(struct mansession *s, struct message *m) return 0; } +static char mandescr_mailboxstatus[] = +"Description: Checks a voicemail account for status.\n" +"Variables: (Names marked with * are required)\n" +" *Mailbox: Full mailbox ID @\n" +" ActionID: Optional ActionID for message matching.\n" +"Returns number of messages.\n" +" Message: Mailbox Status\n" +" Mailbox: \n" +" Waiting: \n" +"\n"; static int action_mailboxstatus(struct mansession *s, struct message *m) { char *mailbox = astman_get_header(m, "Mailbox"); @@ -961,6 +995,17 @@ static int action_mailboxstatus(struct mansession *s, struct message *m) return 0; } +static char mandescr_mailboxcount[] = +"Description: Checks a voicemail account for new messages.\n" +"Variables: (Names marked with * are required)\n" +" *Mailbox: Full mailbox ID @\n" +" ActionID: Optional ActionID for message matching.\n" +"Returns number of new and old messages.\n" +" Message: Mailbox Message Count\n" +" Mailbox: \n" +" NewMessages: \n" +" OldMessages: \n" +"\n"; static int action_mailboxcount(struct mansession *s, struct message *m) { char *mailbox = astman_get_header(m, "Mailbox"); @@ -988,6 +1033,17 @@ static int action_mailboxcount(struct mansession *s, struct message *m) return 0; } +static char mandescr_extensionstate[] = +"Description: Report the extension state for given extension.\n" +" If the extension has a hint, will use devicestate to check\n" +" the status of the device connected to the extension.\n" +"Variables: (Names marked with * are required)\n" +" *Exten: Extension to check state on\n" +" *Context: Context for extension\n" +" ActionId: Optional ID for this transaction\n" +"Will return an \"Extension Status\" message.\n" +"The response will include the hint for the extension and the status.\n"; + static int action_extensionstate(struct mansession *s, struct message *m) { char *exten = astman_get_header(m, "Exten"); @@ -1020,6 +1076,13 @@ static int action_extensionstate(struct mansession *s, struct message *m) return 0; } +static char mandescr_timeout[] = +"Description: Hangup a channel after a certain time.\n" +"Variables: (Names marked with * are required)\n" +" *Channel: Channel name to hangup\n" +" *Timeout: Maximum duration of the call (sec)\n" +"Acknowledges set time with 'Timeout Set' message\n"; + static int action_timeout(struct mansession *s, struct message *m) { struct ast_channel *c = NULL; @@ -1392,15 +1455,15 @@ int init_manager(void) ast_manager_register2("Logoff", 0, action_logoff, "Logoff Manager", mandescr_logoff); ast_manager_register2("Hangup", EVENT_FLAG_CALL, action_hangup, "Hangup Channel", mandescr_hangup); ast_manager_register( "Status", EVENT_FLAG_CALL, action_status, "Status" ); - ast_manager_register( "Setvar", EVENT_FLAG_CALL, action_setvar, "Set Channel Variable" ); - ast_manager_register( "Getvar", EVENT_FLAG_CALL, action_getvar, "Gets a Channel Variable" ); + ast_manager_register2( "Setvar", EVENT_FLAG_CALL, action_setvar, "Set Channel Variable", mandescr_setvar ); + ast_manager_register2( "Getvar", EVENT_FLAG_CALL, action_getvar, "Gets a Channel Variable", mandescr_getvar ); ast_manager_register( "Redirect", EVENT_FLAG_CALL, action_redirect, "Redirect" ); ast_manager_register2("Originate", EVENT_FLAG_CALL, action_originate, "Originate Call", mandescr_originate); - 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_manager_register( "MailboxCount", EVENT_FLAG_CALL, action_mailboxcount, "Check Mailbox Message Count" ); + ast_manager_register2( "Command", EVENT_FLAG_COMMAND, action_command, "Execute Command", mandescr_command ); + ast_manager_register2( "ExtensionState", EVENT_FLAG_CALL, action_extensionstate, "Check Extension Status", mandescr_extensionstate ); + ast_manager_register2( "AbsoluteTimeout", EVENT_FLAG_CALL, action_timeout, "Set Absolute Timeout", mandescr_timeout ); + ast_manager_register2( "MailboxStatus", EVENT_FLAG_CALL, action_mailboxstatus, "Check Mailbox", mandescr_mailboxstatus ); + ast_manager_register2( "MailboxCount", EVENT_FLAG_CALL, action_mailboxcount, "Check Mailbox Message Count", mandescr_mailboxcount ); ast_manager_register2("ListCommands", 0, action_listcommands, "List available manager commands", mandescr_listcommands); ast_cli_register(&show_mancmd_cli); -- cgit v1.2.3