#include "asterisk.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/astdb.h"
Go to the source code of this file.
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | blacklist_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
static int | blacklist_read2 (struct ast_channel *chan, const char *cmd, char *data, struct ast_str **str, ssize_t len) |
static int | load_module (void) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Look up Caller*ID name/number from blacklist database" , .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 struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_custom_function | blacklist_function |
Definition in file func_blacklist.c.
static void __reg_module | ( | void | ) | [static] |
Definition at line 105 of file func_blacklist.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 105 of file func_blacklist.c.
static int blacklist_read | ( | struct ast_channel * | chan, | |
const char * | cmd, | |||
char * | data, | |||
char * | buf, | |||
size_t | len | |||
) | [static] |
Definition at line 55 of file func_blacklist.c.
References ast_db_get(), ast_channel::caller, ast_party_caller::id, ast_party_id::name, ast_party_id::number, ast_party_name::str, ast_party_number::str, ast_party_name::valid, and ast_party_number::valid.
Referenced by blacklist_read2().
00056 { 00057 char blacklist[1]; 00058 int bl = 0; 00059 00060 if (chan->caller.id.number.valid && chan->caller.id.number.str) { 00061 if (!ast_db_get("blacklist", chan->caller.id.number.str, blacklist, sizeof (blacklist))) 00062 bl = 1; 00063 } 00064 if (chan->caller.id.name.valid && chan->caller.id.name.str) { 00065 if (!ast_db_get("blacklist", chan->caller.id.name.str, blacklist, sizeof (blacklist))) 00066 bl = 1; 00067 } 00068 00069 snprintf(buf, len, "%d", bl); 00070 return 0; 00071 }
static int blacklist_read2 | ( | struct ast_channel * | chan, | |
const char * | cmd, | |||
char * | data, | |||
struct ast_str ** | str, | |||
ssize_t | len | |||
) | [static] |
Definition at line 73 of file func_blacklist.c.
References ast_str_buffer(), ast_str_make_space(), ast_str_size(), ast_str_strlen(), ast_str_update(), blacklist_read(), and str.
00074 { 00075 /* 2 bytes is a single integer, plus terminating null */ 00076 if (ast_str_size(*str) - ast_str_strlen(*str) < 2) { 00077 if (len > ast_str_size(*str) || len == 0) { 00078 ast_str_make_space(str, len ? len : ast_str_strlen(*str) + 2); 00079 } 00080 } 00081 if (ast_str_size(*str) - ast_str_strlen(*str) >= 2) { 00082 int res = blacklist_read(chan, cmd, data, ast_str_buffer(*str) + ast_str_strlen(*str), 2); 00083 ast_str_update(*str); 00084 return res; 00085 } 00086 return -1; 00087 }
static int load_module | ( | void | ) | [static] |
Definition at line 100 of file func_blacklist.c.
References ast_custom_function_register, and blacklist_function.
00101 { 00102 return ast_custom_function_register(&blacklist_function); 00103 }
static int unload_module | ( | void | ) | [static] |
Definition at line 95 of file func_blacklist.c.
References ast_custom_function_unregister(), and blacklist_function.
00096 { 00097 return ast_custom_function_unregister(&blacklist_function); 00098 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Look up Caller*ID name/number from blacklist database" , .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 105 of file func_blacklist.c.
struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 105 of file func_blacklist.c.
struct ast_custom_function blacklist_function [static] |
Initial value:
{ .name = "BLACKLIST", .read = blacklist_read, .read2 = blacklist_read2, }
Definition at line 89 of file func_blacklist.c.
Referenced by load_module(), and unload_module().