Just came across your script. It's working great here - thank you! I made a small change to remove all non-numeric characters from phone numbers (like +, (), - , etc.), otherwise my Yealink phone doesn't dial the number properly from the directory. It only required 1 line of code in the main loop:
$contact['number'] = preg_replace("/[^0-9]/", "", $contact['number']);
One question: what is the purpose of the "label=" in the <Telephone> XML tag? This is not documented in Yealink's XML documentation, and although the script generates it properly for Home, Work, Mobile, and Other, my SIP-T29G phone seems to ignore it and instead indicates multiple numbers as Number1, Number2, etc. which is not great. I wish it used the tags. Do other Yealink phones support this?
Thanks again!