By agent, I assume you mean you're using a transfer to acd action and the call is waiting in queue. The inbound call flow is not running at this point. You need to create an inqueue call flow and select it in the transfer to acd action. In the inqueue flow, play hold music for 40 seconds then add a play audio action with your message. Then what else do you want to do? The inqueue flow loops through itself repeatedly until an agent answers the call or the caller hangs up. If you only want to to play that message once then you need to put some additional logic in. If you want it to repeat then you're done.
If you are using a transfer to user action instead, you can set the connect timeout but depending on whether the agent is online or not it might go to their voicemail in less than 40 seconds. You can disable allow rollover to voicemail but it will might return earlier than 40 seconds. Play your message in either the failed transfer audio or a play audio in the failure path of the transfer. And then decide what else you want to do.
------------------------------
Melissa Bailey
Genesys - Employees
------------------------------