<?php
// IP-adres van de Yealink-telefoon
$phone_ip = "IP_ADDRESS_OF_YEALINK_PHONE";
// Gebruikersnaam en wachtwoord voor de webinterface (indien ingesteld)
$username = "YOUR_USERNAME";
$password = "YOUR_PASSWORD";
// URL van de configuratiepagina van de telefoon
$config_url = "http://$phone_ip/cgi-bin/ConfigManApp.com";
// Inloggegevens (als vereist)
$login_data = array(
"user" => $username,
"pwd" => $password
);
// Voer een HTTP POST-verzoek uit om in te loggen op de telefoon
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $config_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($login_data));
$login_response = curl_exec($ch);
// Voer een HTTP GET-verzoek uit om de configuratiepagina op te halen
curl_setopt($ch, CURLOPT_POST, false);
$config_page = curl_exec($ch);
// Sluit de cURL-verbinding
curl_close($ch);
// Voer regex-gebaseerde bewerkingen uit op de configuratiepagina om BLF in Speed Dial te wijzigen
$config_page = preg_replace('/key\.(\\d+)\.type=blf/', 'key.$1.type=speeddial', $config_page);
// Hier kun je ook een lijst met waarden invoegen voor specifieke toetsen
// Stuur de bijgewerkte configuratie terug naar de telefoon
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $config_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $config_page);
$update_response = curl_exec($ch);
// Sluit de cURL-verbinding
curl_close($ch);
// Controleer of de update succesvol was
if (strpos($update_response, "Save successfully") !== false) {
echo "Configuratie bijgewerkt.";
} else {
echo "Fout bij het bijwerken van de configuratie.";
}
?>