I’ve played around Sorvani fanvil script ( freepbx-helper-scripts/ContactManager_to_Fanvil_AddressBook at master · sorvani/freepbx-helper-scripts · GitHub ) to get Gigaset PRO dect system working with Contact Manager as its Central Phonebook.
I basically modified php script (with near-zero knowledge) to have it working with just and only the Contac Manager “work” type of number/contact.
Any further number type added (cell, home, other) will add data messing up the wanted format.
This is the format required by Gigaset system for its phonebook:
<list>
<entry name="MyName" office1="123456789" office2="" surname="" home1="" home2="" mobile1="" mobile2=""/>
<entry name="AnotherName" office1="987654321" office2="" surname="" home1="" home2="" mobile1="" mobile2=""/>
</list>
The problem is all field are required even if empty ( “” )
So the field has to be FILLED with number present on Contact Manager or CREATED EMPTY if not present on Contact Manager.
If useful , this is the last part of cm_to_fv_ab.php I modified (with “office1” bind to “work” $ctype[‘work’]) :
// output the XML header info
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<!DOCTYPE LocalDirectory>\n";
// Output the XML root. This tag must be in the format XXXIPPhoneDirectory
// You may change the word Company below, but no other part of the root tag.
echo "<list>\n";
// Loop through the results and output them correctly.
// Spacing is setup below in case you wish to look at the result in a browser.
$previousname = "";
$firstloop = true;
foreach ($contacts as $contact) {
if ($contact['displayname'] != $previousname) {
if ($firstloop){
// flip the bit
$firstloop = false;
} else {
// close the previous entry
echo "/>\n";
}
// Start the entry
echo "<entry ";
echo "name=\"" . $contact['displayname'] . "\"";
// set the current name to the previous name
$previousname = $contact['displayname'];
}
if ($use_e164 == 0 || ($use_e164 == 1 && $contact['type'] == $ctype['internal'])) {
// not using E164 or it is an internal extnsion
echo " " . $contact['type'] . "=\"" . $contact['number'] . "\" office2=\"\" surname=\"\" home1=\"\" home2=\"\" mobile2=\"\" mobile1=\"\" " ;
} else {
// using E164s
echo " " . $contact['type'] . "=\"" . $contact['E164'] . "\" office2=\"\" surname=\"\" home1=\"\" home2=\"\" mobile1=\"\" mobile2=\"\" " ;
}
}
// Close the last entry.
echo "/>\n";
// Output the closing tag of the root. If you changed it above, make sure you change it here.
echo "</list>\n";
}
Any good boy ?