How do I put a caller on hold music and let him interrupt?

Hey all, I need my app (python script), to put the caller on music on hold and then check a db every 5 seconds, if a criteria is met i need to stop the hold music and play him a prompt, the catch is I also need him/her to able to press any key(or defined key) to stop holding and return to our main menu. I have tried starting music on hold and can check the db just fine while he is holding and interrupt if necessary but I cant seem to trap or detect him pressing any keys while on hold. The other side of the coin is to play a getdigit prompt as hold music and allow him to interrupt the “music” at any time(or even just a prompt play, no need to use getdigits), but then i cant check the db every 5 seconds unless I interrupt the prompt play. Any advice or help would be greatly appreciated.

you can do this easily using FastAGI. Take a look at starpy. starpy.sf.net cause in starpy (Twisted ) asterisk command calls won’t block. So you can do whatever you want while music is being played.


Godson Gera
Asterisk Support Consultant India