Asterisk Queue

I need to implement the following scenario:

  1. All inbound calls are added to a queue
  2. As soon as an agent becomes available the queue redirects to an agi script (i need to play a wave file according to the customer id) and then redirected to the agent.

Any help regarding this is appreciated.