Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions SnomDeskphone/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,12 @@
"For seeing the current fkey settings, press the button \"See current function keys settings\"';",
"SNMD_setFkeysSettings($id);"
]
},
{
"type": "Select",
"name": "ips",
"caption": "found ips",
"options": []
}
]
}
22 changes: 22 additions & 0 deletions SnomDeskphone/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,31 @@ public function fkeysAreUnique(array $fkeys_settings): bool
return $fkeys_are_unique;
}

public function getIps(): array
{
$options = [];
$ricohDevices = [];
$devices = ZC_QueryServiceType(38338, "_http._tcp", "");
foreach ($devices as $device) {
if (str_contains($device["Name"], "RICOH")) {
array_push($ricohDevices, $device["Name"]);
}
}
$ricohIps =[];
foreach ($ricohDevices as $ricohDevice) {
$deviceIp = ZC_QueryService(38338, $ricohDevice, "_http._tcp", "local.")[0]["IPv4"][0];
// echo var_dump($deviceInfo);
array_push($options, ["caption" => $deviceIp, "value" => $deviceIp]);
}
// echo var_dump($ricohIps);
return $options;
}

public function GetConfigurationForm(): string
{
$data = json_decode(file_get_contents(__DIR__ . "/form.json"), true);
// echo var_dump();
$data["elements"][8]["options"] = $this->getIps();
$device_info = array(
"is snom phone" => false,
"mac address" => '00:04:13:',
Expand Down