#include "asterisk.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "asterisk/lock.h"
#include "asterisk/file.h"
#include "asterisk/logger.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/translate.h"
#include "asterisk/image.h"
#include "asterisk/options.h"
#include "asterisk/app.h"
Go to the source code of this file.
Functions | |
AST_MODULE_INFO_STANDARD (ASTERISK_GPL_KEY,"Send Text Applications") | |
static int | load_module (void) |
static int | sendtext_exec (struct ast_channel *chan, void *data) |
static int | unload_module (void) |
Variables | |
static const char * | app = "SendText" |
static const char * | descrip |
static const char * | synopsis = "Send a Text Message" |
Definition in file app_sendtext.c.
AST_MODULE_INFO_STANDARD | ( | ASTERISK_GPL_KEY | , | |
"Send Text Applications" | ||||
) |
static int load_module | ( | void | ) | [static] |
Definition at line 125 of file app_sendtext.c.
References ast_register_application(), and sendtext_exec().
00126 { 00127 return ast_register_application(app, sendtext_exec, synopsis, descrip); 00128 }
static int sendtext_exec | ( | struct ast_channel * | chan, | |
void * | data | |||
) | [static] |
Definition at line 67 of file app_sendtext.c.
References AST_APP_ARG, ast_channel_lock, ast_channel_unlock, AST_DECLARE_APP_ARGS, ast_goto_if_exists(), ast_log(), ast_module_user_add, ast_module_user_remove, ast_opt_priority_jumping, ast_sendtext(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), ast_module_user::chan, ast_channel::context, LOG_WARNING, parse(), pbx_builtin_setvar_helper(), ast_channel_tech::send_text, ast_channel::tech, and text.
Referenced by load_module().
00068 { 00069 int res = 0; 00070 struct ast_module_user *u; 00071 char *status = "UNSUPPORTED"; 00072 char *parse = NULL; 00073 int priority_jump = 0; 00074 AST_DECLARE_APP_ARGS(args, 00075 AST_APP_ARG(text); 00076 AST_APP_ARG(options); 00077 ); 00078 00079 u = ast_module_user_add(chan); 00080 00081 if (ast_strlen_zero(data)) { 00082 ast_log(LOG_WARNING, "SendText requires an argument (text[|options])\n"); 00083 ast_module_user_remove(u); 00084 return -1; 00085 } else 00086 parse = ast_strdupa(data); 00087 00088 AST_STANDARD_APP_ARGS(args, parse); 00089 00090 if (args.options) { 00091 if (strchr(args.options, 'j')) 00092 priority_jump = 1; 00093 } 00094 00095 ast_channel_lock(chan); 00096 if (!chan->tech->send_text) { 00097 ast_channel_unlock(chan); 00098 /* Does not support transport */ 00099 if (priority_jump || ast_opt_priority_jumping) 00100 ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101); 00101 ast_module_user_remove(u); 00102 return 0; 00103 } 00104 status = "FAILURE"; 00105 ast_channel_unlock(chan); 00106 res = ast_sendtext(chan, args.text); 00107 if (!res) 00108 status = "SUCCESS"; 00109 pbx_builtin_setvar_helper(chan, "SENDTEXTSTATUS", status); 00110 ast_module_user_remove(u); 00111 return 0; 00112 }
static int unload_module | ( | void | ) | [static] |
Definition at line 114 of file app_sendtext.c.
References ast_module_user_hangup_all, and ast_unregister_application().
00115 { 00116 int res; 00117 00118 res = ast_unregister_application(app); 00119 00120 ast_module_user_hangup_all(); 00121 00122 return res; 00123 }
const char* app = "SendText" [static] |
Definition at line 49 of file app_sendtext.c.
const char* descrip [static] |
Definition at line 53 of file app_sendtext.c.
const char* synopsis = "Send a Text Message" [static] |
Definition at line 51 of file app_sendtext.c.