#include "asterisk.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/types.h>#include "asterisk/module.h"#include "asterisk/channel.h"#include "asterisk/pbx.h"#include "asterisk/logger.h"#include "asterisk/utils.h"#include "asterisk/app.h"

Go to the source code of this file.
Functions | |
| static void | __reg_module (void) |
| static void | __unreg_module (void) |
| static int | load_module (void) |
| static int | shell_helper (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
| static int | unload_module (void) |
Variables | |
| static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT | AST_MODFLAG_BUILDSUM, .description = "SHELL dialplan function" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, } |
| static const struct ast_module_info * | ast_module_info = &__mod_info |
| static struct ast_custom_function | shell_function |
\ Inspiration and Guidance from Russell! Thank You!
Definition in file func_shell.c.
| static void __reg_module | ( | void | ) | [static] |
Definition at line 89 of file func_shell.c.
| static void __unreg_module | ( | void | ) | [static] |
Definition at line 89 of file func_shell.c.
| static int load_module | ( | void | ) | [static] |
Definition at line 84 of file func_shell.c.
References ast_custom_function_register().
00085 { 00086 return ast_custom_function_register(&shell_function); 00087 }
| static int shell_helper | ( | struct ast_channel * | chan, | |
| const char * | cmd, | |||
| char * | data, | |||
| char * | buf, | |||
| size_t | len | |||
| ) | [static] |
Definition at line 42 of file func_shell.c.
References ast_log(), ast_strlen_zero(), and LOG_WARNING.
00044 { 00045 if (ast_strlen_zero(data)) { 00046 ast_log(LOG_WARNING, "Missing Argument! Example: Set(foo=${SHELL(echo \"bar\")})\n"); 00047 return -1; 00048 } 00049 00050 if (len >= 1) { 00051 FILE *ptr; 00052 char plbuff[4096]; 00053 00054 ptr = popen(data, "r"); 00055 while (fgets(plbuff, sizeof(plbuff), ptr)) { 00056 strncat(buf, plbuff, len - strlen(buf) - 1); 00057 } 00058 pclose(ptr); 00059 } 00060 00061 return 0; 00062 }
| static int unload_module | ( | void | ) | [static] |
Definition at line 79 of file func_shell.c.
References ast_custom_function_unregister().
00080 { 00081 return ast_custom_function_unregister(&shell_function); 00082 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT | AST_MODFLAG_BUILDSUM, .description = "SHELL dialplan function" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, } [static] |
Definition at line 89 of file func_shell.c.
const struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 89 of file func_shell.c.
struct ast_custom_function shell_function [static] |
Definition at line 64 of file func_shell.c.
1.5.9