H extension fails to run System cmd script sometimes

Hi everyone,

I’m trying to track the status of calls with php and a MySQL database by calling a php script with the System cmd when my dialplan goes to the h extension. The System cmd seems to be failing to launch my script sometimes, however. It works sometimes, and not others, and I have yet to determine the pattern. I was just curious if there might be some known issue with trying to use System at the h extension.

As you can see below, I’m trying to capture the hangup event in a number of places, but my finishCall.php that I want to launch still doesn’t run sometimes. Any advice would be greatly appreciated!

Here’s my dialplan code:

[MyContext]
exten => s,1,Set(TIMEOUT(absolute)=600)
exten => s,n,Monitor(wav,recordedFile,m)
exten => s,n,Set(LIMIT_PLAYAUDIO_CALLER=YES)
exten => s,n,Set(LIMIT_PLAYAUDIO_CALLEE=YES)
exten => s,n,Set(LIMIT_CONNECT_FILE=beep)
exten => s,n,Dial(SIP/sip_junction/${DIALTO},30,gL(600000,40000,1500))
exten => s,n,GoTo(MyContext_goodHangup,s,1)
exten => h,1,System(${MAINDIR}/finishCall.php ${QUEUEID} "call complete")

[MyContext_goodHangup]
exten => s,1,Playback(beep)
exten => s,n,System(${MAINDIR}/finishCall.php ${QUEUEID} "call complete")
exten => s,n,Hangup()
exten => h,1,System(${MAINDIR}/finishCall.php ${QUEUID} "call complete")