57 static int blacklist_read(
struct ast_channel *chan,
const char *cmd,
char *data,
char *buf,
size_t len)
63 ast_log(LOG_WARNING,
"No channel was provided to %s function.\n", cmd);
67 if (ast_channel_caller(chan)->
id.
number.valid && ast_channel_caller(chan)->
id.
number.str) {
68 if (!
ast_db_get(
"blacklist", ast_channel_caller(chan)->
id.
number.str, blacklist, sizeof (blacklist)))
71 if (ast_channel_caller(chan)->
id.
name.valid && ast_channel_caller(chan)->
id.
name.str) {
72 if (!
ast_db_get(
"blacklist", ast_channel_caller(chan)->
id.
name.str, blacklist, sizeof (blacklist)))
76 snprintf(buf, len,
"%d", bl);
80 static int blacklist_read2(
struct ast_channel *chan,
const char *cmd,
char *data,
struct ast_str **str, ssize_t len)
98 .read = blacklist_read,
99 .read2 = blacklist_read2,
102 static int unload_module(
void)
107 static int load_module(
void)
112 AST_MODULE_INFO_STANDARD(
ASTERISK_GPL_KEY,
"Look up Caller*ID name/number from blacklist database");
Main Channel structure associated with a channel.
Asterisk main include file. File version handling, generic pbx functions.
size_t ast_str_size(const struct ast_str *buf)
Returns the current maximum length (without reallocation) of the current buffer.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
General Asterisk PBX channel definitions.
Data structure associated with a custom dialplan function.
Core PBX routines and definitions.
Support for dynamic strings.
int ast_db_get(const char *family, const char *key, char *value, int valuelen)
Get key value specified by family/key.
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
void ast_str_update(struct ast_str *buf)
Update the length of the buffer, after using ast_str merely as a buffer.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
Persistent data storage (akin to *doze registry)
#define ast_custom_function_register(acf)
Register a custom function.