[Resolved...Sort of]Validating a Recording

I hope this hasn’t been asked before (I couldn’t find it).

I’m building a small IVR script and I would like to prompt a caller to answer a few questions to continue. The only real validation I expect to be able to do right now is to check the size of the file created (but I’m open to other possible solutions).

So what I’m doing now is this:

exten => s,n,TrySystem(rm ${RecPath} -f)
exten => s,n,Record(${RecPath}:gsm|${MaxSilence}|${MaxDuration})
exten => s,n,System(temp=${du ${RecPath} -h})
exten => s,n,NoOp(-------------------------temp value=${temp})

So my thought here is that I could simply fire a shell command [du] to get the file size. System (and TrySystem) only returns 0 or -1 (if it fails). I could even write it to a small temp file but I can’t find any command to read data from a file.

If the only solution for this is the AGI, I could go that route, but so far I’ve managed to dodge that learning-curve-bullet. Any suggestions would be really apreciated.

if you want to get the size of the file I think agi might be your answer… why do you care how big the file is though? Are you trying to get around someone who will press like #######000 to try and get a human?

I just want to validate that some audio was recorded. That’s it. I looked into AGI a little and it looks like a lot of work just to pass a variable back to the app (which I couldn’t verifiy that it could even do).

It’s probably the route I’ll need to take.

Chris64 take a look here
forums.digium.com/viewtopic.php? … highlight=

OK, well my book didn’t include a command that would have really helped…ReadFile.

So here was my solution. I’m not claiming that it’s the most elegant way to do it but it seems to work.

exten => s,n,TrySystem(rm ${RecPath} -f)
exten => s,n,Record(${RecPath}:gsm|${MaxSilence}|${MaxDuration})
exten => s,n,System(du ${RecPath}.gsm -h > ${FilePath}temp_${UNIQUEID})
exten => s,n,ReadFile(filesizeimage=${FilePath}temp_${UNIQUEID},99)
exten => s,n,TrySystem(rm ${FilePath}temp_${UNIQUEID} -f)
exten => s,n,Set(filesize=${CUT(filesizeimage,K,1)})
exten => s,n,NoOp(------------------------Recording Size:${filesize})

So there you have it…the filesize in KB! And, no AGI! WooHoo!