AGISTATUS bug in Asterisk 1.6.1.8

Hi All,

I was just verifying different states of AGISTATUS variable i.e SUCCESS,FAILURE,NOTFOUND and HANGUP. I have noticed a weird behaviour in one of my test cases. In this test case, I am trying to hang up call (from caller side) while it is in AGI script. I got AGISTATUS as FAILURE when I was expecting HANGUP. Below I am putting a simple context and script to repeat the bug.

[test]
exten => _CALL-.,1,Answer()
exten => _CALL-.,n,AGI(agi-test.php)
exten => _CALL-.,n,NoOp(foo)
exten => _CALL-.,n,Hangup()
exten => h,1,NoOp(${AGISTATUS})

agi-test.php

#!/usr/bin/php

<?php sleep(7); ?>

Any help/advice would be very much appreciated.