Page tree
Skip to end of metadata
Go to start of metadata

This is for the new SNG7 Distro ONLY!

Setup

If you already have the FreePBX distro installed then you already have the perfect environment to start FreePBX development. The steps below outline what you will need to do to be able to develop in FreePBX using the FreePBX distro:

yum -y install sangoma-devel

Note that 'sangoma-devel' is only available on SNG7 based Distros. If you're using an older SHMZ6 Distro, you will need to 'yum -y install git' instead.

rm -rf /usr/src/freepbx
echo "repo_directory=/usr/src/freepbx" >> ~/.freepbxconfig
cd /usr/src
git clone http://git.freepbx.org/scm/freepbx/devtools.git
cd /usr/src/devtools
./freepbx_git.php --setup --mode=ssh --switch=release/15.0 --keys=freepbx

There are two ways of synchronizing your machine with the main Git repository, ssh or https.  ssh is significantly faster, and is the recommended way, but you do need to grant access to the SSH key of your development machine with the FreePBX Git Repository.

If you are unsure of how, or unable to do so, remove the '--mode=ssh' parameter, and it will work purely over https. 

At this point (regardless of ssh or https) you will be asked for your FreePBX.org username and password. This is so the setup script can iterate over the list of projects available, which is not available without a login.

./freepbx_git.php --setup --mode=ssh --switch=release/15.0 --keys=freepbx

Make sure everything is symlinked correctly.

./freepbx_git.php -s

Once that is complete you are now free to install the developer mode of FreePBX. Keep in mind that we blow away the entire webroot so that the symlinks are created correctly and so that there are duplicate files laying around.

fwconsole ma upgradeall --edge
chown -R asterisk:asterisk /usr/src/freepbx 
cd /usr/src/freepbx/framework
rm -Rf /var/www/html/*
./install --dev-links -n
fwconsole ma installlocal
fwconsole chown
fwconsole reload

Fixing Broken Modules

If after development mode has been setup you can check if any modules are broken by querying FreePBX like so:

fwconsole ma list | grep "Broken"


If any Broken Module are found, you can attempt to fix them by running:

cd /usr/src/devtools
./fix_broken_modules.sh

Maintenance

Adding your own custom module

If after development mode has been setup you wish to add your own module the steps are simple.

First change directories to the freepbx source directory

cd /usr/src/freepbx

Next you'll either need to checkout your module from your favorite VCS (VCS means git,svn or others). Or add it manually. Remember that the raw name of your module should be the folder name so dont try to get creative and have a module name of "mya@wsome!!Module&&"

git clone git@github.com:tm1000/ucphelloworld.git

Lastly you'll want to run the linker. This process links your module folder into the framework modules folder which let's framework know your module exists

/usr/src/devtools/freepbx_git.php -s

Then tell framework to go update the symlinks. You'll also need to tell framework to go update the symlinks every time you add a new file!

/usr/src/freepbx/framework/install --dev-links -n

Set proper permissions

chown -R asterisk:asterisk /usr/src/freepbx

Finally install your module!

fwconsole ma install ucphelloworld

Don't forget to reload!

fwconsole reload

Updating all modules from GIT

Later down the line if you want to update everything in FreePBX from upstream simply run

cd /usr/src/devtools
./freepbx_git.php --refresh
./freepbx_git.php -s
chown -R asterisk:asterisk /usr/src/freepbx
fwconsole ma installlocal
fwconsole reload

Checking out (adding new modules)

If you want to checkout a single module run

/usr/src/devtools/freepbx_git.php -m <module> --switch=release/15.0
Update Dev SymLinks? [n]: y
chown -R asterisk:asterisk /usr/src/freepbx
fwconsole ma install <module>
fwconsole reload
  • No labels