For a long time, I've wanted my system to play a wav file instead of that dumb little console beep which always happens when someone talks me. So finally I decided to do something about it. The result is a function added and a couple of lines changed to one of the source files (announce.c) for talkd. All it does is check to see if you have an executable file called .talk_notify in your home directory. If the file is there, the program calls setuid (to avoid security problems) to the user being talked and runs the script. To use it, just make .talk_notify a shell script and have it run your wav player (or whatever else you want it to do). I also made it pass user@wherever as a command line parameter to make it possible to take different actions based on who is calling.
Note: I am not a security expert. To the best of my knowlegde, this modification should not compromise the security of your system or files, but I COULD BE WRONG. Therefore, I take no responsibity if you run this program and it crashes your machine, allows a cracker access to your root account, or otherwise endangers you or your loved ones. USE AT YOUR OWN RISK.
That said, here it is:
complete talkd source with modifications
modified version of announce.c (the only file modified)
modified talkd binary (normally this will replace /usr/sbin/in.talkd)