[
{"_id":"default","script":"const hourly = Date.now(3600000);\n\n// Refresh basic parameters hourly\ndeclare(\"InternetGatewayDevice.DeviceInfo.HardwareVersion\", {path: hourly, value: hourly});\ndeclare(\"InternetGatewayDevice.DeviceInfo.SoftwareVersion\", {path: hourly, value: hourly});\ndeclare(\"InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANIPConnection.*.MACAddress\", {path: hourly, value: hourly});\ndeclare(\"InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANIPConnection.*.ExternalIPAddress\", {path: hourly, value: hourly});\ndeclare(\"InternetGatewayDevice.LANDevice.*.WLANConfiguration.*.SSID\", {path: hourly, value: hourly});\n// Don't refresh password field periodically because CPEs always report blank passowrds for security reasons\n// declare(\"InternetGatewayDevice.LANDevice.*.WLANConfiguration.*.KeyPassphrase\", {path: hourly, value: 1});\ndeclare(\"InternetGatewayDevice.LANDevice.*.Hosts.Host.*.HostName\", {path: hourly, value: hourly});\ndeclare(\"InternetGatewayDevice.LANDevice.*.Hosts.Host.*.IPAddress\", {path: hourly, value: hourly});\ndeclare(\"InternetGatewayDevice.LANDevice.*.Hosts.Host.*.MACAddress\", {path: hourly, value: hourly});\n\ndeclare(\"InternetGatewayDevice.DeviceInfo.SerialNumber\", {path: hourly, value: hourly});\ndeclare(\"InternetGatewayDevice.DeviceInfo.ProductClass\", {path: hourly, value: hourly});\ndeclare(\"InternetGatewayDevice.DeviceInfo.ManufacturerOUI\", {path: hourly, value: hourly});\ndeclare(\"InternetGatewayDevice.DeviceInfo.Manufacturer\", {path: hourly, value: hourly});\n/*\ndeclare(\"InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANPPPConnection.*.Username\", {path: hourly, value: hourly});\ndeclare(\"InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANPPPConnection.*.MACAddress\", {path: hourly, value: hourly});\ndeclare(\"InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANPPPConnection.*.ExternalIPAddress\", {path: hourly, value: hourly});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.*.VoiceProfile.*.Line.*.Stats.*\", {path: hourly, value: hourly});\n*/\n\n/*\ndeclare(\"Device.XMPP.*\", {path: hourly, value: hourly});\ndeclare(\"Device.XMPP.*.*\", {path: hourly, value: hourly});\ndeclare(\"Device.XMPP.*.*.*\", {path: hourly, value: hourly});\n*/"},
{"_id":"inform","script":"const now = Date.now();\n\n//const ProductClass = declare(\"InternetGatewayDevice.DeviceInfo.ProductClass\", {value: now});\n\nlet username = '';\nlet password = '';\n\n// Raisecom ONU username and password must be provision through the OLT via the TR069 profile \n//if (ProductClass.startsWith(\"HT803G\")) {\n/*if ( ProductClass == \"HT803G-W\" || ProductClass == \"HT803G-WS2\") {\n\t// Device ID as user name\n  username = \"ragog\";\n  // Password will be fixed a given device because Math.random() is seeded with devcie ID by default.\n  password = \"26OG37\";\n} else {*/\n  // Device ID as user name\n  username = declare(\"DeviceID.ID\", {value: 1}).value[0];\n  // Password will be fixed a given device because Math.random() is seeded with devcie ID by default.\n  password = Math.trunc(Math.random() * Number.MAX_SAFE_INTEGER).toString(36);\n//}\n\nconst informInterval = 300;\n\n/*\n// Refresh values daily\nconst daily = Date.now(86400000);\n\n// Unique inform offset per device for better load distribution\nconst informTime = daily % 86400000;\n\nif (ProductClass != \"Device 2\") {\n\tdeclare(\"InternetGatewayDevice.ManagementServer.ConnectionRequestUsername\", {value: daily}, {value: username});\n\tdeclare(\"InternetGatewayDevice.ManagementServer.ConnectionRequestPassword\", {value: daily}, {value: password});\n\tdeclare(\"InternetGatewayDevice.ManagementServer.PeriodicInformEnable\", {value: daily}, {value: true});\n\tdeclare(\"InternetGatewayDevice.ManagementServer.PeriodicInformInterval\", {value: daily}, {value: informInterval});\n  \tif (ProductClass != \"HG8245\") {\n\t\tdeclare(\"InternetGatewayDevice.ManagementServer.PeriodicInformTime\", {value: daily}, {value: informTime});\n    }\n}\n \n\nif (ProductClass != \"HG8245\") {\n\tdeclare(\"Device.ManagementServer.ConnectionRequestUsername\", {value: daily}, {value: username});\n\tdeclare(\"Device.ManagementServer.ConnectionRequestPassword\", {value: daily}, {value: password});\n\tdeclare(\"Device.ManagementServer.PeriodicInformEnable\", {value: daily}, {value: true});\n\tdeclare(\"Device.ManagementServer.PeriodicInformInterval\", {value: daily}, {value: informInterval});\n\tdeclare(\"Device.ManagementServer.PeriodicInformTime\", {value: daily}, {value: informTime});\n}\n*/"},
{"_id":"bootstrap","script":"const now = Date.now();\n\n// Clear cached data model to force a refresh\nclear(\"Device\", now);\nclear(\"InternetGatewayDevice\", now);"},
{"_id":"firmware-upgrade","script":"const newFirmwareFile = args[0];\ndeclare(\"Downloads.[FileType:1 Firmware Upgrade Image]\", {path: 1}, {path: 1});\ndeclare(\"Downloads.[FileType:1 Firmware Upgrade Image].FileName\", {value: 1}, {value: newFirmwareFile});\ndeclare(\"Downloads.[FileType:1 Firmware Upgrade Image].Download\", {value: 1}, {value: Date.now(3600000)});\n// declare(\"Tags.DMZ\", null, {value: true});"},
{"_id":"reboot","script":"declare(\"Reboot\", null, {value: Date.now()});"},
{"_id":"HT803G-W","script":"// Get SSID and PreSharedKey from SQL DB\n//const res = ext(\"sqlQuery\", \"getWifi\", \"wifiInstance\", \"ssid\", \"preSharedKey\");\n\n// Configure SSID and PreSharedKey\n// nbrOfWifiInstance = (expression to get the last value of wifiInstance array);\n// declare(\"InternetGatewayDevice.LANDevice.1.WLANConfiguration.*\", null, {path: nbrOfWifiInstance};\n// declare(\"InternetGatewayDevice.LANDevice.1.WLANConfiguration.[wifiInstance].SSID\", {value: 1}, {value: ssid[wifiInstance]});\n// declare(\"InternetGatewayDevice.LANDevice.1.WLANConfiguration.[wifiInstance].PreSharedKey\", {value: 1}, {value: preSharedKey[wifiInstance]});\n\n// Get SIP username and SIP password from DB\n//const res = ext(\"sqlQuery\", \"getVoip\", \"voipInstance\", \"voipUser\", \"voipPass\");\n\n// configure SIP username and SIP password\n// nbrOfVoipInstance = (expression to get the last value of voipInstance array);\n// declare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.Line.*\", {value: 1}, {value: nbrOfVoipInstance};\n// declare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.Line.[voipInstance].SIP.AuthUserName\", {value: 1}, {value: voipUser[voipInstance]});\n// declare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.Line.[voipInstance].SIP.AuthPassword\", {value: 1}, {value: voipPass[voipInstance]});"},
{"_id":"bootstrap_raisecom_hgu","script":"const now = Date.now();\nlet t = Date.now() - 60000;\n\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.DTMFMethod\",{value: t}, {value: \"Inband\"});\n//declare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SignalingProtocol\",{value: t}, {value: \"SIP\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.OutboundProxy\",{value: t}, {value: \"fs02.targo.ca\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.X_CT-COM_Standby-OutboundProxy\",{value: t}, {value: \"fs03.targo.ca\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.ProxyServer\",{value: t}, {value: \"fs02.targo.ca\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.X_CT-COM_Standby-ProxyServer\",{value: t}, {value: \"fs03.targo.ca\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.RegistrarServer\",{value: t}, {value: \"fs02.targo.ca\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.X_CT-COM_Standby-RegistrarServer\",{value: t}, {value: \"fs03.targo.ca\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.UserAgentDomain\",{value: t}, {value: \"clients.targo.ca\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.Line.1.CallingFeatures.CallWaitingEnable\",{value: t}, {value: \"true\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.Line.2.CallingFeatures.CallWaitingEnable\",{value: t}, {value: \"true\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.X_CT-COM_HeartbeatSwitch\",{value: t}, {value: \"true\"});\ndeclare(\"InternetGatewayDevice.DeviceInfo.X_CT-COM_UPNP.Enable\",{value: t}, {value: \"true\"});\ndeclare(\"InternetGatewayDevice.Time.Enable\",{value: t}, {value: \"true\"});\ndeclare(\"InternetGatewayDevice.Time.LocalTimeZoneName\",{value: t}, {value: \"EST5EDT,M3.2.0,M11.1.0\"});\ndeclare(\"InternetGatewayDevice.Time.NTPServer1\",{value: t}, {value: \"10.5.2.35\"});\n//declare(\"InternetGatewayDevice.Time.NTPServer2\",{value: t}, {value: \"10.5.2.35\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.Line.1.Codec.List.1.Codec\",{value: t}, {value: \"G.711MuLaw\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.Line.1.X_CT-COM_IMS.three-party-service\",{value: t}, {value: \"1\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.DSCPMark\",{value: t}, {value: \"26\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.RTP.DSCPMark\",{value: t}, {value: \"46\"});\ndeclare(\"InternetGatewayDevice.LANDevice.1.LANHostConfigManagement.DNSServers\",{value: t}, {value: \"96.125.192.2,8.8.8.8\"});\n\ndeclare(\"Tags.upnp_auto\", {value: now}, {value: false});"},
{"_id":"HT803-w inform","script":"let t = Date.now() - 60000;\n\ndeclare(\"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.4.WANIPConnection.1.X_CT-COM_IPv6IPAddressOrigin\",{value: t}, {value: \"DHCPv6\"});"},
{"_id":"HT803G-W_inform","script":"let now = Date.now();\n\n//declare(\"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.4.WANIPConnection.1.X_CT-COM_IPv6IPAddressOrigin\",{value: now}, {value: \"DHCPv6\"});\n\n// VoIP QoS\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.RTP.DSCPMark\", {value: now}, {value: \"46\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.DSCPMark\", {value: now}, {value: \"26\"});\n// Logging\ndeclare(\"InternetGatewayDevice.DeviceInfo.X_CT-COM_Syslog.Enable\", {value: now}, {value: \"true\"});\ndeclare(\"InternetGatewayDevice.DeviceInfo.X_CT-COM_Syslog.Level\", {value: now}, {value: \"7\"});\n// DNS\n// declare(\"InternetGatewayDevice.LANDevice.1.LANHostConfigManagement.DNSServers\",{value: now}, {value: \"96.125.192.2,149.112.121.10\"});\ndeclare(\"InternetGatewayDevice.LANDevice.1.LANHostConfigManagement.DNSServers\", {value: now});\n\n\n// VoIP\n/*declare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.FaxT38.Enable\", {value: now}, {value: \"true\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.RTP.DSCPMark\", {value: now}, {value: \"46\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.DSCPMark\", {value: now}, {value: \"26\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.OutboundProxy\", {value: now}, {value: \"fs03.targo.ca\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.ProxyServer\", {value: now}, {value: \"fs03.targo.ca\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.RegistrarServer\", {value: now}, {value: \"fs03.targo.ca\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.UserAgentDomain\", {value: now}, {value: \"clients.targo.ca\"});\n*/\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.X_CT-COM_Standby-OutboundProxy\", {value: now}, {value: \"\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.X_CT-COM_Standby-ProxyServer\", {value: now}, {value: \"\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.X_CT-COM_Standby-RegistrarServer\", {value: now}, {value: \"\"});\n/*\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.X_CT-COM_HeartbeatSwitch\", {value: now}, {value: \"true\"});\n*/"},
{"_id":"HT502","script":"let t = Date.now() - 60000;\n\ndeclare(\"Device.LAN.X_GRANDSTREAM_DHCPServer.Enable\",{value: t}, {value: \"false\"});\ndeclare(\"Device.LAN.X_GRANDSTREAM_NATServer.DeviceMode\",{value: t}, {value: \"Bridge\"});\ndeclare(\"Device.LAN.AddressingType\",{value: t}, {value: \"DHCP\"});\ndeclare(\"Device.Time.LocalTimeZone\",{value: t}, {value: \"UTC-0500\"});\ndeclare(\"Device.LAN.X_GRANDSTREAM_ReplyToICMP\",{value: t}, {value: \"true\"});\ndeclare(\"Device.LAN.X_GRANDSTREAM_WANSideHTTPTelnetAccess\",{value: t}, {value: \"true\"});\ndeclare(\"Device.ManagementServer.STUNServerAddress\",{value: t}, {value: \"96.125.192.11\"});\ndeclare(\"Device.ManagementServer.PeriodicInformEnable\",{value: t}, {value: \"true\"});\n\n// Legacy device only\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.SIP.UserAgentTransport\",{value: t}, {value: \"UDP\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrarServerTransport\",{value: t}, {value: \"UDP\"});\n\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.RTP.DSCPMark\",{value: t}, {value: \"46\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.FaxT38.Enable\",{value: t}, {value: \"true\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.FaxT38.X_GRANDSTREAM_FaxToneDetectionMode\",{value: t}, {value: \"CallerOrCallee\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.SIP.X_GRANDSTREAM_AllowIncomingSIPMessagesFromSIPProxyOnly\",{value: t}, {value: \"true\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.DTMFMethodG711\",{value: t}, {value: \"RFC2833,SIPInfo,In-audio\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.DTMFMethod\",{value: t}, {value: \"RFC2833,SIPInfo,In-audio\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.X_GRANDSTREAM_DisableBellcoreStyle3WayConference\",{value: t}, {value: \"true\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.X_GRANDSTREAM_JitterBufferType\",{value: t}, {value: \"Fixed\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.X_GRANDSTREAM_JitterBufferLength\",{value: t}, {value: \"Medium\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.Line.1.X_GRANDSTREAM_EnableCallFeatures\",{value: t}, {value: \"false\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.SIP.X_GRANDSTREAM_CheckSIPUserIDForIncomingINVITE\",{value: t}, {value: \"true\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.RTP.SRTP.X_GRANDSTREAM_AvailableSRTPMode\",{value: t}, {value: \"EnabledButNotForced\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.SIP.X_GRANDSTREAM_ValidateIncomingSIPMessage\",{value: t}, {value: \"true\"});\ndeclare(\"Device.X_GRANDSTREAM_Syslog.SendSIPLog\",{value: t}, {value: \"true\"});\ndeclare(\"Device.X_GRANDSTREAM_Syslog.ServerAddress\",{value: t}, {value: \"10.5.2.40\"});\ndeclare(\"Device.X_GRANDSTREAM_Syslog.LogLevel\",{value: t}, {value: \"Warning\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.1.X_GRANDSTREAM_DisableCallWaitingTone\",{value: t}, {value: \"true\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.2.X_GRANDSTREAM_DisableCallWaitingTone\",{value: t}, {value: \"true\"});"},
{"_id":"HT812","script":"let t = Date.now() - 60000;\n\ndeclare(\"Device.LAN.X_GRANDSTREAM_DHCPServer.Enable\",{value: t}, {value: \"false\"});\ndeclare(\"Device.LAN.X_GRANDSTREAM_NATServer.DeviceMode\",{value: t}, {value: \"Bridge\"});\ndeclare(\"Device.LAN.AddressingType\",{value: t}, {value: \"DHCP\"});\ndeclare(\"Device.Time.LocalTimeZone\",{value: t}, {value: \"UTC-0500\"});\ndeclare(\"Device.LAN.X_GRANDSTREAM_ReplyToICMP\",{value: t}, {value: \"true\"});\ndeclare(\"Device.LAN.X_GRANDSTREAM_WANSideHTTPTelnetAccess\",{value: t}, {value: \"true\"});\ndeclare(\"Device.ManagementServer.STUNServerAddress\",{value: t}, {value: \"96.125.192.11\"});\ndeclare(\"Device.ManagementServer.PeriodicInformEnable\",{value: t}, {value: \"true\"});\n\n//newer device only\ndeclare(\"Device.UserInterface.X_GRANDSTREAM_DisableSSH\",{value: t}, {value: \"true\"});\ndeclare(\"Device.UserInterface.X_GRANDSTREAM_AccessMethod\",{value: t}, {value: \"HTTP\"});\n\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.RTP.DSCPMark\",{value: t}, {value: \"46\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.FaxT38.Enable\",{value: t}, {value: \"true\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.FaxT38.X_GRANDSTREAM_FaxToneDetectionMode\",{value: t}, {value: \"CallerOrCallee\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.SIP.X_GRANDSTREAM_AllowIncomingSIPMessagesFromSIPProxyOnly\",{value: t}, {value: \"true\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.DTMFMethodG711\",{value: t}, {value: \"RFC2833,SIPInfo,In-audio\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.DTMFMethod\",{value: t}, {value: \"RFC2833,SIPInfo,In-audio\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.X_GRANDSTREAM_DisableBellcoreStyle3WayConference\",{value: t}, {value: \"true\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.X_GRANDSTREAM_JitterBufferType\",{value: t}, {value: \"Fixed\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.X_GRANDSTREAM_JitterBufferLength\",{value: t}, {value: \"Medium\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.Line.1.X_GRANDSTREAM_EnableCallFeatures\",{value: t}, {value: \"false\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.SIP.X_GRANDSTREAM_CheckSIPUserIDForIncomingINVITE\",{value: t}, {value: \"true\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.RTP.SRTP.X_GRANDSTREAM_AvailableSRTPMode\",{value: t}, {value: \"EnabledButNotForced\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.*.SIP.X_GRANDSTREAM_ValidateIncomingSIPMessage\",{value: t}, {value: \"true\"});\ndeclare(\"Device.X_GRANDSTREAM_Syslog.SendSIPLog\",{value: t}, {value: \"true\"});\ndeclare(\"Device.X_GRANDSTREAM_Syslog.ServerAddress\",{value: t}, {value: \"10.5.2.40\"});\ndeclare(\"Device.X_GRANDSTREAM_Syslog.LogLevel\",{value: t}, {value: \"Warning\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.1.X_GRANDSTREAM_DisableCallWaitingTone\",{value: t}, {value: \"true\"});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.2.X_GRANDSTREAM_DisableCallWaitingTone\",{value: t}, {value: \"true\"});\ndeclare(\"Device.X_GRANDSTREAM_Upgrade.FirmwareUpgrade.FirmwareServerPath\",{value: t}, {value: \"\"});"},
{"_id":"Deco-Bootstrap","script":"const now = Date.now();\nconst serial = declare(\"DeviceID.SerialNumber\", {value: 1}).value[0];\n//const wifiList = ext(\"provisioning\", \"getWifi\", serial);\nconst wifi = {};\n\ndeclare(\"Device.WiFi.Radio.*.Enable\",{value: now}, {value: \"true\"});\ndeclare(\"Device.WiFi.SSID.*.Enable\",{value: now}, {value: \"true\"});\n\n//for (const w of wifiList) wifi[w.instance] = w;\n\ndeclare(\"Device.WiFi.Radio.1.OperatingChannelBandwidth\",{value: now}, {value: \"40M\"});\ndeclare(\"Device.ManagementServer.URL\",{value: now}, {value: \"http://10.5.2.115:7547/\"});\n\n//declare(\"Device.ManagementServer.STUNEnable\",{value: now}, {value: \"true\"});\n//declare(\"Device.ManagementServer.STUNServerAddress\",{value: now}, {value: \"96.125.192.11\"});\n\n//for (const i of [1, 2]) {\n//  if (!wifi[i] || !wifi[i].enable) {\n//    declare(`Device.WiFi.Radio.${i}.Enable`, {path: now, value: now}, {value: false});\n//    continue;\n//  }\n//  declare(`Device.WiFi.Radio.${i}.Enable`, {path: now, value: now}, {value: true});\n//  declare(`Device.WiFi.SSID.${i}.SSID`, {path: now, value: now}, {value: wifi[i].ssid});\n//  declare(`Device.WiFi.SSID.${i}.X_TP_MultiSSID_SSID`, {path: now, value: now}, {value: wifi[i].ssid + \"_Guest\"});\n//  declare(`Device.WiFi.AccessPoint.${i}.Security.PreSharedKey`, {path: now, value: now}, {value: wifi[i].password});\n//}"},
{"_id":"Deco-Inform","script":"const now = Date.now();\n\n// Va chercher l'information des hosts.\n/*declare(\"Device.Hosts.HostNumberOfEntries\", {value: now});\ndeclare(\"Device.Hosts.Host.*.Active\", {path: now, value: now});\ndeclare(\"Device.Hosts.Host.*.AssociatedDevice\", {path: now, value: now});\ndeclare(\"Device.Hosts.Host.*.HostName\", {path: now, value: now});\ndeclare(\"Device.Hosts.Host.*.IPAddress\", {path: now, value: now});\ndeclare(\"Device.Hosts.Host.*.LeaseTimeRemaining\", {path: now, value: now});\ndeclare(\"Device.Hosts.Host.*.PhysAddress\", {path: now, value: now});\n*/\n\n/*\n// Va chercher l'information des hosts wifi\ndeclare(\"Device.WiFi.AccessPoint.*.AssociatedDeviceNumberOfEntries\", {value: now});\ndeclare(\"Device.WiFi.AccessPoint.*.AssociatedDevice.*.MACAddress\", {path: now, value: now});\ndeclare(\"Device.WiFi.AccessPoint.*.AssociatedDevice.*.SignalStrength\", {path: now, value: now});\n//declare(\"Device.WiFi.AccessPoint.*.AssociatedDevice.*.Stats.BytesReceived\", {path: now, value: now});\n//declare(\"Device.WiFi.AccessPoint.*.AssociatedDevice.*.Stats.BytesSent\", {path: now, value: now});\ndeclare(\"Device.WiFi.AccessPoint.*.AssociatedDevice.*.X_TP_LinkRxRate\", {path: now, value: now});\ndeclare(\"Device.WiFi.AccessPoint.*.AssociatedDevice.*.X_TP_LinkTxRate\", {path: now, value: now});\n//declare(\"Device.WiFi.AccessPoint.*.AssociatedDevice.*.Stats.RetransCount\", {path: now, value: now});\n//declare(\"Device.WiFi.AccessPoint.*.AssociatedDevice.*.Stats.RetryCount\", {path: now, value: now});\n//declare(\"Device.WiFi.AccessPoint.*.AssociatedDevice.*.Stats.PacketsSent\", {path: now, value: now});\n*/\n\n//Va chercher l'information wifi global\n//declare(\"Device.WiFi.RadioNumberOfEntries\", {path: now, value: now});\n//declare(\"Device.WiFi.Radio.*.Stats.BytesSent\", {path: now, value: now});\n//declare(\"Device.WiFi.Radio.*.Stats.BytesReceived\", {path: now, value: now});\n//declare(\"Device.WiFi.Radio.*.Stats.ErrorsSent\", {path: now, value: now});\n//declare(\"Device.WiFi.Radio.*.Stats.ErrorsReceived\", {path: now, value: now});\n\n//Va chercher l'information ethernet\n/*\ndeclare(\"Device.Ethernet.Interface.*.Status\", {path: now, value: now});\ndeclare(\"Device.Ethernet.Interface.*.MaxBitRate\", {path: now, value: now});\ndeclare(\"Device.Ethernet.Interface.*.DuplexMode\", {path: now, value: now});\n*/\n//declare(\"Device.Ethernet.Interface.*.Upstream\", {path: now, value: now});\n\n// Set le inform au 300 secondes\ndeclare(\"Device.ManagementServer.PeriodicInformInterval\", {value: now}, {value: 600});\n//declare(\"Device.DeviceInfo.Serial\", {path: now}, {value: now});\n"},
{"_id":"Deco-Patch-Enable-SSID","script":"const now = Date.now();\n\ndeclare(\"Device.WiFi.Radio.*.Enable\",{value: now}, {value: \"true\"});\ndeclare(\"Device.WiFi.SSID.*.Enable\",{value: now}, {value: \"true\"});"},
{"_id":"HT803G-WS2_inform","script":"const now = Date.now();\n\n//////////////////////////////////////////////////////////// Config VOIP //////////////////////////////////////////////////////\n/*declare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.DigitMap\", {value: now}, {value: \"[[[2-9]11|*xx|011xxxxxxxxxxxx|1xxxxxxxxxx|xxxxxxxxxx]]\"});\n//declare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.DTMFMethod\", {value: now}, {value: \"Inband\"});\n//declare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.FaxT38.Enable\", {value: now}, {value: \"true\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.RTP.DSCPMark\", {value: now}, {value: \"46\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.DSCPMark\", {value: now}, {value: \"26\"});\n*/\n\n//declare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.OutboundProxy\", {value: now}, {value: \"fs05.targo.ca\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.OutboundProxy\", {value: now}, {value: \"fs06.targo.ca\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.RegisterRetryInterval\", {value: now}, {value: \"300\"});\ndeclare(\"InternetGatewayDevice.Time.LocalTimeZone\",{value: now}, {value: '-04:00'});\n//declare(\"InternetGatewayDevice.Layer3Forwarding.Forwarding.1.GatewayIPAddress\",{value: now});\ndeclare(\"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.*.WANIPConnection.1.DefaultGateway\",{value: now});\n\n//static routes\ndeclare(\"InternetGatewayDevice.Layer3Forwarding.Forwarding.*.Enable\",{value: now});\ndeclare(\"InternetGatewayDevice.Layer3Forwarding.Forwarding.*.DestIPAddress\",{value: now});\ndeclare(\"InternetGatewayDevice.Layer3Forwarding.Forwarding.*.DestSubnetMask\",{value: now});\ndeclare(\"InternetGatewayDevice.Layer3Forwarding.Forwarding.*.GatewayIPAddress\",{value: now});\ndeclare(\"InternetGatewayDevice.Layer3Forwarding.Forwarding.*.Nexthop\",{value: now});\ndeclare(\"InternetGatewayDevice.Layer3Forwarding.Forwarding.*.Status\",{value: now});\ndeclare(\"InternetGatewayDevice.Layer3Forwarding.Forwarding.*.Type\",{value: now});\n\n/*\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.ProxyServer\", {value: now}, {value: \"clients.targo.ca\"});\n//declare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.UserAgentDomain\", {value: now}, {value: \"clients.targo.ca\"});\ndeclare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.X_CT-COM_Standby-OutboundProxy\", {value: now}, {value: \"\"});\n//declare(\"InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.SIP.X_CT-COM_HeartbeatSwitch\", {value: now}, {value: \"true\"});\n*/\n\n// Logging\n//declare(\"InternetGatewayDevice.DeviceInfo.X_CT-COM_Syslog.UpReportLogType\", {value: now}, {value: \"1,2,3,4,5,6,12\"});\n//declare(\"InternetGatewayDevice.DeviceInfo.X_CT-COM_Syslog.1.LogLevel\", {value: now}, {value: \"0\"});\n//declare(\"InternetGatewayDevice.DeviceInfo.X_CT-COM_Syslog.12.LogLevel\", {value: now}, {value: \"0\"});\n//declare(\"InternetGatewayDevice.DeviceInfo.X_CT-COM_Syslog.2.LogLevel\", {value: now}, {value: \"0\"});\n//declare(\"InternetGatewayDevice.DeviceInfo.X_CT-COM_Syslog.3.LogLevel\", {value: now}, {value: \"0\"});\n//declare(\"InternetGatewayDevice.DeviceInfo.X_CT-COM_Syslog.4.LogLevel\", {value: now}, {value: \"0\"});\n//declare(\"InternetGatewayDevice.DeviceInfo.X_CT-COM_Syslog.5.LogLevel\", {value: now}, {value: \"0\"});\n//declare(\"InternetGatewayDevice.DeviceInfo.X_CT-COM_Syslog.6.LogLevel\", {value: now}, {value: \"0\"});\n//declare(\"InternetGatewayDevice.DeviceInfo.X_CT-COM_Syslog.RemoteSyslogServerIP\", {value: now}, {value: \"10.5.2.40\"});\n//declare(\"InternetGatewayDevice.DeviceInfo.X_CT-COM_Syslog.Enable\", {value: now}, {value: \"true\"});\n//declare(\"InternetGatewayDevice.DeviceInfo.X_CT-COM_Syslog.RemoteSyslogMode\", {value: now}, {value: \"2\"});\n"},
{"_id":"firmware-upgrade-HT803G","script":"const newFirmwareFile = args[0];\ndeclare(\"Downloads.[FileType:1 Firmware Upgrade Image]\", {path: 1}, {path: 1});\ndeclare(\"Downloads.[FileType:1 Firmware Upgrade Image].FileName\", {value: 1}, {value: newFirmwareFile});\ndeclare(\"Downloads.[FileType:1 Firmware Upgrade Image].Download\", {value: 1}, {value: Date.now(3600000)});\ndeclare(\"Tags.DMZ\", null, {value: true});"},
{"_id":"Deco-Host","script":"const now = Date.now();\n\ndeclare(\"Device.Hosts.HostNumberOfEntries\", {value: now});\ndeclare(\"Device.Hosts.Host.*.Active\", {path: now, value: now});\ndeclare(\"Device.Hosts.Host.*.AssociatedDevice\", {path: now, value: now});\ndeclare(\"Device.Hosts.Host.*.HostName\", {path: now, value: now});\ndeclare(\"Device.Hosts.Host.*.IPAddress\", {path: now, value: now})"},
{"_id":"Deco-TV","script":"const now = Date.now();\n\n/*declare(\"Device.WiFi.Radio.2.X_TP_MultiSSID_Enable\",{value: now}, {value: \"true\"});\ndeclare(\"Device.WiFi.SSID.2.X_TP_MultiSSID_SSID\",{value: now}, {value: \"TeleTargo\"});\ndeclare(\"Device.WiFi.AccessPoint.2.X_TP_MultiSSID.Security.ModeEnabled\",{value: now}, {value: \"true\"});\ndeclare(\"Device.WiFi.AccessPoint.2.X_TP_MultiSSID.Security.PreSharedKey\",{value: now}, {value: \"W1f1TVT4rg0\"});*/"},
{"_id":"xx230v_inform","script":"const now = Date.now();\nconst daily = Date.now(86400000);\nconst digitMap = \"112|19[2-5]|1x.t|[2-8]x.t|9x.t|0xx.t|*x.t|x.t\";\nconst sipRealm = \"clients.targo.ca\"\n\n// Va chercher le gpon SN au format numérique, garde les 8 dernier characteres et ajoute TPLG devant\nconst rawGponSN = declare(\"Device.Optical.Interface.1.GponAuth.GponSn\", {value: 1}).value[0]\nconst gponSN = \"TPLG\" + rawGponSN.slice(-8);;\n// Mgmt User = device ID and password will be Math.random() is seeded with devcie ID by default.\nconst username = declare(\"DeviceID.ID\", {value: 1}).value[0];\nconst password = Math.trunc(Math.random() * Number.MAX_SAFE_INTEGER).toString(36);\n\n// TR-069 MGMT credential\n//declare(\"Device.ManagementServer.ConnectionRequestUsername\", null, {value: username});\n//declare(\"Device.ManagementServer.ConnectionRequestPassword\", null, {value: password});\ndeclare(\"Device.ManagementServer.ConnectionRequestUsername\", {value: daily}, {value: username});\ndeclare(\"Device.ManagementServer.ConnectionRequestPassword\", {value: daily}, {value: password});\n\n\n\ndeclare(\"Device.DeviceInfo.X_TP_MACAddress\",{value: now});\ndeclare(\"Device.DeviceInfo.UpTime\",{value: now});\n// retiré car ceux avec entrées zombies le prennent mal\n//declare(\"Device.Routing.Router.1.IPv4Forwarding.*.GatewayIPAddress\",{value: now});\t\n\n// DHCP hostname\n//declare(\"Device.DHCPv4.Client.*.X_TP_Hostname\",{value: now}, {value: gponSN});\n\n// Remote Access\ndeclare(\"Device.UserInterface.RemoteAccess.Port\", null, {value: 443});\ndeclare(\"Device.UserInterface.RemoteAccess.Protocol\", null, {value: 'HTTPS'});\ndeclare(\"Device.UserInterface.RemoteAccess.X_TP_RemoteAll\", null, {value: false});\ndeclare(\"Device.UserInterface.RemoteAccess.X_TP_RemoteHost\", null, {value: '96.125.192.254/32,96.125.192.62/32,96.125.192.22/32'});\ndeclare(\"Device.UserInterface.RemoteAccess.Enable\", null, {value: true});\n\n// VoIP config\n//declare(\"Device.Services.VoiceService.1.VoiceProfile.1.SIP.RegistrarServer\",{value: now}, {value: sipRealm});\n//declare(\"Device.X_TP_Services.VoiceService.1.VoiceProfile.1.SIP.RegistrarServer\",{value: now}, {value: sipRealm});\n//declare(\"Device.X_TP_Services.X_TP_VoiceService.1.VoiceProfile.1.MultiIsp.1.MultiRegistrarServer\",{value: now}, {value: sipRealm});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.1.DigitMap\",{value: now}, {value: \"112|19[2-5]|1x.t|[2-8]x.t|9x.t|0xx.t|*x.t|x.t\"});\n\n// time config\ndeclare(\"Device.Time.DaylightSavingsStart\", {value: daily}, {value: \"2024-03-10T02:00:00.000Z\"});\ndeclare(\"Device.Time.DaylightSavingsEnd\", {value: daily}, {value: \"2024-11-03T02:00:00.000Z\"});\ndeclare(\"Device.Time.DaylightSavingsUsed\", {value: daily}, {value: true});\ndeclare(\"Device.Time.NTPServer1\", {value: daily}, {value: \"10.5.2.35\"})\n\n// Superadmin activé\ndeclare(\"Device.Users.User.1.Enable\", {value: daily}, {value: true})\ndeclare(\"Device.Users.User.1.Password\", {value: daily}, {value: \"n3wN0HAk4u$\"})\n\n// tag config manuelle pour futur exception\ndeclare(\"Tags.config_manuelle\", now, {value: true});\n\n\n//TP-Link Fix pour erreur 9805 et 9806\nclear(\"Device.Hosts.Host\", Date.now());\nclear(\"Device.WiFi.MultiAP.APDevice.*.Radio.*.AP.*.AssociatedDevice\", Date.now());\nclear(\"Device.WiFi.AccessPoint.1.AssociatedDevice\", Date.now());\ncommit();\n\n\n\n\n\n// === Refresh First layer tree ? ===\ndeclare(\"Device.WiFi.SSID\", {value: now});\ndeclare(\"Device.WiFi.DataElements.Network.Device\", {value: now});\ndeclare(\"Device.WiFi.Radio\", {value: now});\ndeclare(\"Device.WiFi.MultiAP.APDevice\", {value: now});\ndeclare(\"Device.Hosts.Host\", {value: now});\n\n"},
{"_id":"xx230v_boot","script":"const now = Date.now();\nclear(\"Device.UserInterface.RemoteAccess\", Date.now());\nclear(\"Device.X_TP_GPON.Link\", {value: now});\nclear(\"Device.Ethernet.Link\", {value: now});\nclear(\"Device.Ethernet.VLANTermination\", {value: now});\nclear(\"Device.IP.Interface\",{value: now});\nclear(\"Device.DHCPv4.Client\",{value: now});\nclear(\"Device.DHCPv6.Client\",{value: now});\nclear(\"Device.NAT.InterfaceSetting\",{value: now});\nclear(\"Device.Routing.Router.1.IPv4Forwarding\",{value: now});\nclear(\"Device.Routing.RIP\",{value: now});\nclear(\"Device.DNS.Relay.Forwarding\",{value: now});\nclear(\"Device.Services.VoiceService\",{value: now});"},
{"_id":"HT803-W_inform_upnp","script":"const now = Date.now();\n\ndeclare(\"InternetGatewayDevice.DeviceInfo.X_CT-COM_UPNP.Enable\", {value: now}, {value: \"false\"});\ndeclare(\"Tags.upnp_auto\", {value: now}, {value: true});"},
{"_id":"xx530v_inform","script":"const now = Date.now();\nconst daily = Date.now(86400000);\nconst digitMap = \"112|19[2-5]|1x.t|[2-8]x.t|9x.t|0xx.t|*x.t|x.t\";\nconst sipRealm = \"clients.targo.ca\"\n\n// Va chercher le gpon SN au format numérique, garde les 8 dernier characteres et ajoute TPLG devant\nconst rawGponSN = declare(\"Device.Optical.Interface.1.GponAuth.GponSn\", {value: 1}).value[0]\nconst gponSN = \"TPLG\" + rawGponSN.slice(-8);;\n// Mgmt User = device ID and password will be Math.random() is seeded with devcie ID by default.\nconst username = declare(\"DeviceID.ID\", {value: 1}).value[0];\nconst password = Math.trunc(Math.random() * Number.MAX_SAFE_INTEGER).toString(36);\n\n// TR-069 MGMT credential\ndeclare(\"Device.ManagementServer.ConnectionRequestUsername\", null, {value: username});\ndeclare(\"Device.ManagementServer.ConnectionRequestPassword\", null, {value: password});\ndeclare(\"Device.DeviceInfo.X_TP_MACAddress\",{value: now});\n//declare(\"Device.ManagementServer.ConnectionRequestUsername\", {value: daily}, {value: username});\n//declare(\"Device.ManagementServer.ConnectionRequestPassword\", {value: daily}, {value: password});\n\n// Superadmin activé\ndeclare(\"Device.Users.User.1.Enable\", {value: daily}, {value: true})\ndeclare(\"Device.Users.User.1.Password\", {value: daily}, {value: \"n3wN0HAk4u$\"})"},
{"_id":"xx430v_inform","script":"const now = Date.now();\nconst daily = Date.now(86400000);\nconst digitMap = \"112|19[2-5]|1x.t|[2-8]x.t|9x.t|0xx.t|*x.t|x.t\";\nconst sipRealm = \"clients.targo.ca\"\n\n// Va chercher le gpon SN au format numérique, garde les 8 dernier characteres et ajoute TPLG devant\nconst rawGponSN = declare(\"Device.Optical.Interface.1.GponAuth.GponSn\", {value: 1}).value[0]\nconst gponSN = \"TPLG\" + rawGponSN.slice(-8);;\n// Mgmt User = device ID and password will be Math.random() is seeded with devcie ID by default.\nconst username = declare(\"DeviceID.ID\", {value: 1}).value[0];\nconst password = Math.trunc(Math.random() * Number.MAX_SAFE_INTEGER).toString(36);\n\n// TR-069 MGMT credential\n//declare(\"Device.ManagementServer.ConnectionRequestUsername\", null, {value: username});\n//declare(\"Device.ManagementServer.ConnectionRequestPassword\", null, {value: password});\ndeclare(\"Device.ManagementServer.ConnectionRequestUsername\", {value: daily}, {value: username});\ndeclare(\"Device.ManagementServer.ConnectionRequestPassword\", {value: daily}, {value: password});\n\n\n\ndeclare(\"Device.DeviceInfo.X_TP_MACAddress\",{value: now});\ndeclare(\"Device.DeviceInfo.UpTime\",{value: now});\n// retiré car ceux avec entrées zombies le prennent mal\n//declare(\"Device.Routing.Router.1.IPv4Forwarding.*.GatewayIPAddress\",{value: now});\t\n\n// DHCP hostname\n//declare(\"Device.DHCPv4.Client.*.X_TP_Hostname\",{value: now}, {value: gponSN});\n\n// Remote Access\ndeclare(\"Device.UserInterface.RemoteAccess.Port\", null, {value: 443});\ndeclare(\"Device.UserInterface.RemoteAccess.Protocol\", null, {value: 'HTTPS'});\ndeclare(\"Device.UserInterface.RemoteAccess.X_TP_RemoteAll\", null, {value: false});\ndeclare(\"Device.UserInterface.RemoteAccess.X_TP_RemoteHost\", null, {value: '96.125.192.254/32,96.125.192.62/32,96.125.192.22/32'});\ndeclare(\"Device.UserInterface.RemoteAccess.Enable\", null, {value: true});\n\n// VoIP config\n//declare(\"Device.Services.VoiceService.1.VoiceProfile.1.SIP.RegistrarServer\",{value: now}, {value: sipRealm});\n//declare(\"Device.X_TP_Services.VoiceService.1.VoiceProfile.1.SIP.RegistrarServer\",{value: now}, {value: sipRealm});\n//declare(\"Device.X_TP_Services.X_TP_VoiceService.1.VoiceProfile.1.MultiIsp.1.MultiRegistrarServer\",{value: now}, {value: sipRealm});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.1.DigitMap\",{value: now}, {value: \"112|19[2-5]|1x.t|[2-8]x.t|9x.t|0xx.t|*x.t|x.t\"});\n\n// time config\ndeclare(\"Device.Time.DaylightSavingsStart\", {value: daily}, {value: \"2024-03-10T02:00:00.000Z\"});\ndeclare(\"Device.Time.DaylightSavingsEnd\", {value: daily}, {value: \"2024-11-03T02:00:00.000Z\"});\ndeclare(\"Device.Time.DaylightSavingsUsed\", {value: daily}, {value: true});\ndeclare(\"Device.Time.NTPServer1\", {value: daily}, {value: \"10.5.2.35\"})\n\n// Superadmin activé\ndeclare(\"Device.Users.User.1.Enable\", {value: daily}, {value: true})\ndeclare(\"Device.Users.User.1.Password\", {value: daily}, {value: \"n3wN0HAk4u$\"})\n\n// tag config manuelle pour futur exception\ndeclare(\"Tags.config_manuelle\", now, {value: true});\n\n\n\n\n/*\n\n// === Refresh Value for Lan device information ===\ndeclare(\"Device.Hosts.Host.*.InterfaceType\", {value: now});\ndeclare(\"Device.Hosts.Host.*.PhysAddress\", {value: now});\ndeclare(\"Device.Hosts.Host.*.AssociatedDevice\", {value: now});\ndeclare(\"Device.Hosts.Host.*.HostName\", {value: now});\n\n\n\n// === SSID Information ===\ndeclare(\"Device.WiFi.SSID.*.SSID\", {value: now});\ndeclare(\"Device.WiFi.SSID.*.LowerLayers\", {value: now});\n\n\n\n// === Radio Information ===\ndeclare(\"Device.WiFi.Radio.*.OperatingFrequencyBand\", {value: now});\n\n// === Access Point Information ===\ndeclare(\"Device.WiFi.AccessPoint.1.AssociatedDevice\", {value: now});\ndeclare(\"Device.WiFi.AccessPoint.1.SSIDReference\", {value: now});\ndeclare(\"Device.WiFi.AccessPoint.1.AssociatedDevice.*.MACAddress\", {value: now});\ndeclare(\"Device.WiFi.AccessPoint.1.AssociatedDevice.*.SignalStrength\", {value: now});\ndeclare(\"Device.WiFi.AccessPoint.1.AssociatedDevice.*.LastDataDownlinkRate\", {value: now});\ndeclare(\"Device.WiFi.AccessPoint.1.AssociatedDevice.*.OperatingStandard\", {value: now});\n\n// === TP-Link DataElements ===\ndeclare(\"Device.WiFi.DataElements.Network.*.SSID.Reference\", {value: now});\ndeclare(\"Device.WiFi.DataElements.Network.*.SSID.SSID\", {value: now});\ndeclare(\"Device.WiFi.DataElements.Network.*.Radio.*.FrequencyBand\", {value: now});\ndeclare(\"Device.WiFi.DataElements.Network.*.Radio.*.BSS.*.SSIDReference\", {value: now});\ndeclare(\"Device.WiFi.DataElements.Network.*.Radio.*.BSS.*.STA.*.MACAddress\", {value: now});\ndeclare(\"Device.WiFi.DataElements.Network.*.Radio.*.BSS.*.STA.*.SignalStrength\", {value: now});\ndeclare(\"Device.WiFi.DataElements.Network.*.Radio.*.BSS.*.STA.*.LastDataDownlinkRate\", {value: now});\ndeclare(\"Device.WiFi.DataElements.Network.*.Radio.*.BSS.*.STA.*.OperatingStandard\", {value: now});\n\n\n// === TP-Link APDevice ===\ndeclare(\"Device.WiFi.MultiAP.APDevice.*.Radio.*.AP.*.AssociatedDevice.*.MACAddress\", {value: now});\ndeclare(\"Device.WiFi.MultiAP.APDevice.*.Radio.*.AP.*.AssociatedDevice.*.Active\", {value: now});\ndeclare(\"Device.WiFi.MultiAP.APDevice.*.Radio.*.AP.*.AssociatedDevice.*.OperatingStandard\", {value: now});\ndeclare(\"Device.WiFi.MultiAP.APDevice.*.Radio.*.AP.*.AssociatedDevice.*.SignalStrength\", {value: now});\ndeclare(\"Device.WiFi.MultiAP.APDevice.*.Radio.*.AP.*.AssociatedDevice.*.LastDataDownlinkRate\", {value: now});\n*/"},
{"_id":"XX230v_inform_TpLink_fix","script":"const now = Date.now();\nconst daily = Date.now(86400000);\nconst digitMap = \"112|19[2-5]|1x.t|[2-8]x.t|9x.t|0xx.t|*x.t|x.t\";\nconst sipRealm = \"clients.targo.ca\"\n\n// Va chercher le gpon SN au format numérique, garde les 8 dernier characteres et ajoute TPLG devant\nconst rawGponSN = declare(\"Device.Optical.Interface.1.GponAuth.GponSn\", {value: 1}).value[0]\nconst gponSN = \"TPLG\" + rawGponSN.slice(-8);;\n// Mgmt User = device ID and password will be Math.random() is seeded with devcie ID by default.\nconst username = declare(\"DeviceID.ID\", {value: 1}).value[0];\nconst password = Math.trunc(Math.random() * Number.MAX_SAFE_INTEGER).toString(36);\n\n// TR-069 MGMT credential\n//declare(\"Device.ManagementServer.ConnectionRequestUsername\", null, {value: username});\n//declare(\"Device.ManagementServer.ConnectionRequestPassword\", null, {value: password});\ndeclare(\"Device.ManagementServer.ConnectionRequestUsername\", {value: daily}, {value: username});\ndeclare(\"Device.ManagementServer.ConnectionRequestPassword\", {value: daily}, {value: password});\n\n\n\ndeclare(\"Device.DeviceInfo.X_TP_MACAddress\",{value: now});\ndeclare(\"Device.DeviceInfo.UpTime\",{value: now});\n// retiré car ceux avec entrées zombies le prennent mal\n//declare(\"Device.Routing.Router.1.IPv4Forwarding.*.GatewayIPAddress\",{value: now});\t\n\n// DHCP hostname\n//declare(\"Device.DHCPv4.Client.*.X_TP_Hostname\",{value: now}, {value: gponSN});\n\n// Remote Access\ndeclare(\"Device.UserInterface.RemoteAccess.Port\", null, {value: 443});\ndeclare(\"Device.UserInterface.RemoteAccess.Protocol\", null, {value: 'HTTPS'});\ndeclare(\"Device.UserInterface.RemoteAccess.X_TP_RemoteAll\", null, {value: false});\ndeclare(\"Device.UserInterface.RemoteAccess.X_TP_RemoteHost\", null, {value: '96.125.192.254/32,96.125.192.62/32,96.125.192.22/32'});\ndeclare(\"Device.UserInterface.RemoteAccess.Enable\", null, {value: true});\n\n// VoIP config\n//declare(\"Device.Services.VoiceService.1.VoiceProfile.1.SIP.RegistrarServer\",{value: now}, {value: sipRealm});\n//declare(\"Device.X_TP_Services.VoiceService.1.VoiceProfile.1.SIP.RegistrarServer\",{value: now}, {value: sipRealm});\n//declare(\"Device.X_TP_Services.X_TP_VoiceService.1.VoiceProfile.1.MultiIsp.1.MultiRegistrarServer\",{value: now}, {value: sipRealm});\ndeclare(\"Device.Services.VoiceService.1.VoiceProfile.1.DigitMap\",{value: now}, {value: \"112|19[2-5]|1x.t|[2-8]x.t|9x.t|0xx.t|*x.t|x.t\"});\n\n// time config\ndeclare(\"Device.Time.DaylightSavingsStart\", {value: daily}, {value: \"2024-03-10T02:00:00.000Z\"});\ndeclare(\"Device.Time.DaylightSavingsEnd\", {value: daily}, {value: \"2024-11-03T02:00:00.000Z\"});\ndeclare(\"Device.Time.DaylightSavingsUsed\", {value: daily}, {value: true});\ndeclare(\"Device.Time.NTPServer1\", {value: daily}, {value: \"10.5.2.35\"})\n// Superadmin activé\ndeclare(\"Device.Users.User.1.Enable\", {value: daily}, {value: true})\ndeclare(\"Device.Users.User.1.Password\", {value: daily}, {value: \"n3wN0HAk4u$\"})\n\n// tag config manuelle pour futur exception\ndeclare(\"Tags.config_manuelle\", now, {value: true});\n\n\n//TP-Link Fix pour erreur 9805 et 9806\nclear(\"Device.Hosts.Host\", Date.now());\nclear(\"Device.WiFi.MultiAP.APDevice.*.Radio.*.AP.*.AssociatedDevice\", Date.now());\nclear(\"Device.WiFi.AccessPoint.1.AssociatedDevice\", Date.now());\ncommit();\n\n\n\n\n// === Refresh First layer tree ? ===\ndeclare(\"Device.WiFi.SSID\", {value: now});\ndeclare(\"Device.WiFi.DataElements.Network.Device\", {value: now});\ndeclare(\"Device.WiFi.Radio\", {value: now});\ndeclare(\"Device.WiFi.MultiAP.APDevice\", {value: now});\ndeclare(\"Device.Hosts.Host\", {value: now});\n\n\n"}
]