Hairpin problem when hangup on the pstn side

Hi,

I’m doing hairpin (connecting 2 e1 slots together), on two separate E1s, one to the PSTN and the other to a pbx.

exten =>_X.,1,Answer
exten =>_X.,2,Dial(Zap/g1/${EXTEN},tTrhH)
;exten =>_X.,3,wait,5

exten =>_X.,3,system(/bin/echo -e “’${DIALEDTIME},${ANSWEREDTIME},${TIMESTAMP},${CALLERID},${EXTEN},${CHANNEL}’” >> /home/mque/E1/list_calls)
exten =>_X.,4,Congestion

My problem is if the call gets hung up on a voip extension of the *, it works fine.
BUT if the pstn caller hangs up, the next line after the dial doesn’t get executed (Dial shows non zero result)

so the system(…) line only get’s executed when the internal caller hangs up.

what am I missing?

this is my /var/log/asterisk/full file

(there are a couple of lines I took out from the extensions.conf to make in more readable, which will show on the log)

2006-07-25 08:32:59 VERBOSE[26148] logger.c: – Zap/32-1 answered Zap/17-1
2006-07-25 08:32:59 DEBUG[26148] chan_zap.c: Requested indication -1 on channel Zap/17-1
2006-07-25 08:32:59 VERBOSE[26148] logger.c: – Attempting native bridge of Zap/17-1 and Zap/32-1
2006-07-25 08:33:04 VERBOSE[26047] logger.c: – Channel 0/17, span 1 got hangup request
2006-07-25 08:33:04 DEBUG[26148] channel.c: Didn’t get a frame from channel: Zap/17-1
2006-07-25 08:33:04 DEBUG[26148] channel.c: Bridge stops bridging channels Zap/17-1 and Zap/32-1
2006-07-25 08:33:04 DEBUG[26148] chan_zap.c: Set option AUDIO MODE, value: ON(1) on Zap/32-1
2006-07-25 08:33:04 DEBUG[26148] chan_zap.c: Hangup: channel: 32 index = 0, normal = 50, callwait = -1, thirdcall = -1
2006-07-25 08:33:04 DEBUG[26148] chan_zap.c: Not yet hungup… Calling hangup once with icause, and clearing call
2006-07-25 08:33:04 DEBUG[26148] chan_zap.c: disabled echo cancellation on channel 32
2006-07-25 08:33:04 DEBUG[26148] chan_zap.c: Set option TDD MODE, value: OFF(0) on Zap/32-1
2006-07-25 08:33:04 DEBUG[26148] chan_zap.c: Updated conferencing on 32, with 0 conference users
2006-07-25 08:33:04 DEBUG[26148] chan_zap.c: Set option AUDIO MODE, value: OFF(0) on Zap/32-1
2006-07-25 08:33:04 DEBUG[26148] chan_zap.c: disabled echo cancellation on channel 32
2006-07-25 08:33:04 VERBOSE[26148] logger.c: – Hungup 'Zap/32-1’
2006-07-25 08:33:04 DEBUG[26148] app_dial.c: Exiting with DIALSTATUS=ANSWER.
2006-07-25 08:33:04 VERBOSE[26148] logger.c: == Spawn extension (pri_publico, 7516, 3) exited non-zero on 'Zap/17-1’
2006-07-25 08:33:04 DEBUG[26148] pbx.c: Function result is '2343085’
2006-07-25 08:33:04 DEBUG[26148] pbx.c: Function result is '2343085’
2006-07-25 08:33:04 DEBUG[26148] pbx.c: Function result is '7516’
2006-07-25 08:33:04 DEBUG[26148] pbx.c: Function result is 'pri_publico’
2006-07-25 08:33:04 DEBUG[26148] pbx.c: Function result is 'Zap/17-1’
2006-07-25 08:33:04 DEBUG[26148] pbx.c: Function result is 'Zap/32-1’
2006-07-25 08:33:04 DEBUG[26148] pbx.c: Function result is 'Dial’
2006-07-25 08:33:04 DEBUG[26148] pbx.c: Function result is 'Zap/g1/7516||tTrhH’
2006-07-25 08:33:04 DEBUG[26148] pbx.c: Function result is '2006-07-25 08:32:59’
2006-07-25 08:33:04 DEBUG[26148] pbx.c: Function result is '2006-07-25 08:32:59’
2006-07-25 08:33:04 DEBUG[26148] pbx.c: Function result is '2006-07-25 08:33:04’
2006-07-25 08:33:04 DEBUG[26148] pbx.c: Function result is '5’
2006-07-25 08:33:04 DEBUG[26148] pbx.c: Function result is '5’
2006-07-25 08:33:04 DEBUG[26148] pbx.c: Function result is 'ANSWERED’
2006-07-25 08:33:04 DEBUG[26148] pbx.c: Function result is 'DOCUMENTATION’
2006-07-25 08:33:04 DEBUG[26148] pbx.c: Function result is '(null)'
2006-07-25 08:33:04 DEBUG[26148] pbx.c: Function result is '1153837976.4’
2006-07-25 08:33:04 DEBUG[26148] pbx.c: Function result is '(null)'
2006-07-25 08:33:04 DEBUG[26148] chan_zap.c: Set option AUDIO MODE, value: ON(1) on Zap/17-1
2006-07-25 08:33:04 DEBUG[26148] chan_zap.c: Hangup: channel: 17 index = 0, normal = 35, callwait = -1, thirdcall = -1
2006-07-25 08:33:04 DEBUG[26148] chan_zap.c: Not yet hungup… Calling hangup once with icause, and clearing call
2006-07-25 08:33:04 DEBUG[26148] chan_zap.c: disabled echo cancellation on channel 17
2006-07-25 08:33:04 DEBUG[26148] chan_zap.c: Set option TDD MODE, value: OFF(0) on Zap/17-1
2006-07-25 08:33:04 DEBUG[26148] chan_zap.c: Updated conferencing on 17, with 0 conference users
2006-07-25 08:33:04 DEBUG[26148] chan_zap.c: Set option AUDIO MODE, value: OFF(0) on Zap/17-1
2006-07-25 08:33:04 DEBUG[26148] chan_zap.c: disabled echo cancellation on channel 17
2006-07-25 08:33:04 VERBOSE[26148] logger.c: – Hungup 'Zap/17-1’
2006-07-25 08:33:05 DEBUG[26040] chan_sip.c: Stopping retransmission on ‘673f2e381307c4c826724b1664eb6eb2@10.0.0.66’ of Request 102: Match Found

to complete my question:

the situation has nothing to do with the hairpin event, it also happens when calling a voip extension.

if the E1 slot hangs up first, the next dialplan command does not get executed,

this is the actual message:

== Spawn extension (pri_public, 7575, 3) exited non-zero on ‘Zap/6-1’

How can I execute the next line after the dial?