AGI Exec Command

Home » Asterisk Users » AGI Exec Command
Asterisk Users 1 Comment


I’m trying to understand how AGI works. I’m using php-agi library from

*CLI> agi show commands
Yes exec Executes a given Application

*CLI> core show application set

My PHP-AGI script contains:

$AGI->exec(“Set”, “CUSTOM_VAR=2”);
$AGI->exec(“NoOp”, “\”DEBUG – ${CUSTOM_VAR}\””);

An AGI debug from *CLI shows:

AGI Rx << EXEC Set CUSTOM_VAR=2 -- AGI Script Executing Application: (Set) Options: (CUSTOM_VAR=2) AGI Tx >> 200 result=0
AGI Rx << EXEC NoOp "DEBUG - " -- AGI Script Executing Application: (NoOp) Options: (DEBUG - ) Why isn’t CUSTOM_VAR set? I know I could use agi command “set variable” but I’d like to know why the above code doesn’t seem to work. Also, there’s no AGI-specific command for NoCDR(). So I did something like this: $AGI->exec(“NoCDR”, “”);

but the CDR was written to cdr-csv/Master.csv so I’m assuming I’m doing something wrong with the “agi exec command”.

Any ideas?



One thought on - AGI Exec Command