cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
Please note that Remote Expert Mobile announced end-of-life and support will end on February 28, 2022.
136
Views
0
Helpful
0
Replies
Highlighted

Macro - DX80 - xConfiguration

Hey Guys,

 

I am looking to build a macro that would send an xConfiguration Network IPStack: Dual command at 00:01 on weekdays, our DX80 keeps switching to IPv4 as we are using IPv4 in our CUCM but our network uses IPv6 any ideas?

My script below:

const xapi = require('xapi');

const Sunday = 0, Saturday = 6;

const ScheduleTime = '00:01';

function schedule(time, action) {
let [alarmH, alarmM] = time.split(':');
let now = new Date();
now = now.getHours() * 3600 + now.getMinutes() * 60 + now.getSeconds();
// print("Time now:" + now);
let difference = parseInt(alarmH) * 3600 + parseInt(alarmM) * 60 - now;
if (difference <= 0) difference += 24 * 3600;

return setTimeout(action, difference * 1000);
}


function ipstack() {
const weekDay = new Date().getDay();
if (weekDay !== Sunday && weekDay !== Saturday) {
xapi.xConfiguration('Network [1] IPStack: Dual');
}

schedule(ScheduleTime, ipstack);
}

 Any help greatly appreciated.

CreatePlease to create content