109 static char *app =
"System";
111 static char *app2 =
"TrySystem";
113 static char *
chanvar =
"SYSTEMSTATUS";
115 static int system_exec_helper(
struct ast_channel *chan,
const char *data,
int failmode)
121 if (ast_strlen_zero(data)) {
122 ast_log(LOG_WARNING,
"System requires an argument(command)\n");
133 if (strchr(
"\"'", cbuf[0]) && cbuf[
ast_str_strlen(buf) - 1] == cbuf[0]) {
136 ast_log(LOG_NOTICE,
"It is not necessary to quote the argument to the System application.\n");
141 if ((res < 0) && (errno != ECHILD)) {
142 ast_log(LOG_WARNING,
"Unable to execute '%s'\n", (
char *)data);
145 }
else if (res == 127) {
146 ast_log(LOG_WARNING,
"Unable to execute '%s'\n", (
char *)data);
164 static int system_exec(
struct ast_channel *chan,
const char *data)
166 return system_exec_helper(chan, data, -1);
169 static int trysystem_exec(
struct ast_channel *chan,
const char *data)
171 return system_exec_helper(chan, data, 0);
174 static int unload_module(
void)
184 static int load_module(
void)
#define AST_THREADSTORAGE(name)
Define a thread storage variable.
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...
String manipulation functions.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
Definitions to aid in the use of thread local storage.
int ast_unregister_application(const char *app)
Unregister an application.
int ast_str_get_encoded_str(struct ast_str **str, int maxlen, const char *stream)
Decode a stream of encoded control or extended ASCII characters.
General Asterisk PBX channel definitions.
Core PBX routines and definitions.
int ast_autoservice_stop(struct ast_channel *chan)
Stop servicing a channel for us...
Support for dynamic strings.
int ast_safe_system(const char *s)
Safely spawn an OS shell command while closing file descriptors.
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name...
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
structure for queuing ARI channel variable setting
struct ast_str * ast_str_thread_get(struct ast_threadstorage *ts, size_t init_len)
Retrieve a thread locally stored dynamic string.
#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...
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.