AGI return codes

After calling an agi script, is there any way that I can get the return result of the script in the dialplan?

Example: [quote]Script agi://localhost/somescript.agi completed, returning 0[/quote]

How can I get the 0? Thanks

Normally agi returns value in a variable called AGISTATUS. This value can be one of below values.

SUCCESS
FAILURE
HANGUP

If the script exits successfully even if it has not performed the intended operation, the AGISTATUS will always return SUCCESS (0). So if you need to return some other status then you will have to use some value other than 0, for example -1