Go to the source code of this file.
Defines | |
#define | AST_PRIVACY_DENY (1 << 0) |
#define | AST_PRIVACY_ALLOW (1 << 1) |
#define | AST_PRIVACY_KILL (1 << 2) |
#define | AST_PRIVACY_TORTURE (1 << 3) |
#define | AST_PRIVACY_UNKNOWN (1 << 16) |
Functions | |
int | ast_privacy_check (char *dest, char *cid) |
int | ast_privacy_set (char *dest, char *cid, int status) |
int | ast_privacy_reset (char *dest) |
|
Definition at line 22 of file privacy.h. Referenced by ast_privacy_check(), and ast_privacy_set(). |
|
Definition at line 21 of file privacy.h. Referenced by ast_privacy_check(), and ast_privacy_set(). |
|
Definition at line 23 of file privacy.h. Referenced by ast_privacy_check(), and ast_privacy_set(). |
|
Definition at line 24 of file privacy.h. Referenced by ast_privacy_check(), and ast_privacy_set(). |
|
Definition at line 25 of file privacy.h. Referenced by ast_privacy_check(), and ast_privacy_set(). |
|
Definition at line 35 of file privacy.c. References ast_callerid_parse(), ast_db_get(), AST_PRIVACY_ALLOW, AST_PRIVACY_DENY, AST_PRIVACY_KILL, AST_PRIVACY_TORTURE, AST_PRIVACY_UNKNOWN, ast_shrink_phone_number(), and key(). 00036 { 00037 char tmp[256] = ""; 00038 char *trimcid = ""; 00039 char *n, *l; 00040 int res; 00041 char key[256], result[256]; 00042 if (cid) 00043 strncpy(tmp, cid, sizeof(tmp) - 1); 00044 ast_callerid_parse(tmp, &n, &l); 00045 if (l) { 00046 ast_shrink_phone_number(l); 00047 trimcid = l; 00048 } 00049 snprintf(key, sizeof(key), "%s/%s", dest, trimcid); 00050 res = ast_db_get("privacy", key, result, sizeof(result)); 00051 if (!res) { 00052 if (!strcasecmp(result, "allow")) 00053 return AST_PRIVACY_ALLOW; 00054 if (!strcasecmp(result, "deny")) 00055 return AST_PRIVACY_DENY; 00056 if (!strcasecmp(result, "kill")) 00057 return AST_PRIVACY_KILL; 00058 if (!strcasecmp(result, "torture")) 00059 return AST_PRIVACY_TORTURE; 00060 } 00061 return AST_PRIVACY_UNKNOWN; 00062 }
|
|
Definition at line 64 of file privacy.c. References ast_db_deltree(). 00065 {
00066 if (!dest)
00067 return -1;
00068 return ast_db_deltree("privacy", dest);
00069 }
|
|
Definition at line 71 of file privacy.c. References ast_callerid_parse(), 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 key(). 00072 { 00073 char tmp[256] = ""; 00074 char *trimcid = ""; 00075 char *n, *l; 00076 int res; 00077 char key[256]; 00078 if (cid) 00079 strncpy(tmp, cid, sizeof(tmp) - 1); 00080 ast_callerid_parse(tmp, &n, &l); 00081 if (l) { 00082 ast_shrink_phone_number(l); 00083 trimcid = l; 00084 } 00085 if (ast_strlen_zero(trimcid)) { 00086 /* Don't store anything for empty Caller*ID */ 00087 return 0; 00088 } 00089 snprintf(key, sizeof(key), "%s/%s", dest, trimcid); 00090 if (status == AST_PRIVACY_UNKNOWN) 00091 res = ast_db_del("privacy", key); 00092 else if (status == AST_PRIVACY_ALLOW) 00093 res = ast_db_put("privacy", key, "allow"); 00094 else if (status == AST_PRIVACY_DENY) 00095 res = ast_db_put("privacy", key, "deny"); 00096 else if (status == AST_PRIVACY_KILL) 00097 res = ast_db_put("privacy", key, "kill"); 00098 else if (status == AST_PRIVACY_TORTURE) 00099 res = ast_db_put("privacy", key, "torture"); 00100 else 00101 res = -1; 00102 return res; 00103 }
|