diff options
Diffstat (limited to 'apps/app_lookupblacklist.c')
-rwxr-xr-x | apps/app_lookupblacklist.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/apps/app_lookupblacklist.c b/apps/app_lookupblacklist.c index 69743e377..82a556b15 100755 --- a/apps/app_lookupblacklist.c +++ b/apps/app_lookupblacklist.c @@ -3,9 +3,9 @@ * * App to lookup the callerid number, and see if it is blacklisted * - * Copyright (C) 1999, Mark Spencer + * Copyright (C) 1999-2004, Digium, Inc. * - * Mark Spencer <markster@linux-support.net> + * Mark Spencer <markster@digium.com> * * This program is free software, distributed under the terms of * the GNU General Public License @@ -48,38 +48,30 @@ LOCAL_USER_DECL; static int lookupblacklist_exec (struct ast_channel *chan, void *data) { - char old_cid[144] = "", *num, *name; char blacklist[1]; - char shrunknum[64] = ""; struct localuser *u; int bl = 0; LOCAL_USER_ADD (u); - if (chan->callerid) + if (chan->cid.cid_num) { - strncpy (old_cid, chan->callerid, sizeof (old_cid) - 1); - ast_callerid_parse (old_cid, &name, &num); - if (num) - strncpy (shrunknum, num, sizeof (shrunknum) - 1); - else - num = shrunknum; - - ast_shrink_phone_number (shrunknum); - if (!ast_db_get ("blacklist", shrunknum, blacklist, sizeof (blacklist))) + if (!ast_db_get ("blacklist", chan->cid.cid_num, blacklist, sizeof (blacklist))) { if (option_verbose > 2) - ast_log(LOG_NOTICE, "Blacklisted number %s found\n",shrunknum); + ast_log(LOG_NOTICE, "Blacklisted number %s found\n",chan->cid.cid_num); bl = 1; } - else if (!ast_db_get ("blacklist", name, blacklist, sizeof (blacklist))) + } + if (chan->cid.cid_name) { + if (!ast_db_get ("blacklist", chan->cid.cid_name, blacklist, sizeof (blacklist))) { if (option_verbose > 2) - ast_log (LOG_NOTICE,"Blacklisted name \"%s\" found\n",name); + ast_log (LOG_NOTICE,"Blacklisted name \"%s\" found\n",chan->cid.cid_name); bl = 1; } } - if (bl && ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid)) + if (bl && ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num)) chan->priority+=100; LOCAL_USER_REMOVE (u); return 0; |