install.md - custompbx/custompbx GitHub Wiki

Installation Guide

1. Obtain and Install Dependencies

1.1. CustomPBX Binary

1.2. FreeSWITCH

  • Install FreeSWITCH on your server.

1.3. Postgres

  • Install Postgres on your server.

2. Set Up Postgres User and Database

Run the following commands to create a Postgres user and database:

sudo -u postgres createuser <username>
sudo -u postgres createdb <dbname>
sudo -u postgres psql -c "ALTER USER <username> WITH ENCRYPTED PASSWORD '<password>'"
sudo -u postgres psql -c "ALTER ROLE <username> WITH LOGIN"
sudo -u postgres psql -c "GRANT ALL ON SCHEMA public TO <username>"
sudo -u postgres psql -c "GRANT all PRIVILEGES ON DATABASE <database> TO <username>"

3. Configure CustomPBX

3.1. Add CustomPBX Binary and Configuration

  • Copy the cpbx binary to your server.
  • Create a config.json file or run and stop cpbx to auto-generate it.
  • Adjust the parameters in config.json according to your setup.
  • Ensure that the configurations in config.json accurately reflect your FreeSWITCH and database setup.

Sample config.json:

```json
{
    "freeswitch": {
        "switchname": "freeswitch1",
        "esl": {
            "host": "127.0.0.1",
            "port": 8021,
            "pass": "ClueCon",
            "timeout": 10,
            "collect_logs": 7
        }
    },
    "webserver": {
        "route": "/ws",
        "host": "127.0.0.1",
        "port": 8080,
        "stun_port": 3478,
        "cert_path": "/etc/freeswitch/tls/wss.pem",
        "key_path": "/etc/freeswitch/tls/wss.pem"
    },
    "xml_curl_server": {
        "route": "/conf/config",
        "host": "127.0.0.1",
        "port": 8081,
        "cert_path": "/etc/freeswitch/tls/wss.pem",
        "key_path": "/etc/freeswitch/tls/wss.pem"
    },
    "database": {
        "name": "custompbx",
        "host": "127.0.0.1",
        "port": 5432,
        "user": "custompbx",
        "pass": "custompbx"
    }
}
```

4. Connect FreeSWITCH to CustomPBX

  • Uncomment mod_xml_curl in modules.conf in the FreeSWITCH configs directory for enabling the module.
  • Add the following line to the configuration: <param name="gateway-url" value="https://<xml_curl_server.host>:<xml_curl_server.port>/<xml_curl_server.route>" bindings="configuration|directory|dialplan"/>.
  • Load or reload mod_xml_curl.

5. Start CustomPBX

Run CustomPBX, and observe the common startup output.

CustomPBX development version: 0.0.1
Starting...
DB
Events Handler
Cache
ESL Connection and handlers
FS logs collecting
HEP collecting
Connection to ESL
Web Handlers
Secure Web Server
Secure XMLCurl Server
STUN Server

6. Access CustomPBX Interface

  • Open https://<webserver HOST>:<webserver PORT>/cweb.
  • Default credentials: Login: admin, Password: admin.
login
You will see dashboard as first page more data will appear on it after you import or create direcoty and sofia configs.

7. Change Default Password

  • Navigate to settings as shown in the screenshot.
  • Change the default password.
new password

8. Import or Create FreeSWITCH Configs

Not imported configs will return will be served with existing static XML config files.

⚠WARNING: on importing configs right from FreeSWITCH all global variables will be resolved into their values.

8.1. Import Directory

  • Go to Directory > Domains and press import.
  • Or add new domains from scratch.
directory import

8.2. Manage Modules and Dialplan

  • Import or create configs.
  • Manage modules and dialplan similarly using the provided screenshots.
manage modules manage dialplan
⚠️ **GitHub.com Fallback** ⚠️