LibreACS Wiki
The fork of OpenACS a still open source TR-069 CWMP server.
Brought to you by:
plambrechtsen
This script queries the CPE to see if a Voice Profile exists, and if it doesn't create it otherwise continue onto the next script and set TR104 Parameters. After the script TR104 is successful backup all the CWMP values from the CPE using BackupCWMPTree. If the Voice Profile wasn't successfully created return an error.
//Voice Profile //Check to see if the cpe has a Voice Profile, and if they don't add it. var xGPVvals = new Array(); xGPVvals[0] = 'InternetGatewayDevice.Services.VoiceService.1.VoiceProfileNumberOfEntries'; var xGPVResponse = cpe.GetParameterValues(xGPVvals); // ------------------------------------------------------------------------------ // Set output with RPC response value. xVoiceProfileCount = xGPVResponse[0].value; if (xVoiceProfileCount == 0) { // Add a voice profile as one doesn't already exist // If successful xVoiceProfileCount will not be 0 logger(xLogPrefix + ' AddVoiceProfile'); var xTr104obj = new Object(); xTr104obj = 'InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.'; var xResponse = cpe.AddObject(xTr104obj, "AddCommandKey"); //Update Profile Count. Expected response is '1' when VoiceProfile.1. is created var xVoiceProfileCount = xResponse.InstanceNumber; } if (xVoiceProfileCount == 1) { // ------------------------------------------------------------------------------ // Populate the TR 104 data elements logger(xLogPrefix + 'Call: SetTR104Parameters'); call("SetTR104Parameters"); logger(xLogPrefix + 'Call: SetTR104Parameters Successful'); //Check if successfully updated as the xResult value is set in the script just called. if (xResult == 0) { // ------------------------------------------------------------------------------ // As Voice Profile successfully updated. // Update ACS with CWMP values from CPE. logger(xLogPrefix + 'Call: Backup CWMP Tree'); cpe.BackupCWMPTree(); logger(xLogPrefix + 'Call: Backup CWMP Tree Successful'); } // SetTR104Parameters successful } // xVoiceProfileCount == 1 else { // ------------------------------------------------------------------------------ // Adding Voice Profile was unsuccessful xMessage = "Voice profile creation failed"; logger(xLogPrefix + xMessage); } logger(xLogPrefix + 'End VoiceProfile');