Adding caller ID to blacklist during call

@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:

  1. 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)

  2. 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?