How to Change The Default Port on an AVM Fritz!Box to use with 3CX Phone System

This guide provides step by step instructions on how to change the default VoIP forwarding rule (5060 UDP/TCP) assigned to the AVM Fritz!Box, in order to use it with 3CX Phone System. We provide this guide as is and is excluded from any further assistance through 3CX Support. We can not guarantee that the changes mentioned will not impact any other functions of the device, for example, the built in telefony service. By using this guide, you agree that the changes mentioned, are made solely at your own risk. This guide is provided as a technical showcase only for the AVM Fritz!Box.

Change the default SIP ports on AVM Fritz!Box device

By downloading and reviewing the settings of the AVM Fritz!Box in NotePad++, you can see the port 5060 UDP/TCP is used by the default rule, “voip_forwardrule”, so port 5060 needed by 3CX Phone System cannot be assigned as a custom forwarding rule.

Fritz!Box-Wlan-7170Fritz!Box Fon WLAN 7170 Default Settings

In order to change this default rule that is using port 5060 UDP/TCP follow the steps below.

Enable port 23 (telnet) on Fritz!Box

The following change can not be made from the user interface and must be done through telnet (port 23).

By default telnet is disabled, to enable telnet:

  • Connect an analogue phone device with Fritz! on port “Phone 1”
  • Verify that the phone is connected (you should be able to hear the analogue tone)
  • Dial #96*7*, wait for 3 seconds and hang up the phone to open port 23 (telnet)

(You can disable telnet by following the above steps and dialing #96*8*)

Important: Always make a backup of your settings before you make any changes.

To connect to the Fritz!Box, download and run Putty.

1. Configure Putty in order to start the telnet session with Fritz!Box Fon WLAN 7170. (The example below is shows the default IP 192.168.178.1)

Fritz!Box-Putty ConfigurationPutty Configuration

2. After starting the telnet session successfully you should have the output below:

Fritz!Box-putty-OutputPutty Telnet CLI

3. Edit the file ar7.cfg which can be found under /var/flash/. You can edit the file by using nvi command :

  •  nvi /var/flash/ar7.cfg

Fritz!Box-Puttytelcommand nvi /var/flash/ar7.cfg

4. While viewing the ar7.cfg file , scroll down (using the arrow key ↓) to find the entry’s bellow at 13%:

  • Line 182: voip_forwardrules = “udp 0.0.0.0:5060 0.0.0.0:5060”.
  • Line 182: voip_forwardrules =  “udp 0.0.0.0:5060 0.0.0.0:5060″.

Fritz!Box-Putty-DeafultDefault Fritz! Port Forwarding

  • After finding the default rule that is using the port 5060 UDP/TCP, press “i” to enable editing
  • Change the ports from 5060 to, for example, 4060

Fritz!Box-Putty-ModModify the rule voip_forwardrules to use the port 4060

  • Press “esc” to exit the input mode
  • Type “:w” > Enter to save the changes
  • Type “:q” > Enter to quit the nvi (edit) mode.
  • Reboot Fritz!Box Fon WLAN 7170 by typing “reboot”

5. After rebooting the device you will be able to see, in the settings, that the default rule that was using the port 5060 UDP/TCP is now using the port 4050 UDP/TCP, as defined via the telnet session in the previous step.

Fritz!Box-Notepad++ Custom SettingsFritz!Box Fon WLAN 7170 Custom Settings – After Telnet session

6. Access AVM Fritz!Box user interface you can now assign Port 5060 (TCP/UDP) to point to your 3CX Phone System.

Fritz!Box Fon WLAN 7170 5060 NATFritz!Box Fon WLAN 7170 – Port 5060 (TCP/UDP) assigned to 3CX Phone System

Now you can proceed and assign the rest of the ports needed by 3CX Phone System. The full list of ports to assign, can be found here.

Liked this article?


Get notified of new articles
or share
You might also be interested in:
  1. Hello,

    I just discovered this blog entry. Thankyou for making this available.

    There is a more easy way to do this: after telnetting to the FritzBox, cd to /var/flash and use “nvi voip.cfg” to edit the config file.

    There you will find the SIP Port and RTP range.

    The commands for nvi are actuall the ones of “vi”: user “x” to delete a character, use “i” to start inseret mode, use “ESC” to Exit insert mode, use “ZZ” to save and exit.

    Norbert

    April 28, 2015 at 1:24 pm
    • Charalambos Eleftheriou

      Hi Norbert

      Thank you for the reply.

      April 28, 2015 at 1:35 pm