FreePBX | Register | Issues | Wiki | Portal | Support

Yealink XML Phonebook.xml auto-generation

(Greg) #1

So, I wrote a script that generates the XML Phonebook for Yealink phones.


Note: username and password need to have select access to the database

$mysql_conn = mysql_connect('localhost','username','password');
mysql_select_db('asterisk', $mysql_conn);
$query = 'SELECT description AS Name, user AS Telephone FROM devices WHERE 

$result = mysql_query($query, $mysql_conn);
if (! $result){
echo mysql_error();

$Output = "<YealinkIPPhoneDirectory>\n";
while($data = mysql_fetch_assoc($result)){
    $results[] = $data;
    $Output .= " <DirectoryEntry>\n";
    foreach($data as $key => $value){
            $Output .= "  <$key>$value</$key>\n";
    $Output .= " </DirectoryEntry>\n";
$Output .= "</YealinkIPPhoneDirectory>\n";
// echo $Output;




Great script! I have a similar one that generates phonebook simultaneously for yealink, grandstream and snom.

(Jared Busch) #3

Here is one I wrote.

This one is designed to be called live from the phone button.

Yealink phones and PBXact Contacts
(Jared Busch) #4

Apparently, I cannot edit the post any more, but I cleaned up the repository, the address changed a bit.

(Tom Ray) #6

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?

(Jared Busch) #7

@BlazeStudios I have another one that in there that looks at the Contact Manager.