40 static int shell_helper(
struct ast_channel *chan,
const char *cmd,
char *data,
41 char *buf,
size_t len)
45 if (ast_strlen_zero(data)) {
46 ast_log(LOG_WARNING,
"Missing Argument! Example: Set(foo=${SHELL(echo \"bar\")})\n");
58 ptr = popen(data,
"r");
60 while (fgets(plbuff,
sizeof(plbuff), ptr)) {
61 strncat(buf, plbuff, len - strlen(buf) - 1);
65 ast_log(LOG_WARNING,
"Failed to execute shell command '%s'\n", data);
113 .read = shell_helper,
116 static int unload_module(
void)
121 static int load_module(
void)
126 AST_MODULE_INFO_STANDARD(
ASTERISK_GPL_KEY,
"Collects the output generated by a command executed by the system shell");
Main Channel structure associated with a channel.
Asterisk main include file. File version handling, generic pbx functions.
int ast_autoservice_start(struct ast_channel *chan)
Automatically service a channel for us...
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
#define ast_custom_function_register_escalating(acf, escalation)
Register a custom function which requires escalated privileges.
General Asterisk PBX channel definitions.
Data structure associated with a custom dialplan function.
Core PBX routines and definitions.
int ast_autoservice_stop(struct ast_channel *chan)
Stop servicing a channel for us...
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...