Logging into FreePBX Automatically (FreePBX 12 and above)

If you wish to log into FreePBX programmatically, enable 'REMOTEUNLOCK' in Advanced Settings, and then run

amportal a genunlockkey

This will provide you with a parseable output like this:

[root@localhost tmp]# amportal a genunlockkey Please wait... If REMOTEUNLOCK is enabled, you will receive a value for KEY. You can use that as a parameter to config.php, thus: http://192.168.1.1/admin/config.php?unlock=abc123def... KEY=1cf97aa02913fc0ae5f65b6d69c6270b2c7dd57e201dd541cb163e6410a17f2d [root@localhost tmp]#

Note that if 'REMOTEUNLOCK' is not enabled in Advanced Settings (it is not enabled by default), the 'KEY' line will be blank.

Caveats:

  • You only get one attempt to log in, after the key is generated. If you pass an incorrect key, the stored key is deleted, and you'll need to generate another.

  • If REMOTEUNLOCK is disabled before the key is used, it will be invalid. 

  • The key is NOT time limited.

  • There is only one valid key per system at a time. 

Code Reference:

http://git.freepbx.org/projects/FREEPBX/repos/framework/browse/amp_conf/htdocs/admin/libraries/BMO/Unlock.class.php?at=refs%2Fheads%2Fdevelop

Return to Documentation Home I Return to Sangoma Support