TOUCH_EXEC built on a Friday?

Hey guys,

I am puzzled as to why TOUCH_EXEC is not running for me. I am running Asterisk 1.8, and my outbound extension looks like this:

exten =>_1NXXNXXXXXX,1,Set(DYNAMIC_FEATURES=automon) exten =>_1NXXNXXXXXX,n,Set(TOUCH_EXEC=/loadcall.sh ^{MONITOR_FILENAME}) exten =>_1NXXNXXXXXX,n,Set(TOUCH_MONITOR_FORMAT=WAV) exten =>_1NXXNXXXXXX,n,Set(TOUCH_MONITOR=accountcode[${CDR(accountcode)}]date[${STRFTIME(${EPOCH},,%Y-%m-%d)}]from[${CALLERID(num)}]to[${EXTEN}]) exten =>_1NXXNXXXXXX,n,DIAL(SIP/trunk/${EXTEN}, 60, W) exten =>_1NXXNXXXXXX,n,Hangup

Log is showing this:

-- SIP/trunk-0137a910 is making progress passing it to SIP/7940-cc0e01f0 -- SIP/trunk-0137a910 answered SIP/7940-cc0e01f0 -- User hit '*1' to record call. filename: WAV|auto-1289541385-accountcode[0123456789]date[2010-11-12]from[8005551212]to[19055551212]|m [Nov 12 05:56:27] NOTICE[25879]: res_monitor.c:339 ast_monitor_stop: monitor executing ( nice -n 19 sox -m "/var/spool/asterisk/monitor/auto-1289541385-accountcode[0123456789]date[2010-11-12]from[8005551212]to[19055551212]-in.WAV" "/var/spool/asterisk/monitor/auto-1289541385-accountcode[0123456789]date[2010-11-12]from[8005551212]to[19055551212]-out.WAV" "/var/spool/asterisk/monitor/auto-1289541385-accountcode[0123456789]date[2010-11-12]from[8005551212]to[19055551212].WAV" && rm -f "/var/spool/asterisk/monitor/auto-1289541385-accountcode[0123456789]date[2010-11-12]from[8005551212]to[19055551212]-"* ) & == Spawn extension (outbound-on, 19055551212, 5) exited non-zero on 'SIP/7940-cc0e01f0'

Any thoughts or ideas are gladly welcomed. :astonished:

It seems prefixing TOUCH_EXEC with an underscore solves this issue. Set(_TOUCH_EXEC=/yourscript.sh) works beautifully. We’re off to the races now!