Scheduled Reboot of Obi202 VoIP ATA - Revisited
Upon upgrading Node.js to release 8, I found the www-request node was timing out when attempting to reboot the Obi device. I've since installed libwww-perl in order to use the lwp-request commandline via an exec node. Rather than overwriting the older version, I'm placing this new one alongside. Comment nodes should contain enough information to get you working.
[{"id":"2a02f1aa.e7f20e","type":"inject","z":"ef5bd670.f4cdf8","name":"Set Schedule","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"57 03 * * *","once":false,"onceDelay":"","x":120,"y":140,"wires":[["f62b2f18.8386"]]},{"id":"9ba540c8.bfac2","type":"debug","z":"ef5bd670.f4cdf8","name":"Debug Output","active":true,"console":"false","complete":"payload","x":925,"y":420,"wires":[]},{"id":"f62b2f18.8386","type":"www-request","z":"ef5bd670.f4cdf8","name":"Check Obi202 Calls Status Page","method":"GET","ret":"txt","url":"http://IP-Address/callstatus.htm","follow-redirects":false,"tls":"","x":380,"y":140,"wires":[["be7989be.f95bc8"]]},{"id":"be7989be.f95bc8","type":"html","z":"ef5bd670.f4cdf8","name":"Check TD Element for Calls In Progress","property":"","tag":"td","ret":"text","as":"multi","x":400,"y":240,"wires":[["f706aca3.71475"]]},{"id":"f706aca3.71475","type":"switch","z":"ef5bd670.f4cdf8","name":"Check for Active Call: No/Yes","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"Number of Active Calls: 0","vt":"str"},{"t":"regex","v":"Number of Active Calls: 1|Number of Active Calls: [12]","vt":"str","case":false},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":360,"y":340,"wires":[["3af11d43.143192"],["bbe6d512.dd9d78"],[]],"outputLabels":["No Active Call","There's a Call in Progress",""]},{"id":"bbe6d512.dd9d78","type":"change","z":"ef5bd670.f4cdf8","name":"Yes a Call is in Progress: - Set Failure Message","rules":[{"t":"set","p":"payload","pt":"msg","to":"Failed to reboot - Call in Progress","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":420,"wires":[["9ba540c8.bfac2"]]},{"id":"3af11d43.143192","type":"exec","z":"ef5bd670.f4cdf8","command":"lwp-request -C admin:password -e -d http://ip-address/rebootgetconfig.htm","addpay":false,"append":"","useSpawn":"false","timer":"20","oldrc":false,"name":"No Call Active - Click Reboot Button","x":777,"y":327,"wires":[["9ba540c8.bfac2"],[],[]]},{"id":"a56de67b.f23e08","type":"comment","z":"ef5bd670.f4cdf8","name":"Add IP-Address and Basic Auth","info":"","x":379,"y":109,"wires":[]},{"id":"ef22aee7.7b0db","type":"comment","z":"ef5bd670.f4cdf8","name":"Requires installation of libwww-perl package.","info":"This exec node executes a command in the\nlinux shell that uses the libwww-perl package. \nIt executes lwp-request followed by \nauthentication info that you must provide. \nThe URL should be modified to match the \nIP Accress of your OBI device.","x":797,"y":289,"wires":[]},{"id":"2bd80cea.88a4c4","type":"comment","z":"ef5bd670.f4cdf8","name":"Before blindly rebooting your Obi...","info":"","x":380,"y":209,"wires":[]}]