#include "asterisk.h"
#include "asterisk/file.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.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 | sendtext_exec (struct ast_channel *chan, void *data) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Send Text Applications" , .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 = "a9c98e5d177805051735cb5b0b16b0a0" , .load = load_module, .unload = unload_module, } |
static const char * | app = "SendText" |
static struct ast_module_info * | ast_module_info = &__mod_info |
static const char * | descrip |
static const char * | synopsis = "Send a Text Message" |
Definition in file app_sendtext.c.
static void __reg_module | ( | void | ) | [static] |
Definition at line 99 of file app_sendtext.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 99 of file app_sendtext.c.
static int load_module | ( | void | ) | [static] |
Definition at line 94 of file app_sendtext.c.
References ast_register_application, and sendtext_exec().
00095 { 00096 return ast_register_application(app, sendtext_exec, synopsis, descrip); 00097 }
static int sendtext_exec | ( | struct ast_channel * | chan, | |
void * | data | |||
) | [static] |
Definition at line 54 of file app_sendtext.c.
References AST_APP_ARG, ast_channel_lock, ast_channel_unlock, AST_DECLARE_APP_ARGS, ast_log(), ast_sendtext(), AST_STANDARD_APP_ARGS, ast_strdupa, chan, LOG_WARNING, parse(), pbx_builtin_setvar_helper(), ast_channel_tech::send_text, status, ast_channel::tech, and text.
Referenced by load_module().
00055 { 00056 int res = 0; 00057 char *status = "UNSUPPORTED"; 00058 char *parse = NULL; 00059 AST_DECLARE_APP_ARGS(args, 00060 AST_APP_ARG(text); 00061 ); 00062 00063 /* NOT ast_strlen_zero, because some protocols (e.g. SIP) MUST be able to 00064 * send a zero-length message. */ 00065 if (!data) { 00066 ast_log(LOG_WARNING, "SendText requires an argument (text)\n"); 00067 return -1; 00068 } else 00069 parse = ast_strdupa(data); 00070 00071 AST_STANDARD_APP_ARGS(args, parse); 00072 00073 ast_channel_lock(chan); 00074 if (!chan->tech->send_text) { 00075 ast_channel_unlock(chan); 00076 /* Does not support transport */ 00077 pbx_builtin_setvar_helper(chan, "SENDTEXTSTATUS", status); 00078 return 0; 00079 } 00080 status = "FAILURE"; 00081 ast_channel_unlock(chan); 00082 res = ast_sendtext(chan, args.text); 00083 if (!res) 00084 status = "SUCCESS"; 00085 pbx_builtin_setvar_helper(chan, "SENDTEXTSTATUS", status); 00086 return 0; 00087 }
static int unload_module | ( | void | ) | [static] |
Definition at line 89 of file app_sendtext.c.
References ast_unregister_application().
00090 { 00091 return ast_unregister_application(app); 00092 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Send Text Applications" , .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 = "a9c98e5d177805051735cb5b0b16b0a0" , .load = load_module, .unload = unload_module, } [static] |
Definition at line 99 of file app_sendtext.c.
const char* app = "SendText" [static] |
Definition at line 40 of file app_sendtext.c.
struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 99 of file app_sendtext.c.
const char* descrip [static] |
Definition at line 44 of file app_sendtext.c.
const char* synopsis = "Send a Text Message" [static] |
Definition at line 42 of file app_sendtext.c.