I am trying to block certain numbers for certain users. It would seem that this isn’t possible with asterisk. Here’s my extensions.conf file. The “no-user1.conf” file has a number that I want to block for user1 only. However, for user1 to be able to reach user2, I have to include access to user2’s dial plan via the local context. This has the effect of therefore bringing into access to the blocked number to user2’s dial plan as well!
[c_user1]
#include “no-user1.conf”
#include "dp-user1.conf"
include => local
[c_user2]
#include “no-user2.conf”
#include "dp-user2.conf"
include => local
[c_atauser1]
#include “no-atauser1.conf”
#include "dp-atauser1.conf"
include => local
[sip_proxy_out]
exten => _X.,1,Answer
exten => _X.,2,Dial(SIP/${EXTEN}@sip_proxy,30,rT)
[local]
;
; Master context for local, toll-free, and iaxtel calls only
;
ignorepat => 9
include => c_user1
include => c_user2
include => c_atauser1
include => sip_proxy_out
And here’s the dial plan…
bil-pdev-4*CLI> show dialplan
[ Context ‘local’ created by ‘pbx_config’ ]
Include => ‘c_user1’ [pbx_config]
Include => ‘c_user2’ [pbx_config]
Include => ‘c_atauser1’ [pbx_config]
Ignore pattern => ‘9’ [pbx_config]
[ Context ‘sip_proxy_out’ created by ‘pbx_config’ ]
’_X.’ => 1. Answer() [pbx_config]
2. Dial(SIP/${EXTEN}@sip_proxy|30|rT) [pbx_config]
bil-pdev-4CLI>
[ Context ‘c_atauser1’ created by ‘pbx_config’ ]
Include => ‘local’ [pbx_config]
bil-pdev-4CLI>
[ Context ‘c_user2’ created by ‘pbx_config’ ]
‘4063250071’ => 1. Answer() [pbx_config]
2. Dial(SIP/user2) [pbx_config]
3. Hangup() [pbx_config]
Include => ‘local’ [pbx_config]
bil-pdev-4*CLI>
[ Context ‘c_user1’ created by ‘pbx_config’ ]
‘1234’ => 1. Answer() [pbx_config]
2. Playback(cannot-complete-as-dialed) [pbx_config]
3. Hangup() [pbx_config]
‘4063250070’ => 1. Answer() [pbx_config]
2. Dial(SIP/user1&SIP/user2) [pbx_config]
3. Hangup() [pbx_config]
Include => ‘local’ [pbx_config]
bil-pdev-4*CLI>
[ Context ‘parkedcalls’ created by ‘res_features’ ]
‘700’ => 1. Park()
Does anyone know of a simple way to provision per user number blocking in Asterisk?
And don’t say something like:
exten => 5551212/5559999
because we are provisioning our users as SIP users (ie alphanumberic), not as extensions, so isn’t really feesible. Sure, it will work, but the call blocking will follow the number, not the user.