[cisco-voip] Block incoming calls

Robert Kulagowski rkulagow at gmail.com
Thu Jul 30 12:11:26 EDT 2009


On Thu, Jul 30, 2009 at 8:29 AM, Go0se<me at go0se.com> wrote:
> It is possible in an h323 config. We had a client that wanted to block a
> range of numbers (to stop calls from a competitor that was stealing
> employees). We were able to block their incoming numbers by converting the
> MGCP gateway to h323 and performing the block in the h323 config.
>
>
>
> voice translation-rule 1
>
>  rule 1 reject /1234447890/
>
>  rule 2 reject /1234447897/
>
>  rule 3 reject /1234555893/
>
>  rule 4 reject /12345080*/
>
>  rule 5 reject /12345081*/

We did that for the first 15 numbers we had at a particular site, but
then you can't put in additional rules.

We used the following instead:

 service ani_filter flash:ani_filter.tcl
  group-name ani_filter
! new_dest should be something unreachable so that the caller gets
number of out service message from telco
  param new_dest 5555
  param clid1 626xxxxxxx
  param clid2 808xxxxxxx
  param clid3 310xxxxxxx
  param clid4 801xxxxxxx
  param clid5 714xxxxxxx
  param clid6 562xxxxxxx
...
  param clid999 212xxxxxxx

Put the service on the 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
!

And the magic script:

# 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