Static Entries in Dynamic Phonebook

Hello,

I hope you all are doing well! I am currently utilizing a PHP script to dynamically build the phonebook that is used on our phones/endpoints. The link to the script is below. This works very well without issue, but one thing I’m unsure of is the best option to add static entries to this list. For instance, queues and feature codes.

Thanks!

  1. I am hoping this is NOT exposed to the internet as it is not secure.
  2. You are already including /etc/freepbx.conf so I would use the internals.
  3. You currently have $all_rows = array() You can simply make this your static entries.

You are correct, this is not an exposed system. So, something like an array_push near line 15? Also, I just thought it would probably be better if we could programmatically pull in queues and just skip the feature codes? Those aren’t entirely necessary.

Thanks!

Also, what exactly is it using for the ID parameter in the XML?

function getQueues()
{
    $queues = queues_list();
    return array_map(function ($q) {
        return ['name' => $q[1], 'number' => $q[0]];
    }, $queues);
}

will return

Array
(
    [0] => Array
        (
            [name] => Test
            [number] => 9100
        )

)

So, in trying to call queues_list(), I am getting a call to an undefined function.

Assuming you have queues installed and enabled that should be added with

include /etc/freepbx.conf

I am currently utilizing the queues module, so I’m assuming it would load the dependencies from that, correct?

Thanks!

Yes, that function is built in

You can try adding

FreePBX::Modules()->loadAllFunctionsInc();

Under the include

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.