How to make stereo output form monitor

hai

i want to get the output of call recording as stereo with inbound in one channel (say left) and outbound calls in the second channel(say right). i have set the MONITOR_EXEC but not not executing after the call hangup. how can i solve this issue…?

here is my config file

[globals]
MONITOR_EXEC = /bin/2wav2mp3

[test-custom]
exten => 1234,1,answer()
exten => 1234,2,Monitor(wav,most-recent-test-call)
exten => 1234,3,SayDigits(123456789)
exten => 1234,4,Dial(SIP/test)
exten => 1234,5,Hangup()

and 2wav2mp3.sh is

 #!/bin/sh
SOX=/bin/sox
LAME=/bin/lame
LEFT="$1"
RIGHT="$2"
OUT="$3"
test ! -r $LEFT && exit 21
test ! -r $RIGHT && exit 22
$SOX $LEFT -c 2 $LEFT-tmp.wav pan -1
$SOX $RIGHT -c 2 $RIGHT-tmp.wav pan 1
$SOXMIX -v 1 $LEFT-tmp.wav -v 1 $RIGHT-tmp.wav -v 1 $OUT.wav
$LAME -S -V7 -B24 --tt $OUT --add-id3v2 $OUT.wav $OUT.mp3
test -w $LEFT-tmp.wav && rm $LEFT-tmp.wav
test -w $RIGHT-tmp.wav && rm $RIGHT-tmp.wav
test -w $OUT.wav && rm $OUT.wav
test -r $OUT.mp3 && rm $LEFT $RIGHT

why these shell script is not executing when the call is hangup…?

These are different in Linux.