How can I get the extension information in php

With that simple PHP script you’re not bringing in your authenticated session. Add at the top before you include /etc/freepbx.conf:

// this is from config.php
if (!isset($_SESSION)) {
        //start a session if we need one
        $ss = @session_start();
        if(!$ss){
                session_regenerate_id(true); // replace the Session ID
                session_start();
        }
}

Or bypass auth altogether with:

$bootstrap_settings['freepbx_auth'] = false;

before requiring /etc/freepbx.conf. But of course, disclaimer: bypass security at your own peril.

3 Likes