Using WaitForRing application

Waitforring returns 0 on success or -1 on failure.
How do I capture this return value to use it in my dialplan?

I would like to hangup on failure or go to a timeout extension.
If it succeeds, I want to keep going through my dialplan.

thanks!