[Asterisk-Users] AGI script question

Steven Critchfield critch at basesys.com
Sat Oct 18 09:57:25 MST 2003


On Sat, 2003-10-18 at 05:23, Jim Paraschou wrote:
> Hi,
> 
>   I am trying to write an AGI script that executes a
> shell command in C ie. ls. I tried VERBOSE AGI command
> or to send the "!command ls" to stderr but the command
> does not execute it just displays on asterisk console.
> Does anybody has any idea about it?

Well using the proper command is important.

*CLI> show Agi verbose
 Usage: VERBOSE <message> <level>
        Sends <message> to the console via verbose message system.
        <level> is the the verbose level (1-4)
        Always returns 1


What about that made you think a command would be run?

*CLI> show agi exec
 Usage: EXEC <application> <options>
        Executes <application> with given <options>.
        Returns whatever the application returns, or -2 on failure to
find application

>From this you might exec a "system ls" command, but I doubt this will do
what you want.


So in the interest of getting to what you want to do. Why do you need to
do a ls, and do you plan on doing anything with the output of the
command? If you plan to do anything with the output of the command, then
you need to ***NOT*** make asterisk do the work via agi. You would
probably need to do this as a local to you application function. Perl
has opendir, readdir, and closedir. I bet there is similar things in C. 
-- 
Steven Critchfield <critch at basesys.com>




More information about the asterisk-users mailing list