How to find out who has requested a dynamic feature


When a dynamic feature calls a macro, how to find out which user has requested the feature

For example imagine that we want to set *222 to play a recorded message for each number.

and in extentions.conf:

[globals] DYNAMIC_FEATURES=>playfeature ... [macro-playfeature] exten => s,1,NoOp() exten => s,n,Playback(/etc/asterisk/arianda/playfeature/${CALLERID(number)})

In this case plays the message based on the peer’s callerid

in another case:

[macro-playfeature] exten => s,1,NoOp() exten => s,n,Playback(/etc/asterisk/arianda/playfeature/${DIALEDPEERNUMBER})
In this case,it works fine when peer is the caller.
These means that when dynamic feature calls a macro, just information about the side which macro is executing on is passed. How to find out who has requested the feature???


You may e.g. define two features like

playfeaturecaller => *222,peer/caller,Macro,playfeaturecaller playfeaturecallee => *222,peer/callee,Macro,playfeaturecallee

The first line defines a Feature usable only for the Caller (the initiator) of a call, thus the second defines it for the called party only.
There are other opportunities to achieve Your goal, for the whole stuff look at features.conf.sample which comes with the asterisk-code.