19 #ifndef _ASTERISK_MANAGER_H
20 #define _ASTERISK_MANAGER_H
57 #define AMI_VERSION "1.1"
58 #define DEFAULT_MANAGER_PORT 5038
59 #define DEFAULT_MANAGER_TLS_PORT 5039
65 #define AMI_SUCCESS (0)
66 #define AMI_DESTROY (-1)
71 #define EVENT_FLAG_SYSTEM (1 << 0)
72 #define EVENT_FLAG_CALL (1 << 1)
73 #define EVENT_FLAG_LOG (1 << 2)
74 #define EVENT_FLAG_VERBOSE (1 << 3)
75 #define EVENT_FLAG_COMMAND (1 << 4)
76 #define EVENT_FLAG_AGENT (1 << 5)
77 #define EVENT_FLAG_USER (1 << 6)
78 #define EVENT_FLAG_CONFIG (1 << 7)
79 #define EVENT_FLAG_DTMF (1 << 8)
80 #define EVENT_FLAG_REPORTING (1 << 9)
81 #define EVENT_FLAG_CDR (1 << 10)
82 #define EVENT_FLAG_DIALPLAN (1 << 11)
83 #define EVENT_FLAG_ORIGINATE (1 << 12)
84 #define EVENT_FLAG_AGI (1 << 13)
85 #define EVENT_FLAG_HOOKRESPONSE (1 << 14)
86 #define EVENT_FLAG_CC (1 << 15)
87 #define EVENT_FLAG_AOC (1 << 16)
88 #define EVENT_FLAG_TEST (1 << 17)
92 #define AST_MAX_MANHEADERS 128
162 unsigned int registered:1;
164 unsigned int active_count;
169 #define ast_manager_register(a, b, c, d) ast_manager_register2(a, b, c, d, NULL)
172 #define ast_manager_register_xml(a, b, c) ast_manager_register2(a, b, c, NULL, NULL)
186 const char *description);
219 #define manager_event(category, event, contents , ...) \
220 __ast_manager_event_multichan(category, event, 0, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, contents , ## __VA_ARGS__)
221 #define ast_manager_event(chan, category, event, contents , ...) \
223 struct ast_channel *_chans[] = { chan, }; \
224 __ast_manager_event_multichan(category, event, 1, _chans, __FILE__, __LINE__, __PRETTY_FUNCTION__, contents , ## __VA_ARGS__); \
226 #define ast_manager_event_multichan(category, event, nchans, chans, contents , ...) \
227 __ast_manager_event_multichan(category, event, nchans, chans, __FILE__, __LINE__, __PRETTY_FUNCTION__, contents , ## __VA_ARGS__);
238 struct ast_channel **chans,
const char *
file,
int line,
const char *func,
239 const char *contents, ...) __attribute__((
format(printf, 8, 9)));
struct ast_datastore * astman_datastore_find(struct mansession *s, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a session.
Main Channel structure associated with a channel.
Asterisk locking-related definitions:
#define AST_MAX_MANHEADERS
Export manager structures.
void astman_append(struct mansession *s, const char *fmt,...)
void ast_manager_unregister_hook(struct manager_custom_hook *hook)
Delete a custom hook to be called when an event is fired.
int astman_verify_session_readpermissions(uint32_t ident, int perm)
Verify a session's read permissions against a permission mask.
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...
void ast_manager_register_hook(struct manager_custom_hook *hook)
Add a custom hook to be called when an event is fired.
int reload_manager(void)
Called by Asterisk module functions and the CLI command.
int(* manager_hook_t)(int, const char *, char *)
Manager Helper Function.
Structure for variables, used for configurations and for channel variables.
Structure for a data store type.
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
void astman_send_ack(struct mansession *s, const struct message *m, char *msg)
Send ack in manager transaction.
Structure for a data store object.
int check_manager_enabled(void)
Check if AMI is enabled.
int __ast_manager_event_multichan(int category, const char *event, int chancount, struct ast_channel **chans, const char *file, int line, const char *func, const char *contents,...)
ast_doc_src
From where the documentation come from, this structure is useful for use it inside application/functi...
const char * astman_get_header(const struct message *m, char *var)
Get header from mananger transaction.
Asterisk datastore objects.
int astman_is_authed(uint32_t ident)
Determinie if a manager session ident is authenticated.
#define AST_STRING_FIELD(name)
Declare a string field.
int ast_manager_register2(const char *action, int authority, int(*func)(struct mansession *s, const struct message *m), const char *synopsis, const char *description)
Register a manager command with the manager interface.
void astman_send_response(struct mansession *s, const struct message *m, char *resp, char *msg)
Send response in manager transaction.
Wrapper for network related headers, masking differences between various operating systems...
struct ast_variable * astman_get_variables(const struct message *m)
Get a linked list of the Variable: headers.
int astman_verify_session_writepermissions(uint32_t ident, int perm)
Verify a session's write permissions against a permission mask.
Asterisk XML Documentation API.
int astman_datastore_add(struct mansession *s, struct ast_datastore *datastore)
Add a datastore to a session.
int check_webmanager_enabled(void)
Check if AMI/HTTP is enabled.
int astman_datastore_remove(struct mansession *s, struct ast_datastore *datastore)
Remove a datastore from a session.
struct ast_variable * astman_get_variables_order(const struct message *m, enum variable_orders order)
Get a linked list of the Variable: headers with order specified.
int init_manager(void)
Called by Asterisk initialization.
void astman_send_error(struct mansession *s, const struct message *m, char *error)
Send error in manager transaction.
static snd_pcm_format_t format
int ast_manager_unregister(char *action)
Unregister a registered manager command.
void astman_send_listack(struct mansession *s, const struct message *m, char *msg, char *listflag)
Send ack in manager list transaction.