Out of Box Experience

 

FreePBX 12.0 41 and higher offers a better, more stable, Out Of Box Experience facility.

To enable a modules OOBE features, add an 'oobe' tag to the module's XML file.

For example, if the Paging module wanted to provide an OOBE hook, you would add this to the module.xml

<module>   <rawname>paging</rawname>   <repo>standard</repo> ...   <oobe method="oobeHook" /> ... </module>

That tag references a BMO Function in that module. The method is the value of the tag. You may also, optionally, provide a priority="number" tag, which will prioritize it above or below other modules. The default is 100. If you set it below 10, it will run before framework (the "You need to create an Administrator account") hook.

To actually implement this, the BMO Class of the module must provide the method. Above, it is oobeHook, so the Paging class should provide that function:

<?php namespace FreePBX\modules;    class Paging { ... ...     public function oobeHook() {         print "This is the output of the hook";     } }   

Config.php will KEEP calling that function on every subsequent page load, until it returns (bool) true, at which point that OOBE function is marked as complete, and will not be triggered again.

In the example above, there is no way to ever complete an Paging OOBE request.  A slightly more complex example is below

<?php namespace FreePBX\modules;    class Paging { ... ...     public function oobeHook() {         if (isset($_REQUEST['finishoobe'])) {             return true;         } else {             print "<form method='POST'><button type='submit' name='finishoobe'>Click This</button></form>\n";         }     } }

It is critical to note that when you return (bool) true, that function should not have produced any output, as the next OOBE hook will then be run (if there is one).

Return to Documentation Home I Return to Sangoma Support