I'm using Yate 4.2
I wrote simple autoattendant using libyate.php and leavemail.php.
Stock leavemail.php always leaves a never expiring record in cdrbuild module. So I extended leavemail.php with messages chan.startup and chan.hangup.
A problem is that script works as intended only when remote party hangups during recording. But when chan.hangup is emitted during greeting script does not receive chan.hangup: it just gets stdio handles closed and terminates. It even does not receive chan.notify with reason=replace so it have no chance to emit any message.