genieACS-projects/provisions/TPLink-ONU-VOIP-binding-fix.js
Nic D 83785f463f feat(voip-binding)INITIAL COMMIT: create extension that fetches VLAN VOIP name for given device ID
create provision script snippet to find device ID and re-bind VOIP VLANTermination name to X_TP property
2026-05-20 10:31:55 -04:00

26 lines
965 B
JavaScript

/** These steps will be performed during the standard inform process of XX230v ONUs:
* 1. Find the Name property of the VLANTermination that has VLANID set to '20'
* 2. Set Device.Services.VoiceService.1.X_TP_BoundIfName and/or
* Device.X_TP_Services.X_TP_VoiceService.1.BoundIfName value to the name found in step 1.
*/
const now = Date.now();
const daily = Date.now(86400000);
const username = declare("DeviceID.ID", { value: 1 }).value[0];
declare("Device.Ethernet.VLANTermination.*.VLANID", { value: daily });
declare("Device.Ethernet.VLANTermination.*.Name", { value: daily });
const vlanName = ext("vlan-interface-mapping", "getVoipVlanTerminationName", username);
// Reassign VOIP VLAN termination name to BoundIfName
declare(
`Device.Services.VoiceService.1.X_TP_BoundIfName`,
{ value: now },
{ value: vlanName },
);
declare(
`Device.X_TP_Services.X_TP_VoiceService.1.BoundIfName`,
{ value: now },
{ value: vlanName },
);