[cisco-voip] blocking numbers

Robert Kulagowski rkulagow at gmail.com
Tue Nov 4 11:49:49 EST 2008


Easy.  Use the ani_filter.tcl script. Here are some docs that were 
written by one of my co-workers.

Document Name:		R & D Documentation
Overview:		TCL script for changing the called party number based on 
caller ID
Prerequisites:		Cisco H.323 IOS voice gateway

TCL script for changing the called party number based on caller ID

This document describes an IOS TCL scripts that allow calls with a 
specific caller ID to have the corresponding called number changed or 
redirected / dropped. This is useful for offices that want to trap calls 
from certain numbers and send them to VM, to the attendant or maybe drop 
the call altogether. Some offices will want us to do this for security 
reasons; others do it because they want to filter out telemarketing calls.

There is currently no way that ANI filtering can be done by Call Manager.

The scripts have been developed and tested using IOS 12.2(11)T6 but 
should work with any IOS version that support IVR/TCL 2.0. The script 
works with H.323 only, it does not work with MGCP.

To install and configure the scripts perform the following steps:

1)	Obtain and upload the ani_filter.tcl scripts to a TFTP server. Then 
copy to the gateways flash. See Below

USCTSTVGW01#copy tftp flash:
Address or name of remote host []? 10.x.x.x
Source filename []? ani_filter.tcl
Accessing tftp://10.x.x.x/ani_filter.tcl...

2)	On the H.323 IOS gateway add the following configuration. (NOTE: See 
#5 on how to add a clid to an existing configuration)

application
service ani_filter flash:ani_filter.tcl
group-name ani_filter
param new_dest 5555
param clid1 2145551212
param clid2 8155551212
    	.
    	.
    	.
param clid1000 4085551212

The parameters clid1, clid2, etc, clid1000 is a list of up to 1000 
calling numbers that the script will match against. If the calling 
number matches any of these numbers then the called number will be 
changed to new_dest and from there onwards the call is processed as normal.

The parameter new_dest is the number that the original called number 
will be changed to if the calling number matches any of the configured 
calling numbers.


	

3)	Change the pots dial-peer that routes all incoming calls from the 
PSTN to the ani_filter.tcl script. Add service ani_filter  to the 
existing dial-peer.

dial-peer voice 371 pots
     	description Incoming DID - SBC
     	service ani_filter
     	incoming called-number 37....
     	direct-inward-dial
     	port 0/1/0:23

4)	Make sure that there a voip dial-peer exists that can route the 
new_dest number to Call Manager. _Or_ if the intention is to drop the 
call make sure there is no matching dial-peer, in which case the call 
will just be dropped and the caller will hear re-order.

5)	To add more clid numbers to an existing blocking configuration, do 
the following. Do a show run command and find the next available clid#. 
In this case the next available was clid15 and clid16. See Below on how 
to add numbers to the existing configuration.

application
   		service ani_filter
   		param clid15 9545551212
   	param clid16 6125551212


Use the troubleshooting commands on the gateways if needed to watch the 
call:

-	debug voip ivr script
-	debug isdn q931

# ani_filter.tcl
# Script Version 1.0(1)
#------------------------------------------------------------------
# October 2002, Niels Brunsgaard
#
# Copyright (c) 1998-2002 by cisco Systems, Inc.
# All rights reserved.
#------------------------------------------------------------------
#
# This tcl script filters calls based on ANI. If there is a match # 
against a pe-configured list of numbers it changes the DNIS # to a 
configurable value #
#

proc init { } {
     global param
}

proc act_Setup { } {

     leg setupack leg_incoming

     set dnis [infotag get leg_dnis]
     set new_dnis [infotag get cfg_avpair new_dest]
     set ani [infotag get leg_ani]
     set ani_deny ""
     set ani_pi [infotag get leg_ani_pi]
     puts "dnis $dnis new_dnis $new_dnis ani $ani ani_pi $ani_pi"
     if { $ani_pi != "presentation_allowed" } {
       set ani ""
     }

     set x 1
     while {1} {
       if {[infotag get cfg_avpair_exists clid$x]} {
         set ani_deny [infotag get cfg_avpair clid$x]
         puts "clid$x = $ani_deny"
         if { $ani == $ani_deny} {
           set dnis $new_dnis
           puts "match clid $ani_deny x=$x"
           break
         }
       } else {
         puts "No more clid at $x"
         break
       }
       incr x
       if { $x > 1000 } { puts "Too many clids" }
     }
     puts "Final dnis $dnis"
     leg proceeding leg_incoming
     leg setup $dnis callInfo leg_incoming
}

proc act_CallSetupDone { } {
     global beep

     set status [infotag get evt_status]

     puts "Entering act_CallSetupDone"
     if { $status != "ls_000"} {
         puts "Call [infotag get con_all] got event $status while 
placing an outgoing call"
         call close
     }
}

proc act_Cleanup { } {
     puts "Entering act_Cleanup"
     call close
}

proc act_Abort { } {
     puts "Unexpected event - entering act_Abort"
     call close
}

init

#----------------------------------
#   State Machine
#----------------------------------
   set TopFSM(any_state,ev_disconnected) "act_Abort,same_state"
   set TopFSM(CALL_INIT,ev_setup_indication) "act_Setup,PLACECALL"
   set TopFSM(PLACECALL,ev_setup_done)  "act_CallSetupDone,CALLACTIVE"
   set TopFSM(CALLACTIVE,ev_disconnected)   "act_Cleanup,CALLDISCONNECTED"
   set TopFSM(CALLDISCONNECTED,ev_disconnect_done) "act_Cleanup,same_state"

   fsm define TopFSM  CALL_INIT



More information about the cisco-voip mailing list