Tue Aug 24 20:36:03 2010

Asterisk developer's documentation


func_blacklist.c File Reference

Function to lookup the callerid number, and see if it is blacklisted. More...

#include "asterisk.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/astdb.h"
Include dependency graph for func_blacklist.c:

Go to the source code of this file.

Functions

 AST_MODULE_INFO_STANDARD (ASTERISK_GPL_KEY,"Look up Caller*ID name/number from blacklist database")
static int blacklist_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static int load_module (void)
static int unload_module (void)

Variables

static struct ast_custom_function blacklist_function

Detailed Description

Function to lookup the callerid number, and see if it is blacklisted.

Author:
Mark Spencer <markster@digium.com>

Definition in file func_blacklist.c.


Function Documentation

AST_MODULE_INFO_STANDARD ( ASTERISK_GPL_KEY  ,
"Look up Caller*ID name/number from blacklist database"   
)
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::cid, ast_callerid::cid_name, and ast_callerid::cid_num.

00056 {
00057    char blacklist[1];
00058    int bl = 0;
00059 
00060    if (chan->cid.cid_num) {
00061       if (!ast_db_get("blacklist", chan->cid.cid_num, blacklist, sizeof (blacklist)))
00062          bl = 1;
00063    }
00064    if (chan->cid.cid_name) {
00065       if (!ast_db_get("blacklist", chan->cid.cid_name, blacklist, sizeof (blacklist)))
00066          bl = 1;
00067    }
00068 
00069    snprintf(buf, len, "%d", bl);
00070    return 0;
00071 }

static int load_module ( void   )  [static]

Definition at line 83 of file func_blacklist.c.

References ast_custom_function_register.

00084 {
00085    return ast_custom_function_register(&blacklist_function);
00086 }

static int unload_module ( void   )  [static]

Definition at line 78 of file func_blacklist.c.

References ast_custom_function_unregister().

00079 {
00080    return ast_custom_function_unregister(&blacklist_function);
00081 }


Variable Documentation

Initial value:
 {
   .name = "BLACKLIST",
   .read = blacklist_read,
}

Definition at line 73 of file func_blacklist.c.


Generated on 24 Aug 2010 for Asterisk - the Open Source PBX by  doxygen 1.6.1