Restrict Dynamic Features to Callee Channel


we want to open doors with a dtmf signal while in a call. The doors will open when we call a specific script (at the moment just “playback” to test). What we have done so far:

DYNAMIC_FEATURES => testfeature

testfeature => #9,callee,Macro,incall3

exten => s,1,Noop(Entering user defined context [macro-incall3] in extensions_custom.conf)
exten => s,n,Noop(Caller-ID: ${CALLERID(num)})
exten => s,n,GotoIf($[ ${CALLERID(num)} = 11 ]?yes:no)
exten => s,10(yes),Playback(tt-monkeys)
exten => s,20(no),Playback(tt-weasels)

The first problem is, that the caller and the callee both can type #9 to activate the feature but we want only the callee to active it. (So that only the callee can open the door)
I know I have to do this with pre-dial handlers.
This is what I’ve found but I don’t know how to translate it to get it working:

exten => s,1,NoOp()
same => n,Dial(${ARG1},5,b(test^callee_handler^1)) ; goes to [test] context to execute the lines under [test] on callee's channel
same => n,Return()

exten => callee_handler,1,NoOp()
same => n,Set(__DYNAMIC_FEATURES=testfeature) ;now dynamic features can be activated by the callee's channel only. The documentation says "The feature is activated by which channel DYNAMIC_FEATURES includes the feature is on". 
same => n,Return()

Second Problem is that ${CALLERID(num)} always is the callerid number of the person who dialed the code (#9) but I want do distinguish between the real caller numbers so that I can open the correct door.

Any help is appreciated!

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.