Reading DTMF only from either caller or callee or both

Hi,
I am using Asterisk 13 and using pjsip. I want to read the DTMF based on the condition.

Question-1:
I want to implement the following conditions:
If x then read DTMF only from callee but ignore all DTMF from caller.
If y then read DTMF only from caller but ignore all DTMF from callee
If z then read DTMF from both caller and callee.

Question-2:
I already configured the features.conf.
testfeature => 222*,self/caller,System,/bin/sh /tmp/abcd.sh 1001 success
so if pattern 222* is match then execute the script /tmp/abcd.sh and pass the argument “1001” and “success” to the abcd.sh script. The script is working fine.

Instead of hardcoded 1001 and success, I want to pass the channel name and extension as the parameter, so how can I do it in features.conf?

I want to do the following:
testfeature => 222*,self/caller,System,/bin/sh /tmp/abcd.sh ${EXTEN} ${CHANNEL}. How can I do this?

Thanks.

I don’t think you can pass channel variables as parameter to an script from features.conf file, to my understanding channels variables are only accesible from the extensions.conf file

So how would I solve the question-1?

Local channel, that is what I do when I need to pass dynamic parameter to an script using feature code

Can you provide an example? I tried to look into it and got more confused.

Thanks.

Have you used local channels before ?