# Add VoiceProfile at AVM Devices

**URL:** <https://forum.genieacs.com/t/add-voiceprofile-at-avm-devices/5148>\
**Category:** Uncategorized\
**Created:** [February 29, 2024, 11:49am UTC](https://forum.genieacs.com/t/add-voiceprofile-at-avm-devices/5148 "2024-02-29T11:49:22Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![milka92](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@milka92](https://forum.genieacs.com/u/milka92)\
**Post date:** [February 29, 2024, 11:49am UTC](https://forum.genieacs.com/t/add-voiceprofile-at-avm-devices/5148/1 "2024-02-29T11:49:22Z")

</div>

Hello,

I’m trying to create as many voice profiles as there are numbers for the subscriber. I’ve tried many variations and combinations, but I haven’t had any luck. The script only adds 2 numbers because I fail to create a third voice profile. By default, there are two preconfigured, so I can’t even add one profile.

I would greatly appreciate any help.

```auto
    /////Voice/////
    log('Setting Voice-services');
    // Area code is only set once, as it is always the same
    declare("InternetGatewayDevice.Services.VoiceService.*.VoiceProfile.1.Line.1.SIP.X_AVM-DE_OKZ", { value: now }, { value: config.voip.sip_account[0].area_code });

    // Assumption: 'config' contains the JSON data with the SIP accounts
    if (config && config.voip && config.voip.sip_account && config.voip.sip_account.length > 0) {
    // Determine the number of VoiceProfile instances
    const numVoiceProfiles = config.voip.sip_account.length;
    
    // Ensure that the required number of VoiceProfile instances exist
    declare("InternetGatewayDevice.Services.VoiceService.2.VoiceProfile.*", null, {path: 1});

    log('Number of voice profiles: ' + numVoiceProfiles);

    // Iterate over any SIP account
    for (let [index, sipAccount] of Object.entries(config.voip.sip_account)) {
        const voiceProfilePath = `InternetGatewayDevice.Services.VoiceService.2.VoiceProfile.${Number(index) + 1}`;
        const lineNumberParam = `${voiceProfilePath}.Line.1.DirectoryNumber`;
        const authUserNameParam = `${voiceProfilePath}.Line.1.SIP.AuthUserName`;
        const authPasswordParam = `${voiceProfilePath}.Line.1.SIP.AuthPassword`;
        const registrarServerParam = `${voiceProfilePath}.SIP.RegistrarServer`;
        const enableParam = `${voiceProfilePath}.Line.1.Enable`;

        // Log the settings for the current SIP account
        log('Setze Nummer: ' + sipAccount.number);
        log('Setze Authentifizierungsnamen: ' + sipAccount.sip_user);
        log('Setze Authentifizierungspasswort: ' + sipAccount.password);

        // Set the values for the current SIP account
        declare(lineNumberParam, { value: now }, { value: sipAccount.number });
        declare(authUserNameParam, { value: now }, { value: sipAccount.sip_user });
        declare(authPasswordParam, { value: now }, { value: sipAccount.password });
        declare(registrarServerParam, { value: now }, { value: "sip.stadtwerke-soest.de" });
        declare(enableParam, { value: now }, { value: "Enabled" });
    }
} else {
    log('No Voice-Data or Error');
}

```

---

<div class="post-metadata">

**Author:** ![PeterLustig](https://avatars.discourse-cdn.com/v4/letter/p/a183cd/32.png) [@PeterLustig](https://forum.genieacs.com/u/PeterLustig)\
**Post date:** [March 1, 2024, 1:28pm UTC](https://forum.genieacs.com/t/add-voiceprofile-at-avm-devices/5148/2 "2024-03-01T13:28:17Z")

</div>

Hi Milka,  
certainly! It seems like your code is generally correct, but the issue might lie in the fact that you’re using a fixed path `InternetGatewayDevice.Services.VoiceService.2.VoiceProfile.*` when declaring the VoiceProfile instances. This means you’re creating only two VoiceProfile instances regardless of how many SIP accounts are in your configuration file.

To fix this issue, you need to ensure that you create a corresponding VoiceProfile instance for each SIP account. To do this, you should dynamically create the path based on the index of the current SIP account in the loop.

Here’s the revised part of the code that addresses this problem:

javascript

```auto
// Ensure that the required number of VoiceProfile instances exist
for (let i = 0; i < numVoiceProfiles; i++) {
    declare(`InternetGatewayDevice.Services.VoiceService.2.VoiceProfile.${i + 1}`, null, { path: 1 });
}

```

This code dynamically creates the necessary number of VoiceProfile instances based on the number of SIP accounts in your configuration file.

---

<div class="post-metadata">

**Author:** ![milka92](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@milka92](https://forum.genieacs.com/u/milka92)\
**Post date:** [March 1, 2024, 2:35pm UTC](https://forum.genieacs.com/t/add-voiceprofile-at-avm-devices/5148/3 "2024-03-01T14:35:15Z")

</div>

Hi PeterLustig,  
I tried it this way and still only two numbers are installed and no third profile is created.  
But the “+” Button at the interface works well…

 ![Screenshot 2024-03-01 153214](https://canada1.discourse-cdn.com/flex035/uploads/genieacs/original/2X/1/118368f84b1c78c7ad477ef529027510b992e9c5.png)

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [March 1, 2024, 5:44pm UTC](https://forum.genieacs.com/t/add-voiceprofile-at-avm-devices/5148/4 "2024-03-01T17:44:26Z")

</div>

Please do not use the method suggested. Instance ids are **not guaranteed**.

Use this script:

```javascript

/////Voice/////
log('Setting Voice-services');
// Area code is only set once, as it is always the same
declare("InternetGatewayDevice.Services.VoiceService.*.VoiceProfile.1.Line.1.SIP.X_AVM-DE_OKZ", { value: now }, { value: config.voip.sip_account[0].area_code });

// Assumption: 'config' contains the JSON data with the SIP accounts
if (config && config.voip && config.voip.sip_account && config.voip.sip_account.length > 0) {
    // Ensure that the required number of VoiceProfile instances exist
    declare("InternetGatewayDevice.Services.VoiceService.2.VoiceProfile.*", null, {path: 1});

    log('Number of voice profiles: ' + config.voip.sip_account.length);

    // Clear out existing entries. No changes are actually made until the end. If there is no actual changes
    // then nothing will be sent to the CPE
    declare(`${basePath}.[]`, null, {path: 0});

    const basePath = 'InternetGatewayDevice.Services.VoiceService.2.VoiceProfile';
    // Iterate over any SIP account
    for (let [index, sipAccount] of Object.entries(config.voip.sip_account)) {
        let params = {
            DirectoryNumber: sipAccount.number,
            AuthUserName: sipAccount.sip_user,
            AuthPassword: sipAccount.password,
            RegistrarServer: 'sip.stadtwerke-soest.de',
            Enable: true
        };

        const path = basePath + '.[' + Object.keys(params).map(key => key + ':' + params[key]).join(',') + ']';
        declare(path, {path: 1}, {path: 1});

        // Log the settings for the current SIP account
        log('Setze Nummer: ' + sipAccount.number);
        log('Setze Authentifizierungsnamen: ' + sipAccount.sip_user);
        log('Setze Authentifizierungspasswort: ' + sipAccount.password);
    }
} else {
    log('No Voice-Data or Error');
}

```

---

<div class="post-metadata">

**Author:** ![milka92](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@milka92](https://forum.genieacs.com/u/milka92)\
**Post date:** [March 1, 2024, 6:37pm UTC](https://forum.genieacs.com/t/add-voiceprofile-at-avm-devices/5148/5 "2024-03-01T18:37:00Z")

</div>

Hi akcoder,

Thank you for your assistance. I’ve attempted to implement your code and encountered the following issue:

```auto
Channel has faulted; channel="bootstrap" retries=0 faultCode="script.ReferenceError" faultMessage="Cannot access 'basePath' before initialization"

```

Upon moving the `const basePath` declaration before its usage for initialization, I seem to have encountered a loop:

```auto
Channel has faulted; channel="bootstrap" retries=0 faultCode="too_many_commits" faultMessage="Too many commit iterations"

```

Update: It appears that the loop occurred during the creation of the VoiceProfile.

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [March 1, 2024, 7:05pm UTC](https://forum.genieacs.com/t/add-voiceprofile-at-avm-devices/5148/6 "2024-03-01T19:05:42Z")

</div>

```javascript
/////Voice/////
log('Setting Voice-services');
// Area code is only set once, as it is always the same
declare("InternetGatewayDevice.Services.VoiceService.*.VoiceProfile.1.Line.1.SIP.X_AVM-DE_OKZ", { value: now }, { value: config.voip.sip_account[0].area_code });

// Assumption: 'config' contains the JSON data with the SIP accounts
if (config && config.voip && config.voip.sip_account && config.voip.sip_account.length > 0) {
    // Ensure that the required number of VoiceProfile instances exist
    declare("InternetGatewayDevice.Services.VoiceService.2.VoiceProfile.*", null, {path: 1});

    log('Number of voice profiles: ' + config.voip.sip_account.length);

    const basePath = 'InternetGatewayDevice.Services.VoiceService.2.VoiceProfile';

    // Clear out existing entries. No changes are actually made until the end. If there is no actual changes
    // then nothing will be sent to the CPE
    declare(`${basePath}.[]`, null, {path: 0});

    // Iterate over any SIP account
    for (let [index, sipAccount] of Object.entries(config.voip.sip_account)) {
        let params = {
            DirectoryNumber: sipAccount.number,
            AuthUserName: sipAccount.sip_user,
            AuthPassword: sipAccount.password,
            RegistrarServer: 'sip.stadtwerke-soest.de',
            Enable: true
        };

        const path = basePath + '.[' + Object.keys(params).map(key => key + ':' + params[key]).join(',') + ']';
        declare(path, {path: 1}, {path: 1});

        // Log the settings for the current SIP account
        log('Setze Nummer: ' + sipAccount.number);
        log('Setze Authentifizierungsnamen: ' + sipAccount.sip_user);
        log('Setze Authentifizierungspasswort: ' + sipAccount.password);
    }
} else {
    log('No Voice-Data or Error');
}

```

---

<div class="post-metadata">

**Author:** ![milka92](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@milka92](https://forum.genieacs.com/u/milka92)\
**Post date:** [March 1, 2024, 7:40pm UTC](https://forum.genieacs.com/t/add-voiceprofile-at-avm-devices/5148/7 "2024-03-01T19:40:23Z")

</div>

Hi akcode,

I see, it seems that moving `const basePath` didn’t resolve the loop issue.

```auto
2024-03-01T19:37:40.650Z [WARN] ::ffff:100.65.0.128 00040E-FRITZ%21Box-DC15C84E2603: CPE fault; acsRequestId="18dfb85ad51003f" cpeFaultCode="9005" cpeFaultString="Invalid parameter name"
2024-03-01T19:37:40.657Z [INFO] ::ffff:100.65.0.128 00040E-FRITZ%21Box-DC15C84E2603: ACS request; acsRequestId="18dfb85ad510040" acsRequestName="GetParameterNames"
2024-03-01T19:37:40.709Z [INFO] ::ffff:100.65.0.128 00040E-FRITZ%21Box-DC15C84E2603: ACS request; acsRequestId="18dfb85ad510041" acsRequestName="GetParameterNames"
2024-03-01T19:37:40.734Z [INFO] ::ffff:100.65.0.128 00040E-FRITZ%21Box-DC15C84E2603: ACS request; acsRequestId="18dfb85ad510042" acsRequestName="GetParameterValues"
2024-03-01T19:37:40.747Z [INFO] ::ffff:100.65.0.128 00040E-FRITZ%21Box-DC15C84E2603: ACS request; acsRequestId="18dfb85ad510043" acsRequestName="AddObject"
2024-03-01T19:37:40.755Z [INFO] ::ffff:100.65.0.128 00040E-FRITZ%21Box-DC15C84E2603: ACS request; acsRequestId="18dfb85ad510044" acsRequestName="GetParameterValues"
2024-03-01T19:37:40.765Z [WARN] ::ffff:100.65.0.128 00040E-FRITZ%21Box-DC15C84E2603: CPE fault; acsRequestId="18dfb85ad510044" cpeFaultCode="9005" cpeFaultString="Invalid parameter name"
2024-03-01T19:37:40.772Z [WARN] ::ffff:100.65.0.128 00040E-FRITZ%21Box-DC15C84E2603: Channel has faulted; channel="bootstrap" retries=0 faultCode="too_many_commits" faultMessage="Too many commit iterations"
2024-03-01T19:37:40.773Z [WARN] ::ffff:100.65.0.128 00040E-FRITZ%21Box-DC15C84E2603: Channel has faulted; channel="default" retries=0 faultCode="too_many_commits" faultMessage="Too many commit iterations"
2024-03-01T19:37:40.773Z [WARN] ::ffff:100.65.0.128 00040E-FRITZ%21Box-DC15C84E2603: Channel has faulted; channel="inform" retries=0 faultCode="too_many_commits" faultMessage="Too many commit iterations"

```

---

<div class="post-metadata">

**Author:** ![dakonr](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/dakonr/32/1279_2.png) [@dakonr](https://forum.genieacs.com/u/dakonr)\
**Post date:** [July 12, 2025, 8:35pm UTC](https://forum.genieacs.com/t/add-voiceprofile-at-avm-devices/5148/9 "2025-07-12T20:35:25Z")

</div>

Hi, I’m facing same difficulties to setup AVM FritzBoxes via GenieACS.  
Does anyone can share some Skripts to Setup a WAN Connection with PPPoE and Installing VoIP Lines? That would be helpful! Thanks!

---

<div class="post-metadata">

**Author:** ![milka92](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@milka92](https://forum.genieacs.com/u/milka92)\
**Post date:** [July 13, 2025, 4:15am UTC](https://forum.genieacs.com/t/add-voiceprofile-at-avm-devices/5148/10 "2025-07-13T04:15:05Z")

</div>

Hi @dakonr,  
It’s understandable that setting up AVM FritzBoxes via GenieACS can be quite challenging. Most people probably won’t share their full provisioning scripts here, as there’s usually a lot of work and customization involved.  
However, there are some example snippets shared in the forum that can really help and serve as a solid starting point. Especially the ones related to InternetGatewayDevice.WANPPPConnection and VoiceService.1.VoiceProfile.1 are quite useful.  
Just search for those examples – they can take you a long way.  
Good luck!

---

<div class="post-metadata">

**Author:** ![Zelinuppy](https://avatars.discourse-cdn.com/v4/letter/z/df705f/32.png) [@Zelinuppy](https://forum.genieacs.com/u/Zelinuppy)\
**Post date:** [October 2, 2025, 4:31pm UTC](https://forum.genieacs.com/t/add-voiceprofile-at-avm-devices/5148/11 "2025-10-02T16:31:19Z")

</div>

I had to manually create the VoiceProfile tree under VoiceService first, then refresh to load available parameters before setting values; worked fine after that with my AVM device.

---

<div class="post-metadata">

**Author:** ![Zelinuppy](https://avatars.discourse-cdn.com/v4/letter/z/df705f/32.png) [@Zelinuppy](https://forum.genieacs.com/u/Zelinuppy)\
**Post date:** [October 10, 2025, 11:30am UTC](https://forum.genieacs.com/t/add-voiceprofile-at-avm-devices/5148/12 "2025-10-10T11:30:29Z")

</div>

Ran into this trying to set up multiple lines at home. The system only lets you create extra voice profiles if you delete or repurpose the defaults first. Once I did that, adding more numbers worked fine. I also tested a few calls using [activecalls](https://activecalls.com) to make sure all the new profiles were routing correctly, and it went through without issues.
