API shell

I have tried the following:-

Action: Command
COMMAND: !CP …

This results in a command not available.

Is it possible to shell to Linux as I really need to copy a configuration file to the FTP directory and then use an FTP client to get it back onto my local machine for analysis.

If not, is it possible to change the FTP home directory to the root and have access to all Asterisk configuration files. This is the best solution if it’s possible.

Thanks

It is not clear what you are actually trying to do. If you need to change security/directory settings for FTP, that is fine, as Asterisk is not directly involved. If you are trying to use a shell command form within Asterisk, have a look at the System() command:

voip-info.org/wiki-Asterisk+cmd+System

MuppetMaster,

I am writing a program that utilises the API Manager using sockets to control a SIP phone and monitor various other Asterisk bits.

I need to get an Asterisk configuration back to I can read it in my program.

If I knew how to change the home directory of the FTP server installed as part of the Asterisk@Home CD to be the root directory, I would be able to use FTP to transfer the Asterisk configuration file or any other file on the Asterisk Server.

If there’s no way to change the FTP home directory, I need to use a socket and run an API shell command to copy the file from \etc\asterisk to the ftp config directory and then use FTP to get it back on my local machine.

The system command runs in a dial plan and is not in the right place for what I want to achieve.

Thanks for your help.

Yes, you may change where Asterisk picks up its config files in /etc/asterisk/asterisk.conf. Just drop them somewhere in your FTP heirarchy and pick them up there.

Alternative, you could switch to Asterisk Realtime configuration and read it all from a database.

voip-info.org/wiki-Asterisk+RealTime

MuppetMaster,

Thanks for the information.

I copied the files into /var/ftp/asterisk and changed the asterisk.conf as you suggest. I left a copy of asterisk.conf in /etc/asterisk and /var/ftp/asterisk as I don’t know if it will always look in /etc/asterisk first.

I rebooted the Asterisk server, however I have got strange results.

It automatically recreated the following files in /etc/asterisk:-

extensions_additional.conf
iax_additional.conf
meetme_additional.conf
sip_additional.conf
zapata_additional.conf

Don’t know how or why it did that…

Although I haven’t changed anything, when I go into the Setup tab of the web interface, it now says in red “You have made changes - when finished, click here to APPLY them”.

If I click Re-Read Configs in the web interface, I get:-

Access file: /etc/asterisk/manager.confnot found!

Am I missing something here or is this an untested technique?

Thanks

Are you using Asterisk@Home or Asterisk ‘core’? My recommendation was based on using native Asterisk, if A@H, then not sure…

Yes, I’m using *@H.

I’ll try a new idea I’ve got.

Thanks.