Running app in the background while user is on hold?

How would you do it in asterisk?
what is the best way of putting the user to listen to some music while you retrive the data once the data is back unhold the user and carry on proccesing the user.

how would you do it in extensions and how would you do it in AGI