Dial SIP extension exited non-zero and goes to "h"

I’m using Asterisk 1.2.13.

Dial SIP extension exited non-zero and goes to “h” extension as soon as SIP extension anwers.

I’m trying to figure what is this mean ?

Spawn extension (default, 9112, 2) exited non-zero on ‘Local/9112@default-d238,2’

Why is it going to “h” extension after answering ?.

Your help is greatly appreciated.

Here is my extensions.conf

[general]
static=yes
writeprotect=no

[globals]
CONSOLE=Console/dsp

[default]

exten => h,1,DeadAGI(call_log.agi,${EXTEN}) ; DeadAGI is new
exten => h,2,DeadAGI(VD_hangup.agi,PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})

exten => _91XX,1,AGI(call_log.agi,${EXTEN})
exten => _91XX,2,Dial(SIP/${EXTEN:1},tTo)
exten => _91XX,3,Hangup

exten => 8365,1,Playback(sip-silence)
exten => 8365,2,AGI(call_log.agi,${EXTEN})
exten => 8365,3,AGI(agi-VDADtransfer.agi,${EXTEN})
exten => 8365,4,AGI(agi-VDADtransfer.agi ,${EXTEN})
exten => 8365,6,Hangup

CLI output:

== Manager ‘sendcron’ logged on from 127.0.0.1
– Executing AGI(“Local/9112@default-d238,2”, “call_log.agi|9112”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/call_log.agi
– AGI Script call_log.agi completed, returning 0
– Executing Dial(“Local/9112@default-d238,2”, “SIP/112||tTo”) in new stack
– Called 112
– SIP/112-0848af30 is ringing
– SIP/112-0848af30 answered Local/9112@default-d238,2
> Channel Local/9112@default-d238,1 was answered.
== Manager ‘sendcron’ logged off from 127.0.0.1
– Executing Playback(" Local/9112@default-d238,1", “sip-silence”) in new stack
– Playing ‘sip-silence’ (language ‘en’)
== Spawn extension (default, 9112, 2) exited non-zero on ‘Local/9112@default-d238,2’
– Executing DeadAGI(" Local/9112@default-d238,2", “call_log.agi|h”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/call_log.agi
– Executing AGI(“SIP/112-0848af30”, “call_log.agi|8365”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/call_log.agi
– AGI Script call_log.agi completed, returning 0
– Executing DeadAGI(“Local/9112@default-d238,2”, “VD_hangup.agi|PRI-----NODEBUG-----16-----ANSWER-----14-----0”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/VD_hangup.agi
– AGI Script VD_hangup.agi completed, returning 0
– AGI Script call_log.agi completed, returning 0
– Executing AGI(“SIP/112-0848af30”, " agi-VDADtransfer.agi|8365") in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/agi-VDADtransfer.agi
– parse_srv: SRV mapped to host sphone.vopr.vonage.net , port 5061

Since you are using the h extension you know that asterisk goes there when ever the call is hung up on. I asume that there is a problem with your agi script so asterisk “bails” and ends the call there by going to the h extension. Try putting something else instead of the AGI (like ringing and then a 5 second wait) and see what happens.

Thanks for your reply.
When I manually dial 9112, it works great.
But if I use a script/cron job to do the same thing, it bails out as shown above.
Any clue ?
I appreciate your comments.

Like I said above there is probably an issue with the way you wrote it and something is wrong with it hence why its bailing out. You have to look at it step by step and see why it is happening.

Thank you. I will look into the agi function.