Hi guys,
I’m trying to blacklist the caller ID of a caller during the call. Say, a telemarketer called me. I pick the phone up and realise it’s a telemarketer. Then I’d like to press some key to add the caller ID of the caller to a blacklist. How do I do this?
I know how to add numbers to a blacklist and do checking (using the AstDB and Gotoif). However, I couldn’t find any implementations that blacklisted a caller ID during the call when say *999 was pressed.
I did see other methods that required you to ring an IVR / dial a number after the call was disconnected to blacklist the callerID of the last call. But, I’d like a more seamless process. The closest I could get was to use the “g” option in the Dial() application (https://wiki.asterisk.org/wiki/display/AST/Asterisk+11+Application_Dial) but this only works if the caller hangs up first (waiting a telemarketer to hangup wouldn’t be ideal).
Any help would be appreciated.
Thanks,
Clive
How about implementing something using Custom Dynamic Features?
–Satish Barot
1 Like
Hi @satish4asterisk,
I haven’t tried that yet but had a look at the link. Would this mean that DTMF input from both caller and called party would be accepted? I don’t want someone who calls me to block me or themselves on their own on my PBX (that would be a security flaw?).
EDIT > I realised that it can be done for the callee alone. I’ll have to try this out and see what will work as I haven’t used this before.
See ActivatedBy in https://wiki.asterisk.org/wiki/display/AST/Custom+Dynamic+Features
Also see the description of the DYNAMIC _FEATURES variable.
N.B. these are relative to the party making the call.
1 Like
@david551 @satish4asterisk - I couldn’t find much in terms of a walkthrough but here is what I’ve been able to do from trial and error and reading some basics online:
features.conf
[applicationmap]
apps => *9,peer,Macro,appblock
extensions.conf
;this part is a continuation of the rest of the dial plan
[macro-dial-extension]
exten => s,1,Set(__DYNAMIC_FEATURES=apps) ;if I don’t put double underscore, then when B calls A (i.e. me), only B is able to press *9 and use the feature
same => n,Dial(${ARG1},u)
same => n,Return()
[macro-appblock]
exten => s,1,Set(DB(blacklist/${CALLERID(num)})=1)
same => n,Set(Value=${DB(test/${CALLERID(num)})})
same => n,SayDigits(1234) ;I’d like to put a message like "block successful"
same => n, MacroExit ; not sure what this is for
Some issues here:
-
When I make a call from B to A (say A is my number), both A and B are able to block each other. This is bad because I don’t want a caller to call in and block my own number on my own PBX (although it doesn’t make sense)
-
I’d like to play a message like “Number B has been blocked” or “block successful” so that I know it has been added to the blacklist. However, using the above method, only B is able to hear any message played by Asterisk (when the feature is activated by A… vice versa if feature was activated by B)- this is because the custom feature acts on the “other” channel since I specified “ActivateOn” field as “peer”. I had to specify it as peer because only then will I get the ${CallerID(num)} = caller ID of the other guy.
Can you help me fix this?
@david551 Activated By is deprecated it seems.