Gateway have multiple trunks and registered phones, but for a certain trunk (in a config it is '192.168.255.253') it is necessary to make the following restriction (thus without changing the rights for remaining trunks, phones and so forth):
1) to block all calls from all calling numbers (ANI)...;
2) ...and at the same time to allow calls to specific called numbers (DNIS, in a config it is '^0727$') from specific calling numbers (ANI, in a config it is '1...'). Оnce again I will repeat, all this only for a certain trunk (from '192.168.255.253').
Config Cisco 2851 Gateway:
!
voice register global
mode cme
source-address 192.168.255.254 port 5060
max-dn 10
max-pool 10
authenticate register
!
voice register dn 1
number 0727
allow watch
name 0727
no-reg
!
voice register dn 2
number 0728
allow watch
name 0728
no-reg
!
voice register pool 1
id mac 0000.0000.0001
number 1 dn 1
voice-class codec 1
!
voice register pool 2
id mac 0000.0000.0002
number 1 dn 2
voice-class codec 1
!
dial-peer voice 2 voip
permission term
destination-pattern 1...
session protocol sipv2
session target ipv4:192.168.255.253
voice-class codec 1
!
dial-peer voice 3 voip
destination-pattern ...
session target ipv4:10.101.0.99
voice-class codec 1
dtmf-relay h245-signal h245-alphanumeric
!
dial-peer voice 1001 voip
destination-pattern .T
session protocol sipv2
session target sip-server
voice-class codec 1
voice-class sip bind control source-interface FastEthernet0/1/0.1100
!
dial-peer voice 2001 voip
session protocol sipv2
incoming called-number ^0727$
voice-class codec 1
!
In this configuration it turns out that all calls from ANI '1...' ('dial-peer voice 2 voip') on all DNIS, except '0727' ('dial-peer voice 2001 voip'), are blocked - is OK!
But if comes call from trunk '192.168.255.253' with ANI differ than '1...', then this calls allowed, but it is actually necessary to block to all DNIS.