Time out not working when using the G option

That would depend on the detailed requirement, but you might want to look at:

https://wiki.asterisk.org/wiki/display/AST/Function_TIMEOUT