Deploying 3CX and Provisioning Settings Automatically via setupconfig.xml
On this topic
It is possible to launch and automatically configure 3CX by creating an answer file - this is nothing more than all the questions that the 3CX command line tool asks you, all pre-populated in an XML file. You can get this XML file and put it either inside the host or in Cloud.Init and 3CX will run through all the questions automatically. You basically end up from nothing to a fully configured 3CX in no time!
It is also possible to include extensions, SIP Trunks and DIDs during installation.
This is how it will work:
You can prepare the xml and put it on the computer before 3CX is installed
- Download this sample Setup Template XML File.
- Create the configuration manually by filling in all the details required.
- Place setupconfig.xml on the host machine:
- For Linux place the file in /etc/3cxpbx/setupconfig.xml.
- For Windows place file in C:\ProgramData\3CX\Data\setupconfig.xml
- When 3CX is installed, the command line wizard will check the above locations and if it sees “setupconfig.xml” it will automatically process it.
Note: Instead of copying the file you can also use Cloud Init by copying the contents of the xml and paste it in the Advanced / User data section. Below is an image of Amazon AWS cloud-init.
Example of Cloud.init
How to include setupconfig in cloud init.
Download cloudinit sample.
Setupconfig is split in 4 sections:
<tcxinit> This is the initial phase of the PBX Configuration tool. In here we will fill in the answers to the questions asked in the PBX or Web configuration tool example License or Backup file path, Network settings, Public IP, FQDN, 3CX FQDN or Custom FQDN, Hostname, Local DNS, Http/s ports.
<mcwizard> This is the second part where the answers correspond to the questions asked in the initial Management console Wizard example Extension length, mail server, timezone, country, and license information.
<extensions> this is the part where extensions are declared and created.
<siptrunk> This is where SIP Trunks and DID’s are created with a subnode for <inboundrules> to create Inbound routing associated with the DID of that SIP Trunk.
<OutboundRules> This is the section where outbound rules are created.
Configuration of the wizard
This is an xml that corresponds to the questions asked in the Management console wizard:
To populate <CountryName>, <TimezoneId> and <LicenseCountry> refer to this list and select from appropriate columns:https://www.3cx.com/wp-content/uploads/2016/11/Time-Zone-Sheet1-1.pdf
Example if you are in Mexico, after referring to the pdf you should end up with the following configuration:
Adding Extensions, SIP Trunks, DID’s and outbound rules
In this section we will add extensions, SIP Trunks, Inbound rules and outbound rules to the setup configuration file.
You can also provision an IP Phone to an extension. The XML node will ask you for some file name information which you can get from this here:
Example: if you have a snom 720 then you find “snom 720” in the Model name and see what the corresponding template file name will be - in this case “snom.ph.xml”. Enter the information in the corresponding xml tag.
Creating an Extension
Creating a SIP Trunk, DID’s and Inbound rules
Creating Outbound rules with backup routes
Importing SSL Certificates
This is a small example showing how we would include SSL certificate information to setupconfig.xml. This example shows only the parts relevant to SSL. Also different types of certificates require differnet xml nodes to be configured. Example CertificatePath is used in all. But CertificatePassword only pfx.