Make an inbound CID rule with a mask of * with a destination of END CALL, then make an inbound CID rule for each number that is allowed and put it ahead of the * rule.
If you need this to be database driven, voiptools has a caller-id router add-on that can read from a sql database. You can have it route the matched numbers to one destination and anything unmatched to an end call route.