Asterisk variables empty

Hi. I’m trying to execute a PHP AGI script and I need to pass call length on hangup. Unfortunatelly the global variable ANSWEREDTIME is always empty.

Here it is a part of my dialplan:

exten => h,1,NoOp(Callee hung up call before menu. Dialed: ${DIAL}  ID: ${ID}.)
exten => h,2,Set(STATUS='EarlyHangup'|g)
exten => h,4,DeadAGI(emessage-vm-notification.php|${ID}|${STATUS}|${DIAL}|${ANSWEREDTIME}|${SIP_CODEC})
exten => h,5,Hangup

And here it is a debug log:

[quote] – Executing [h@broadcast-it-emessage:1] NoOp(“SIP/Messagenet (5317132)-b7a2d3f8”, “Callee hung up call before menu. Dialed: 3450457514 ID: CBFC884D-1C0B-4E74-250F-48ABBC6FA023.”) in new stack
– Executing [h@broadcast-it-emessage:2] Set(“SIP/Messagenet (5317132)-b7a2d3f8”, “STATUS=EarlyHangup|g”) in new stack
== Setting global variable ‘STATUS’ to ‘EarlyHangup’
– Executing [h@broadcast-it-emessage:3] NoOp(“SIP/Messagenet (5317132)-b7a2d3f8”, “ANSWEREDTIME=”) in new stack
– Executing [h@broadcast-it-emessage:4] DeadAGI(“SIP/Messagenet (5317132)-b7a2d3f8”, “emessage-vm-notification.php|CBFC884D-1C0B-4E74-250F-48ABBC6FA023|EarlyHangup|3450457514||”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/emessage-vm-notification.php[/quote]

As you can see ${ANSWEREDTIME} is empty (${SIP_CODEC} too). I’ve tried other variables but woth no success. Can you help me?

What about ${CDR(billsec)} ?