Sample Config Files Installed To /etc

Home » Asterisk Users » Sample Config Files Installed To /etc
Asterisk Users 2 Comments

The sample config files in the Asterisk distribution and packages are really good for getting the demo up and running quickly, for example, to extend the demo to run behind a WebRTC proxy only required about 6 lines of extra code to define a peer in sip.conf and enable TCP

However, I’m not sure that they should be installed by default by packages.

Most package managers provide a way to diff the files and merge new config options that appear in a new release

However, because a lot of things have to be ripped out of the default config to harden it and disable the demo, a simple diff doesn’t really help somebody upgrading to a new version, because usually they’ve altered the files quite dramatically

I’d suggest that the config for the demo could be placed under
/usr/share/asterisk/samples while the configs installed to /etc/asterisk should be fairly minimal

My own workaround at the moment involves tracking the released configs in a git repository and tracking my changes on a branch. However, working with the package manager diff output would help a lot more people and make it much more like other packages they are familiar with.

2 thoughts on - Sample Config Files Installed To /etc

  • The “sample” config files are mostly reference. They are also examples for some sorts. But they are the best documentation installed in a typical installation.

    Rather: dpkg is rather unique with this feature, IIRC.


    Some folks like the value of /var/lib/asterisk for astdatadir.

    To complement that you’d need to have a simple way to revert back to the
    “standard” configuration.

    Do you think it’s a good idea to have asterisk look at
    $astdatadir/configs/ first if the file in $astetcdir does not exist?

    Failing that, you could use something along the lines of

    #include /path/to/astdatadir/configs/.conf
    [content to override]

    This could be handy for the likes of cli_aliases.conf and say.conf where you really don’t like to start from scratch.

    Do you think it would be a good idea to have a directive that will include a file from under $astdatadir/configs , so the above would become:

    #includedef ali_aliases.conf
    template = myown

    restart now = core stop now

    The downside of this is that on upgrades you don’t see the real changes.

  • There is a better way. Right now asterisk can be called with a custom location for the primary config (-C option). If there was also a configuration command to redirect any other file then administrators could create their own versions of configs, probably in their own versioning system, and point to it from the main config. That way the installation directories never need to be written to and new versions can overwrite existing files without affecting the operation.

    I realize that you can set astetcdir to another location in your custom asterisk.conf but that means keeping copies of all the configs elsewhere. I just want to keep copies of configs that I have modified.