64 static const char *ast_extstate_str(
int state)
66 const char *res =
"UNKNOWN";
98 static int extstate_read(
struct ast_channel *chan,
const char *cmd,
char *data,
99 char *buf,
size_t len)
101 char *exten, *context;
103 if (ast_strlen_zero(data)) {
104 ast_log(LOG_WARNING,
"EXTENSION_STATE requires an extension\n");
108 context = exten = data;
109 strsep(&context,
"@");
110 if (ast_strlen_zero(context))
113 if (ast_strlen_zero(exten)) {
114 ast_log(LOG_WARNING,
"EXTENSION_STATE requires an extension\n");
125 .
name =
"EXTENSION_STATE",
126 .read = extstate_read,
130 static int unload_module(
void)
139 static int load_module(
void)
148 AST_MODULE_INFO_STANDARD(
ASTERISK_GPL_KEY,
"Gets an extension's state in the dialplan");
Main Channel structure associated with a channel.
Asterisk main include file. File version handling, generic pbx functions.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
General Asterisk PBX channel definitions.
Data structure associated with a custom dialplan function.
Core PBX routines and definitions.
Module has failed to load, may be in an inconsistent state.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
int ast_extension_state(struct ast_channel *c, const char *context, const char *exten)
Uses hint and devicestate callback to get the state of an extension.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
#define ast_custom_function_register(acf)
Register a custom function.