No answer or pickup detected on IAX2

I have the following problem that I have not been able to find the answer for. I have a context script that looks like the following:

[theft]
include => acknowledge
include => cancel
exten => s,1,Wait(2)
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s-ANSWER,1,Set(LoopCount=0)
exten => s-ANSWER,n(start),Background(jacklighter/voice_${Caller}_${Mode}) ; Plays theft announcement
exten => s-ANSWER,n(IVR_Select),Background(jacklighter/press1or2) ; Plays IVR menu
exten => s-ANSWER,n,Set(LoopCount=${LoopCount}+1)
exten => s-ANSWER,n,Set(TIMEOUT(digit)=5)
exten => s-ANSWER,n,Set(TIMEOUT(response)=10)
exten => s-ANSWER,n,WaitExten()
exten => 1,1,goto(acknowledge,s,1)
exten => 2,1,goto(cancel,s,1)

; The channel is dead
exten => dead,1,Hangup

; The DIALSTATUS dial states
exten => s-CANCEL,1,Hangup
exten => s-NOANSWER,n,Hangup
exten => s-NOANSWER,n(here),Verbose(1,Need failover)
exten => s-BUSY,1,Busy
exten => s-CHANUNAVAIL,1,Verbose(1,Need failover)
exten => s-CONGESTION,1,Congestion
;****************************************************************************************
; Forced to do the following because the ANSWER/PICKUP state is not present in the ${DIALSTATUS} var.
exten => _s-.,1,Goto(s-ANSWER,1)
exten => s-,1,Goto(s-ANSWER,1)
;****************************************************************************************

exten => i,1,Background(./jacklighter/notvalid)
exten => i,n,gotoif($[${LoopCount} < 3]?theft,s-ANSWER,IVR_Select)
exten => i,n,System(/usr/bin/perl /home/asterisk/perl/callout.pl --id=’${Caller}’ --successful=‘false’ --response=‘0’ --status=’-1’ --starttime=’${StartTime}’ --eventid=’${EventID}’ --output=’/var/spool/asterisk/in/voice_${Caller}Completed.xml’)
exten => i,n,Background(jacklighter/thankyou)
exten => i,n,Background(jacklighter/pleasehangup)
exten => i,n,System(rm -f /var/lib/asterisk/sounds/jacklighter/voice
${Caller}_${Mode}.wav)
exten => i,n,Hangup()
exten => t,1,Background(jacklighter/notreceived)
exten => t,n,gotoif($[${LoopCount} < 3]?theft,s-ANSWER,start)

The debug log shows why the script above looks the way it does. Notice lines 1, 3, & 4 the channel reports answered in line 1 but the ${DIALSTATUS} var is empty in line 3 & 4 forcing me to redirect it to line 5.

  1. [Mar 3 10:04:33] VERBOSE[25841] logger.c: > Channel IAX2/103256-7376 was answered.
  2. [Mar 3 10:04:33] VERBOSE[25841] logger.c: – Executing [s@theft:1] Wait(“IAX2/103256-7376”, “2”) in new stack
  3. [Mar 3 10:04:35] VERBOSE[25841] logger.c: – Executing [s@theft:2] Goto(“IAX2/103256-7376”, “s-|1”) in new stack
  4. [Mar 3 10:04:35] VERBOSE[25841] logger.c: – Goto (theft,s-,1)
  5. [Mar 3 10:04:35] VERBOSE[25841] logger.c: – Executing [s-@theft:1] Goto(“IAX2/103256-7376”, “s-ANSWER|1”) in new stack
  6. [Mar 3 10:04:35] VERBOSE[25841] logger.c: – Goto (theft,s-ANSWER,1)

The script runs flawlessly once I force it to start using:
;****************************************************************************************
; Forced to do the following because the ANSWER/PICKUP state is not present in the ${DIALSTATUS} var.
exten => _s-.,1,Goto(s-ANSWER,1)
exten => s-,1,Goto(s-ANSWER,1)
;****************************************************************************************

Is this a bug or is there some other variable or function to get the correct IAX dial state. Any help would be greatly appreciated so I can take my hack out of my script. The above is designed to create an alert announcement following the execution of an auto-dial-out request from a .call file

Thanks,
Mike

I forgot to mention which version:

Asterisk 1.4.29 built by root @ localhost.localdomain on a x86_64 running Linux 2.6.18-164.11.1.el5 (i.e Centos 5.3)

Mike

I found that the newer version of asterisk includes the AMD() method and rewrote my script the support the Human/Machine detection returned in the ${AMDSTATUS} var which allows me to take my hack out and supports machine detection. So unless there is a better solution I will consider my problem solved but the issue of the ${DIALSTATUS} still remains and should be looked into if anyone cares to do it.

Mike