Adding lots of phones to asterisk

I’m working on a project where I need to add a huge amount of phones on one Asterisk server and I need some help.

Let’s say I want to add 1000 SIP phones. I will need to add them to both sip.conf, and extensions.conf
First of all, is there a way in asterisk so that i wouldn’t have to add 1000 entries in the files. Isn’t there a way to say, for example “add peers from 1 to 1000” ? Do i really need to add all 1000, one by one? It would also make the files very large and it’s not a good practice.

Also, Asterisk works with config files and it would read sip.conf to get the information it needs. So now that I have added 1000 (After a long time that takes to add them all), let’s say i want to make a small change to one phone and for example add a secret to it. Then I would have reload sip, and that’s where it all goes wrong. Asterisk tries to add ALL 1000 entries all over again. And that will happen every time I need to make a change to file.

So I would like to know if I’m doing it wrong, and THERE IS actually a better way to add this amount.

by the way, 1000 is not really that huge, it was just for the sake of example.


Use The Asterisk Realtime Architecture (ARA) , then use your favorite language to add all the peers into the database using a loop function. Later, to edit the peer just call the ID of that peer.

Also if you want to avoid the DB you can use a bash, python, php script to add recursively into conf files.

1 Like

Also, although it goes against security advice, many people make the device name the same as the extension number, so that you can use one pattern matching extensions.conf entry for all the local devices.

By the way, when you reload a configuration file, Asterisk normally tries to detect unchanged entries,

This seems like exactly what I’m looking for. Actually before this, i was trying to find (or even make) to set configuration like the way we can add dialplan from asterisk cli.

Thanks :slight_smile:

You can apply templates to configuration files in Asterisk, That’s a great way to save on data entry if your endpoints have the same settings for the most part.

You can use pattern matches to make it easy to add ranges of extensions.

The WIKI has more information at