Index: apps/app_lookupblacklist.c =================================================================== RCS file: /usr/cvsroot/asterisk/apps/app_lookupblacklist.c,v retrieving revision 1.14 diff -u -r1.14 app_lookupblacklist.c --- apps/app_lookupblacklist.c 6 Nov 2005 15:09:46 -0000 1.14 +++ apps/app_lookupblacklist.c 6 Nov 2005 20:32:11 -0000 @@ -42,6 +42,7 @@ #include "asterisk/image.h" #include "asterisk/callerid.h" #include "asterisk/astdb.h" +#include "asterisk/options.h" static char *tdesc = "Look up Caller*ID name/number from blacklist database"; @@ -50,13 +51,15 @@ static char *synopsis = "Look up Caller*ID name/number from blacklist database"; static char *descrip = - " LookupBlacklist: Looks up the Caller*ID number on the active\n" - "channel in the Asterisk database (family 'blacklist'). If the\n" - "number is found, and if there exists a priority n + 101,\n" - "where 'n' is the priority of the current instance, then the\n" - "channel will be setup to continue at that priority level.\n" - "Otherwise, it returns 0. Does nothing if no Caller*ID was received on the\n" + " LookupBlacklist(options): Looks up the Caller*ID number on the active\n" + "channel in the Asterisk database (family 'blacklist'). \n" + "Returns 0. Does nothing if no Caller*ID was received on the\n" "channel.\n" + "The option string may contain zero or the following character:\n" + " 'j' -- jump to n+101 priority if the number/name is found in the blacklist\n" + "This application sets the following channel variable upon completion:\n" + " LOOKUPBLSTATUS The status of the Blacklist lookup as a text string, one of\n" + " FOUND | NOTFOUND\n" "Example: database put blacklist 1\n"; STANDARD_LOCAL_USER; @@ -69,8 +72,15 @@ char blacklist[1]; struct localuser *u; int bl = 0; + int priority_jump = 0; LOCAL_USER_ADD (u); + + if (data) { + if (strchr(data, 'j')) + priority_jump = 1; + } + if (chan->cid.cid_num) { if (!ast_db_get ("blacklist", chan->cid.cid_num, blacklist, sizeof (blacklist))) @@ -88,9 +98,13 @@ bl = 1; } } - - if (bl) - ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101); + + if (bl) { + if (priority_jump || option_priority_jumping) + ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101); + pbx_builtin_setvar_helper(chan, "LOOKUPBLSTATUS", "FOUND"); + } else + pbx_builtin_setvar_helper(chan, "LOOKUPBLSTATUS", "NOTFOUND"); LOCAL_USER_REMOVE (u); return 0;