44#define CATEGORY "/main/amihooks/"
53 struct timespec timeout = {
54 .tv_sec = start.tv_sec + 2,
55 .tv_nsec = start.tv_usec * 1000
76 info->name = __func__;
78 info->summary =
"Execute an action using an AMI hook";
143 "Usage: amihook send"
160 e->
command =
"amihook register";
162 "Usage: amihook register"
179 e->
command =
"amihook unregister";
181 "Usage: amihook unregister"
Asterisk main include file. File version handling, generic pbx functions.
Standard Command Line Interface.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define AST_CLI_DEFINE(fn, txt,...)
ast_cli_command
calling arguments for new-style handlers.
#define ast_cli_register_multiple(e, len)
Register multiple commands.
void ast_manager_unregister_hook(struct manager_custom_hook *hook)
Delete a custom hook to be called when an event is fired.
void ast_manager_register_hook(struct manager_custom_hook *hook)
Add a custom hook to be called when an event is fired.
int ast_hook_send_action(struct manager_custom_hook *hook, const char *msg)
Registered hooks can call this function to invoke actions and they will receive responses through reg...
#define ast_cond_timedwait(cond, mutex, time)
#define ast_mutex_unlock(a)
pthread_cond_t ast_cond_t
#define ast_mutex_lock(a)
#define AST_MUTEX_DEFINE_STATIC(mutex)
#define ast_cond_signal(cond)
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
Asterisk module definitions.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
descriptor for a cli entry.
#define AST_TEST_REGISTER(cb)
#define ast_test_status_update(a, b, c...)
#define AST_TEST_UNREGISTER(cb)
static int amihook_helper(int category, const char *event, char *content)
static int wait_for_hook(struct ast_test *test)
static void register_hook(void)
static char * handle_cli_amihook_register_hook(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
AST_TEST_DEFINE(amihook_cli_send)
static char * handle_cli_amihook_send(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int hook_send(void)
static char * handle_cli_amihook_unregister_hook(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static ast_mutex_t hook_lock
static int load_module(void)
static void unregister_hook(void)
static struct manager_custom_hook test_hook
static int unload_module(void)
static struct ast_cli_entry cli_amihook_evt[]
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().