Configuration files such as sip.conf,
iax.conf etc. can have hundreds of
entries; such files are difficult to maintain.
Take a typical sip.conf, for
example:
[201] username=201 secret=1111 context=default type=friend qualify=yes host=dynamic canreinvite=no [202] username=202 secret=2222 context=default type=friend qualify=yes host=dynamic canreinvite=no [203] username=203 secret=3333 context=default type=friend qualify=yes host=dynamic canreinvite=no
There is another way. Asterisk offers the little-known support for
templates! Using a template, our sip.conf would look
like this instead:
[my-phones](!) ; This entry is the template context=default type=friend qualify=yes host=dynamic canreinvite=no [201](my-phones) ; Station 201 username=201 secret=1111 [202](my-phones) ; Station 202 username=202 secret=2222 [203](my-phones) ; Station 203 username=203 secret=3333
This is particularly useful when you have groups or classes of
stations with very similar characteristics; that is, in cases where it isn't
possible to put all the common parameters in the [general]
section. Even in this small and simple example, we've managed to save a few
lines and centralize future changes to the "class"
my-phones.