So I have a question about these scripts. Is there a reason they only look for local extensions on the PBX vs the actual contact lists? I mean the scripts are basically kicking out an internal directory but what if people what other contacts in their phonebook directory?
To use freepbx phone book I have make this very simple code working like a charm
Use this page as remote phone book, name is as you like and put it in /var/www/html dir.
<?php
################################################
# COMDIF INNOVATION Christian-Zeler@2019 #
# Dynamic XML from Free-PBX Asterisk Phonebook #
################################################
header("Content-Type: text/xml");
// Connect Asterisk Sqlite database
$db = new SQLite3('/var/lib/asterisk/astdb.sqlite3');
// Search cidname datas
$results=$db->query('SELECT * FROM astdb WHERE key like "/cidname/%";');
// make header for XML format
echo'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n';
// XML doc start
echo'<contactIPPhoneDirectory>\n';
$index = 0;
// Loop to print Directory
while ($row = $results->fetchArray())
{
$num = explode('/',$row[0]);
$index= $index + 1;
echo " <DirectoryEntry>\n";
echo " <Name>" . $row[1] . "</Name>\n";
echo " <Telephone>" . $num[2] . "</Telephone>\n";
echo " </DirectoryEntry>\n";
}
// End XML doc
echo "</contactIPPhoneDirectory>\n";
// That's all folks :-)
?>
Iâm not a php expert (although I have 40+ years programming in other languagesâŠ) what is the purpose of the $index variable in that script? Seems to not do anythingâŠ
I grabbed the latest version of cm_to_yl_ab.php from github. Had a little hiccup though, but I tracked it down - if the actual group name in $contact_manager_group has a single quote in it, itâs not escaped properly and breaks the script. ie $contact_manager_group = âJoeâs Contactsâ
Well, no telling WHAT a contact group is going to be named⊠I added a $_GET[âextâ] so I could pass the extension number ( remote_phonebook.data.1.url = http://pbx.xxxx.com:81/ExtensionPB.php?ext=__line1Ext__ ). That way it pulls the private contacts for a user that they can maintain via UCP. Just name the group whatever the extension number is.
That concept is better served with the local contact function in the phone IMO. Users can save that without a web browser via the desk phone itself, or via the phone gui with the user account.
That contact list can be auto uploaded to the PBX every time it is modified.
I have to disagree with you wrt the local contact function in the phone. Maintaining numbers on the phone itself is annoying at best. Letâs face it, touch screens are horrible, whether on a T48S or an iPhone X. And older users with dry skin find it particularly vexing (search on âzombie fingerâ). Giving users web access to the phone? Why do that when you already have given them UCP and taught them how to use it?