Privacy Routines.
More...
#include "asterisk.h"
#include <sys/time.h>
#include <signal.h>
#include <dirent.h>
#include "asterisk/channel.h"
#include "asterisk/file.h"
#include "asterisk/app.h"
#include "asterisk/dsp.h"
#include "asterisk/astdb.h"
#include "asterisk/callerid.h"
#include "asterisk/privacy.h"
#include "asterisk/utils.h"
#include "asterisk/lock.h"
Go to the source code of this file.
int ast_privacy_check |
( |
char * |
dest, |
|
|
char * |
cid |
|
) |
| |
Definition at line 48 of file privacy.c.
References ast_callerid_parse(), ast_copy_string(), ast_db_get(), AST_PRIVACY_ALLOW, AST_PRIVACY_DENY, AST_PRIVACY_KILL, AST_PRIVACY_TORTURE, AST_PRIVACY_UNKNOWN, and ast_shrink_phone_number().
Referenced by setup_privacy_args().
54 char key[256], result[256];
62 snprintf(key,
sizeof(key),
"%s/%s", dest, trimcid);
63 res =
ast_db_get(
"privacy", key, result,
sizeof(result));
65 if (!strcasecmp(result,
"allow"))
67 if (!strcasecmp(result,
"deny"))
69 if (!strcasecmp(result,
"kill"))
71 if (!strcasecmp(result,
"torture"))
#define AST_PRIVACY_ALLOW
int ast_db_get(const char *family, const char *key, char *out, int outlen)
Get key value specified by family/key.
#define AST_PRIVACY_TORTURE
#define AST_PRIVACY_UNKNOWN
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
void ast_shrink_phone_number(char *n)
Shrink a phone number in place to just digits (more accurately it just removes ()'s, .'s, and -'s...
int ast_callerid_parse(char *instr, char **name, char **location)
Destructively parse inbuf into name and location (or number)
int ast_privacy_reset |
( |
char * |
dest | ) |
|
Definition at line 77 of file privacy.c.
References ast_db_deltree().
int ast_db_deltree(const char *family, const char *keytree)
Delete one or more entries in astdb If both parameters are NULL, the entire database will be purged...
int ast_privacy_set |
( |
char * |
dest, |
|
|
char * |
cid, |
|
|
int |
status |
|
) |
| |
Definition at line 84 of file privacy.c.
References ast_callerid_parse(), ast_copy_string(), ast_db_del(), ast_db_put(), AST_PRIVACY_ALLOW, AST_PRIVACY_DENY, AST_PRIVACY_KILL, AST_PRIVACY_TORTURE, AST_PRIVACY_UNKNOWN, ast_shrink_phone_number(), and ast_strlen_zero().
102 snprintf(key,
sizeof(key),
"%s/%s", dest, trimcid);
#define AST_PRIVACY_ALLOW
#define AST_PRIVACY_TORTURE
static force_inline int attribute_pure ast_strlen_zero(const char *s)
#define AST_PRIVACY_UNKNOWN
int ast_db_del(const char *family, const char *key)
Delete entry in astdb.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
int ast_db_put(const char *family, const char *key, const char *value)
Store value addressed by family/key.
void ast_shrink_phone_number(char *n)
Shrink a phone number in place to just digits (more accurately it just removes ()'s, .'s, and -'s...
int ast_callerid_parse(char *instr, char **name, char **location)
Destructively parse inbuf into name and location (or number)