[asterisk-users] [AGI 1.4] C sample?

Steve Edwards asterisk.org at sedwards.com
Sun Jan 27 13:37:14 CST 2008


On Sun, 27 Jan 2008, Vincent wrote:

> If someone has an idea why it's required to use a full path for the
> file to be written, I'm interested.

If you don't specify a path, the current working directory of the 
executing process is used. So, the question is, what is the CWD of your 
AGI process? Unless you change it in your AGI, it will be the CWD of the 
parent, Asterisk.

To see what the CWD is, try something like this, either from your dialplan 
or your AGI.

 	system(set >/tmp/my-environment)
 	system("set >/tmp/my-environment");

Here's a snippet from my /etc/init.d/asterisk file:

                         env --ignore-environment\
                                 DATABASE-DATABASE=$DATABASE_DATABASE\
                                 DATABASE-PASSWORD=$DATABASE_PASSWORD\
                                 DATABASE-SERVER=$DATABASE_SERVER\
                                 DATABASE-USER=$DATABASE_USER\
                                 HOST=$HOST\
                                 PATH=/usr/local/bin/:/bin/\
                                         $ASTERISK $START_OPTIONS

Thus, nothing that I don't know about is in Asterisk's environment. And 
no, I'm not a control freak. Honestly. No, I mean it.

Thanks in advance,
------------------------------------------------------------------------
Steve Edwards      sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                             Fax: +1-760-731-3000



More information about the asterisk-users mailing list