Announcement to client before transfer


So, the question is: how can we play an announcement to the client when transferring him to the specific number using attended transfer?
It should look like that: the client makes an incoming call to Asterisk, the call goes to queue and then to the agent. Agent transfers the client to another agent or extension, and the client should receive an announcement about it.

But there’s one moment: we should check the number of an agent we’re doing the transfer to and then decide if we should play the announcement or not.

For example: agent transfers the call to extension 201 - we play the message to the client. If agent transfers the call to any other extension - we play nothing.


Actually, the solution was finally found, and I’ve posted it here:
But it would be great to know if there is another way to do it.