#include "asterisk.h"
#include "asterisk/lock.h"
#include "asterisk/file.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/translate.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 | unload_module (void) |
static int | zapateller_exec (struct ast_channel *chan, const char *data) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Block Telemarketers with Special Information Tone" , .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 = "8586c2a7d357cb591cc3a6607a8f62d1" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, } |
static char * | app = "Zapateller" |
static struct ast_module_info * | ast_module_info = &__mod_info |
Definition in file app_zapateller.c.
static void __reg_module | ( | void | ) | [static] |
Definition at line 136 of file app_zapateller.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 136 of file app_zapateller.c.
static int load_module | ( | void | ) | [static] |
Definition at line 131 of file app_zapateller.c.
References AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_SUCCESS, ast_register_application_xml, and zapateller_exec().
00132 { 00133 return ((ast_register_application_xml(app, zapateller_exec)) ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_SUCCESS); 00134 }
static int unload_module | ( | void | ) | [static] |
Definition at line 126 of file app_zapateller.c.
References ast_unregister_application().
00127 { 00128 return ast_unregister_application(app); 00129 }
static int zapateller_exec | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 77 of file app_zapateller.c.
References ast_channel::_state, args, ast_answer(), AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_safe_sleep(), AST_STANDARD_APP_ARGS, AST_STATE_UP, ast_stopstream(), ast_strdupa, ast_strlen_zero(), ast_tonepair(), ast_channel::caller, ast_party_caller::id, ast_party_id::number, parse(), pbx_builtin_setvar_helper(), ast_party_number::str, and ast_party_number::valid.
Referenced by load_module().
00078 { 00079 int res = 0; 00080 int i, answer = 0, nocallerid = 0; 00081 char *parse = ast_strdupa((char *)data); 00082 AST_DECLARE_APP_ARGS(args, 00083 AST_APP_ARG(options)[2]; 00084 ); 00085 00086 AST_STANDARD_APP_ARGS(args, parse); 00087 00088 for (i = 0; i < args.argc; i++) { 00089 if (!strcasecmp(args.options[i], "answer")) 00090 answer = 1; 00091 else if (!strcasecmp(args.options[i], "nocallerid")) 00092 nocallerid = 1; 00093 } 00094 00095 pbx_builtin_setvar_helper(chan, "ZAPATELLERSTATUS", "NOTHING"); 00096 ast_stopstream(chan); 00097 if (chan->_state != AST_STATE_UP) { 00098 if (answer) { 00099 res = ast_answer(chan); 00100 pbx_builtin_setvar_helper(chan, "ZAPATELLERSTATUS", "ANSWERED"); 00101 } 00102 if (!res) 00103 res = ast_safe_sleep(chan, 500); 00104 } 00105 00106 if (nocallerid /* Zap caller if no caller id. */ 00107 && chan->caller.id.number.valid 00108 && !ast_strlen_zero(chan->caller.id.number.str)) { 00109 /* We have caller id. */ 00110 return res; 00111 } 00112 00113 if (!res) 00114 res = ast_tonepair(chan, 950, 0, 330, 0); 00115 if (!res) 00116 res = ast_tonepair(chan, 1400, 0, 330, 0); 00117 if (!res) 00118 res = ast_tonepair(chan, 1800, 0, 330, 0); 00119 if (!res) 00120 res = ast_tonepair(chan, 0, 0, 1000, 0); 00121 00122 pbx_builtin_setvar_helper(chan, "ZAPATELLERSTATUS", "ZAPPED"); 00123 return res; 00124 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Block Telemarketers with Special Information Tone" , .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 = "8586c2a7d357cb591cc3a6607a8f62d1" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, } [static] |
Definition at line 136 of file app_zapateller.c.
char* app = "Zapateller" [static] |
Definition at line 75 of file app_zapateller.c.
struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 136 of file app_zapateller.c.