diff --git a/.env.example b/.env.example index 03fc2c8..d3d39be 100644 --- a/.env.example +++ b/.env.example @@ -5,7 +5,6 @@ FREEPBX_CLIENT_SECRET=your_freepbx_client_secret DB_HOST=your_db_host DB_USER=your_db_user DB_PASS=your_db_password -DB_NAME=your_db_name DISCORD_TOKEN=your_discord_token OWNER_ID=your_owner_id EXTENSION_ROLE_ID=your_extension_role_id diff --git a/README.md b/README.md index 58356bf..7f65ef3 100644 --- a/README.md +++ b/README.md @@ -33,63 +33,34 @@ To set up the config file, follow the steps below: npm install --save ``` -3. Create a new file named `config.json` in the root directory of the project and fill it with the following content: - ```json - { - "ntfyUrl": "ntfy-url", - "freepbx": { - "server": "sip-server-ip", - "url": "pbx-api-url", - "clientid": "gql-client-id", - "allowedscopes": "gql", - "secret": "gql-secret", - "startExt": 1000 - }, - "discord": { - "token": "bot-token", - "guildId": "guild-id", - "roleId": "user-role", - "logId": "log-channel", - "extList": "extension-list-channel", - "developers": [ - "your-user-id" - ] - }, - "mariadb": { - "host": "db-hostname0here", - "user": "bot", - "password": "bot", - "database": "asterisk", - "connectionLimit": 5 - }, - "cdrdb": { - "host": "db-hostname-here", - "user": "bot", - "password": "bot", - "database": "asteriskcdrdb", - "connectionLimit": 5 - }, - "status": { - "interval": 60, - "url": "uptime-kuma-link" - } -} - ``` -4. Replace the placeholders with your own values: - - `ntfyUrl`: The URL of the NTFY server. - - `sip-server-ip`: The IP address of the SIP server. - - `pbx-api-url`: The URL of the FreePBX API. - - `gql-client-id`: The client ID for the GraphQL API. - - `gql-secret`: The secret for the GraphQL API. - - `bot-token`: The token of the Discord bot. - - `guild-id`: The ID of the Discord guild. - - `user-role`: The ID of the role that users must have to use the bot. - - `log-channel`: The ID of the channel where logs will be sent. - - `extension-list-channel`: The ID of the channel where the extension list will be sent. - - `your-user-id`: Your Discord user ID. - - `db-hostname-here`: The hostname of the MariaDB server. - - Use `mysql -u root -p -e "CREATE USER 'bot'@'localhost' IDENTIFIED BY 'bot';"` to create a new user. Change `localhost` to the IP of the server running the bot if you aren't running the bot on the PBX server. - - `uptime-kuma-link`: The URL of the Uptime Kuma instance. +3. Copy `.env.example` to `.env` + +4. Configure the `.env` file with the following options: + +PBX_HOSTNAME: This is the hostname or IP address of your PBX (Private Branch Exchange) server. It is used to connect to the PBX system. This value is whats sent to the end users via the bot. Can be whatever and won't affect the functionality of the bot. + +FREEPBX_URL: Base URL for the API of your PBX. i.e. `https://pbx.example.com` + +FREEPBX_CLIENT_ID: This is the client ID used for authenticating with the FreePBX API. It is part of the OAuth2 authentication process. + +FREEPBX_CLIENT_SECRET: This is the client secret used along with the client ID for authenticating with the FreePBX API. + +DB_HOST: This is the hostname or IP address of your database server. It is used to connect to the database. If running on your PBX, set to `127.0.0.1` + +DB_USER: This is the username used to authenticate with the database. + +DB_PASS: This is the password used to authenticate with the database. + +DISCORD_TOKEN: This is the token for your Discord bot. It is used to authenticate the bot with the Discord API. + +OWNER_ID: This is the Discord user ID of the bot owner. It can be used to grant special permissions or access to the bot owner. + +EXTENSION_ROLE_ID: Discord role ID of the role to give PBX users when they make their extension. + +DISCORD_GUILD: This is the Discord server (guild) ID where the bot will operate. This is used to determine if extensions are orphaned, so make sure it's set correctly. + +These environment variables are used to configure your application and provide necessary credentials and settings for connecting to various services. Make sure to keep this information secure and do not share it publicly. + 5. Run the bot: ```shell node .