Get instance ID of wan interface

I guys, i have few time using GenieACS and i have a little question for you :smiley:

I have several Huawei ONT and i’m making a provision script for VoIP. I can set sucessfully every parameter such as remote server, remote port, username,… but i need to set the associated wan interface for voice.

In this ONT, there are three wan interfaces (tr069, internet and voice). The wan interface for TR069 always have an InstanceID=1, but wan interface for voice have an InstanceID=2 or sometimes InstanceID=3.

I need to know if is possible to get/read the instance ID of voice wan interface via provision script.

The path for that is:
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.[X_HW_SERVICELIST:VOIP]

Any ideas?

Thanks!

Something like this:

let iface = declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANPPPConnection.[Name:voice]", {path: Date.now()});

log(iface[0].path);

Hi akcoder and thanks by your help!

I was try your code, but GenieACS returns me an ‘undefined path’.

The code i’m using is this:
const now = Date.now();
let iface = declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.*.WANIPConnection.1.[X_HW_SERVICELIST:VOIP]", {path: now});
log("Interface " + iface[0].path);

And GenieACS returns me this error:
Channel has faulted; channel="testing" retries=0 faultCode="script.TypeError" faultMessage="Cannot read property 'path' of undefined"

Thanks!

You will need to loop through and check. Look at the provisioning script examples on the wiki.

Ok, thanks!

I will check the wiki.

Regards