Is it possible to hook onto events  using esl in ruby. I am getting <defunct> ruby processes.

I think this is happening because when a call is hung up it causes my script to terminate there and then and the ruby child processes are not being closed/cleaned up properly. While this does not stop new incoming calls because new fork process is spwaned I need a more gracefull handling when a call ends. I think I could do something if I can collect the hangup event.

Is  event hook/handler possible in esl?