Find a file
2025-01-25 12:27:35 -07:00
interactionHandlers More page stuff 2025-01-25 12:27:35 -07:00
migrations Checkpoint; Full rewrite is underway, this shouldn't take long! 2025-01-25 07:40:09 -07:00
.env.example A lotta stuff 2025-01-25 11:49:40 -07:00
.gitignore Checkpoint; Full rewrite is underway, this shouldn't take long! 2025-01-25 07:40:09 -07:00
commands.js Add paging stuff 2025-01-25 12:27:13 -07:00
freepbx-manager.service Add example systemd unit 2024-06-18 21:53:13 -06:00
freepbx.js Checkpoint; Full rewrite is underway, this shouldn't take long! 2025-01-25 07:40:09 -07:00
index.js GUH 2025-01-25 12:02:53 -07:00
LICENSE Add readme and license! 2024-04-03 14:53:36 -06:00
migrations.js Checkpoint; Full rewrite is underway, this shouldn't take long! 2025-01-25 07:40:09 -07:00
package-lock.json Checkpoint; Full rewrite is underway, this shouldn't take long! 2025-01-25 07:40:09 -07:00
package.json Set up for docker compose file 2025-01-25 09:25:37 -07:00
README.md Update docs 2024-06-18 21:50:16 -06:00
TODO.md A lotta stuff 2025-01-25 11:49:40 -07:00

FreePBX Manager

License

Description

FreePBX Manager is a Discord bot designed to manage FreePBX configurations. Please note that this project is currently a hot mess and may not be suitable for production use.

Pre-requisites

Features

  • User-created extensions

  • Automatic extension creation

  • Extension deletion

  • Extension status

  • Extension list

  • Probably some more stuff that I forgot to write down lol

Setup

To set up the config file, follow the steps below:

  1. Clone the repository:

    git clone https://github.com/ChrisChrome/discord-freepbx-manager.git
    
    cd discord-freepbx-manager
    
  2. Install the required dependencies:

    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:

    {
     "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.
  1. Run the bot:
    node .
    
  2. Invite the bot to your Discord server using the following link:
    https://discord.com/oauth2/authorize?client_id=YOUR_BOT_ID&scope=bot&permissions=8
    
  3. You're all set! The bot should now be up and running.