DVG7111S and FreePBX

Section: Introduction

A SIP phone, or Session Initiation Protocol phone, is a device or software application that uses the SIP protocol to facilitate voice over internet protocol (VoIP) communication. SIP phones can be hardware-based (like traditional desk phones) or software-based (like mobile apps or softphones). They connect to a SIP server to initiate, maintain, and terminate calls, allowing users to make voice or video calls over the internet. SIP phones often support additional features such as call forwarding, conferencing, and messaging, making them versatile tools for both personal and business communication.

To connect a SIP phone to a PSTN (Public Switched Telephone Network) line, we'll need a VoIP gateway and IP-PBX system. In this example we'll use for gateway a DVG-7111S device which provides a cheapest solution for internet connectivity and voice communication and PBX (asterisk and freepbx) installed on Raspberry PI 2.

The D-Link DVG-7111S is a VoIP (Voice over Internet Protocol) gateway designed for home and small office use. It combines a router functionality with the ability to support voice calls over the internet, allowing users to connect traditional phones to VoIP services. The device typically features multiple Ethernet ports for wired connections, support for SIP (Session Initiation Protocol), and various security features to protect your network.

FreePBX is an open-source web-based graphical user interface (GUI) that allows users to manage and configure Asterisk, a popular open-source VoIP (Voice over Internet Protocol) server. It provides a user-friendly interface to set up and control various telephony features such as call routing, voicemail, conference calling, and user management.

Section: DVG

  • We connect FXO port to external PSTN line and FXS port to an analog phone which can be used even without PBX server. WAN port will be connected to local network. LAN can be used for additional local subnet. In our example it will not be deployed.

    After login in WEB interface of the DVG setup it is preferable to choose static IP for WAN port which will be a local IP for our LAN. In our example it is 192.168.0.8/24. For my DVG device default login username - admin and the password is empty.

  • On the VOIP setup page we enable SIP support enter two (FXO/FXS) extensions numbers and their passwords. Both (600 and 650 in our example) will be defined at PBX setup (see below). Here we should enter an IP address of SIP/PBX server, which in our case is 192.168.0.36, and port which is 5160. It differs from standard SIP port 5060 since we we use old SIP-Chan extensions. Probably SIP-Pj extensions are also working and then the port for sure should be choosed as standard one.

    The registration (after PBX sepup) of the both extansions should be successful what can be verified on VOIP status page.

  • As a next step we enable a hot line for FXO port and connect it to an additional extension (110 in our case) which will be later defined at PBX setup. That means all incoming from PSTN calls will be redirected to this number (110). As endpoint for PSTN calls we can configure in PBX any SIP phone, IVR, trunk ... according to our needs.

  • There is a less obvious step of advanced SIP settings configuration. Here we can setup UDP and SIP ports for incoming trafic from PBX. This is nessary since calling to FXO/600 extension only pick up PSTN line but do not transfer outcoming call. Since in SIP settings of FreePBX the UDP port range starts from 10000 we choose for DVG an any port number larger than this value, e.g. 11000. The SIP port should be different from already used ports, e.g. 5162.

  • Optionally, on maintaince tab, one can enable syslog to external syslog server located in another pc (e.g. 192.168.0.60). This option becomes very useful for debugging.

Section: PBX

  • Within FreePBX web application using extensions tab we define mentioned above three extensions: two SIP-Chan 600/650 for FXO/FXS lines and one SIP-PJ, 110, for incoming hot line. The password for 600/650 given here should be copied to correspondig DVG setup.

  • Next, on connectivity/trunks tab, let's define new sip_pstn_trunk. It is convenuent to choose CID as your PSTN phone number. The dialed number rules are defined with respect to your PSTN provider.

    In the outgoing sip settings tab we choose pear type, port 5162 and ip of dvg device (192.168.0.8) as host. The incoming setings are not important for us.

  • As a final step, on connectivity/outbound routes tab, we define new to_sip_pstn route with same CID and dialed number rules. It will be point out to sip_pstn_trunk.

    Dailing an external PSTN number complained with the rules the trafic will be tranfered directly to pstn line

Section: Debugging

DVG

DVG log can be viewed on syslog server (192.168.0.60) with command

sudo tail -n 20 /var/log/syslog
A sample output is shown below:
2025-10-13T18:38:59.169958+00:00 192.168.0.8   C8BE1925C640-sip: 1: Released By Peer 
2025-10-13T18:38:59.239778+00:00 192.168.0.8   C8BE1925C640-sip: 1: PlayBusyTone 
2025-10-13T18:38:59.242096+00:00 192.168.0.8   C8BE1925C640-sip: 1: Idle 
2025-10-13T18:39:32.991508+00:00 192.168.0.8   C8BE1925C640-sip: 1: WaitAnswerDeviceOk 
2025-10-13T18:39:32.995652+00:00 192.168.0.8   C8BE1925C640-sip: 1: GetDtmf 
2025-10-13T18:39:34.251003+00:00 192.168.0.8   C8BE1925C640-sip: 1: Dial 110 
2025-10-13T18:39:34.255047+00:00 192.168.0.8   C8BE1925C640-sip: 1: Inviting 
2025-10-13T18:39:36.280922+00:00 192.168.0.8   C8BE1925C640-sip: 1: Connected As Caller 
2025-10-13T18:39:36.283161+00:00 192.168.0.8   C8BE1925C640-sip: 1: Talking 
2025-10-13T18:40:46.023288+00:00 192.168.0.8   C8BE1925C640-sip: 1: Released By Peer 
2025-10-13T18:40:46.025439+00:00 192.168.0.8   C8BE1925C640-sip: 1: PlayBusyTone 
2025-10-13T18:40:49.034642+00:00 192.168.0.8   C8BE1925C640-sip: 1: Idle 
2025-10-13T18:42:35.496493+00:00 192.168.0.8   C8BE1925C640-sip: Registered [600] 

PBX

Using asterisk CLI the debug mode can be switched on/off with following commands:

#(root) asterisk -r
raspbx(CLI) logger show channels
sip set debug on
core set debug 5
core set verbose 5

core set debug 0
raspbx*CLI> sip set debug off
SIP Debugging Disabled

raspbx*CLI> logger add channel debug_1013 notice,warning,error,verbose
raspbx(CLI) logger show channels

The output is directed to console or file (e.g. debug_1013) in directory /var/log/asterisk. Here is the sample output.

<--- SIP read from UDP:192.168.0.8:5162 --->
SIP/2.0 200 OK
Allow:INVITE,ACK,OPTIONS,BYE,CANCEL,INFO,PRACK,REFER,SUBSCRIBE,NOTIFY,UPDATE
Via: SIP/2.0/UDP 192.168.0.36:5160;branch=z9hG4bK676dc540
From: "Unknown" ;tag=as72ea3cfc
To: ;tag=e47ba4f2-685875
Call-ID: 3fa0860274bd9ee54b9d13d566c311d8@192.168.10.36:5160
CSeq:102 OPTIONS
Contact: 
User-Agent:dlink 12-3856-2876-0.10.55.1-TSO
Content-Length: 0

https://sangomakb.atlassian.net/wiki/spaces/FP/pages/11862295/Configure+SPA3000+as+SIP+Trunk+FreePBX+13+PJSIP
  • Boot Linux from USB. part I

    Multiple boot using GRUB2 from live ISO files located on USB
    Read more ...

  • Boot Linux from USB. part II

    Multiple boot using SYSLINUX from live ISO files located on USB
    Read more ...

  • Tweet update.

    Added tweet on @lloadm
    Read

Responsive image