← All Tutorials

Dinstar GSM Gateway Integration with ViciDial/Asterisk

Infrastructure & DevOps Advanced 38 min read #27

Dinstar GSM Gateway Integration with ViciDial/Asterisk

Connect a physical GSM gateway to your ViciDial call center for making and receiving calls over cellular networks — complete with NAT traversal, inbound/outbound routing, and production troubleshooting.


Table of Contents

  1. Why GSM Gateways?
  2. Hardware Overview: Dinstar UC2000-VE
  3. Network Architecture and NAT Scenarios
  4. Prerequisites
  5. ViciDial Server Configuration
  6. Dinstar Gateway Configuration
  7. Applying Configuration and Reloading
  8. Testing
  9. Troubleshooting
  10. Multi-SIM and Scaling
  11. Production Tips
  12. Quick Reference Checklist

1. Why GSM Gateways?

A GSM gateway is a physical device that bridges the gap between your VoIP/SIP infrastructure and the cellular (GSM/LTE) network. It holds one or more SIM cards and appears to Asterisk as a standard SIP trunk, while on the other side it communicates with the mobile network like a regular phone.

There are several practical reasons to add a GSM gateway to a ViciDial call center:

Cost Reduction

Mobile-to-mobile calls are often cheaper than landline-to-mobile calls in many countries. If your agents are calling mobile numbers (which in most markets is 70-90% of all numbers), routing those calls through a local SIM card can dramatically reduce per-minute costs. In some markets, operators offer unlimited mobile-to-mobile plans for a flat monthly fee, effectively making your outbound calls free.

Local Presence

Calls placed through a local SIM card show a local mobile number as the Caller ID. Recipients are far more likely to answer a call from a local mobile number than from an international VoIP number or a blocked/anonymous caller. In markets like Albania, Italy, or Eastern Europe, this difference in answer rates can be 30-50%.

Regulatory Compliance

Some countries restrict or tax VoIP-originated calls to mobile networks. Routing through a GSM gateway means the call enters the mobile network as a native GSM call, avoiding these restrictions entirely.

Redundancy

If your SIP trunks go down (provider outage, internet routing issue, DDoS), a GSM gateway on a separate network connection gives you an emergency outbound path. Agents can still reach customers while you resolve the primary trunk issue.

Inbound Flexibility

You can receive calls on mobile numbers and route them directly into your ViciDial inbound queue. This is useful when you distribute mobile numbers on business cards, flyers, or local advertisements, and want those calls handled by your call center agents.


2. Hardware Overview: Dinstar UC2000-VE

The Dinstar UC2000 series is a family of GSM/WCDMA/LTE VoIP gateways widely used in call center environments. The UC2000-VE is the mid-range model with the following specifications:

Specification Detail
Model UC2000-VE
SIM Slots 8 ports (each holds one SIM card)
Concurrent Calls 1 per SIM (8 maximum with all ports populated)
Network Interface 1x 10/100 Ethernet (RJ-45)
SIP Protocol SIP 2.0 (RFC 3261)
Codecs G.711 A-law, G.711 U-law, G.729, G.723.1
DTMF RFC 2833, SIP INFO, In-band
Management Web UI (HTTP), SSH/Telnet CLI
Power 12V DC adapter
Antenna External GSM antenna (SMA connectors), one per port or shared
SIM Format Standard SIM (2FF) — use adapters for micro/nano SIMs

Key Concepts

Physical Setup

  1. Mount the gateway in a location with good GSM signal (near a window, or use external antennas with extension cables)
  2. Insert SIM cards — ensure PIN lock is disabled on each SIM before inserting (put the SIM in a phone first and disable PIN if needed)
  3. Connect Ethernet to your LAN
  4. Connect power — the gateway boots in about 60 seconds
  5. Access the web interface at the gateway's IP address (default: DHCP, or check your router's DHCP leases)

3. Network Architecture and NAT Scenarios

Understanding the network topology is critical because GSM gateways are almost always behind NAT, while ViciDial servers are typically on public IPs. NAT causes problems for SIP because SIP embeds IP addresses inside its message bodies (SDP), and NAT rewrites only the outer IP header, not the payload.

Typical Deployment

                        INTERNET
                           |
        ┌──────────────────┼──────────────────────┐
        |                  |                       |
        |   ViciDial       |                       |
        |   VICIDIAL_IP    |                       |
        |   (Public IP)    |                       |
        |   UDP 5060 SIP   |                       |
        |   UDP 10000-     |                       |
        |   20000 RTP      |                       |
        |                  |                       |
        └──────────────────┘                       |
                                            NAT Router/Firewall
                                            GATEWAY_PUBLIC_IP
                                                   |
                                            ┌──────┴──────┐
                                            |  LAN         |
                                            |  e.g.        |
                                            |  192.168.1.0 |
                                            |  /24         |
                                            |              |
                                            |  Dinstar     |
                                            |  GATEWAY_    |
                                            |  PRIVATE_IP  |
                                            |  UC2000-VE   |
                                            |  Ports 1-8   |
                                            └──────────────┘
                                                   |
                                               GSM Network
                                                   |
                                             Mobile Phones

Three NAT Scenarios

Scenario Gateway IP ViciDial Sees Configuration Approach
A: Static public NAT Private IP behind NAT with a known, stable public IP Always the same IP Use IP peer mode on ViciDial. Set host=GATEWAY_PUBLIC_IP. Configure static NAT IP on Dinstar.
B: Dynamic public NAT Private IP behind NAT with a changing public IP (typical ADSL/4G) Different IP after each reconnect Use registration mode. Set host=dynamic + secret=PASSWORD on ViciDial. Enable registration on Dinstar.
C: Public IP on gateway Gateway has a public IP directly (rare, datacenter deployment) The gateway's own IP Use IP peer mode. No NAT traversal needed.

Scenario A is the most common in office deployments with a business internet connection. Scenario B is necessary when the gateway is on a residential or mobile connection. This tutorial covers both.

Ports That Must Be Open

Direction Protocol Port(s) Purpose
Gateway -> ViciDial UDP 5060 SIP signaling
Gateway -> ViciDial UDP 10000-20000 RTP audio streams
ViciDial -> Gateway UDP 5060 SIP signaling (responses, BYE)
ViciDial -> Gateway UDP 8000-8100 RTP audio (Dinstar's RTP range)

Note on RTP: ViciDial typically has a wide RTP range (10000-20000 or 10000-65000) already open to all IPs. The Dinstar's RTP range is configurable (default 8000-8100 for 8 ports). With nat=force_rport,comedia on ViciDial and NAT traversal enabled on the Dinstar, RTP usually works through NAT without explicit port forwarding, because both sides learn the correct address from the actual packets rather than the SDP.


4. Prerequisites

Before starting, you need:

Item Details
ViciDial server Running Asterisk 11+ with chan_sip or PJSIP. This tutorial uses chan_sip syntax. Server must have a public IP with UDP 5060 accessible.
ViciDial admin access Level 9 admin account to create carriers, DIDs, and inbound groups
SSH access to ViciDial Root or sudo access for firewall rules and Asterisk CLI
Dinstar UC2000-VE Powered on, connected to LAN, web UI accessible
SIM card(s) Active, with credit/balance, PIN lock disabled, data plan not required
Gateway's public IP For Scenario A: the static public IP of the NAT router. Find it by visiting whatismyip.com from the same network
Network connectivity The gateway must be able to reach the ViciDial server's public IP on UDP 5060

Placeholder Reference

Throughout this tutorial, replace these placeholders with your actual values:

Placeholder Description Example
VICIDIAL_IP Public IP of your ViciDial/Asterisk server 203.0.113.50
GATEWAY_PRIVATE_IP Dinstar's LAN IP address 192.168.1.100
GATEWAY_PUBLIC_IP Public IP that NAT gives to the Dinstar's traffic 198.51.100.25
NAT_GATEWAY_IP LAN IP of the NAT router (Dinstar's default gateway) 192.168.1.1
SIM_MOBILE_NUMBER The phone number of the SIM card in the gateway +39333123456
PEER_PASSWORD SIP authentication password (only for registration mode) S3cure_GSM_2026
DIAL_PREFIX Prefix used in ViciDial campaigns to route through this carrier 88

5. ViciDial Server Configuration

All steps in this section are performed on your ViciDial server.

5.1 Firewall Rules

ViciDial servers typically use iptables with a whitelist approach for SIP traffic — UDP 5060 is blocked by default, and only known SIP provider IPs are allowed. You must add the Dinstar's public IP.

Find the Dinstar's public IP first. From a computer on the same LAN as the Dinstar, visit https://whatismyip.com or run:

curl -s https://ifconfig.me

Add the firewall rule on ViciDial:

# SSH to your ViciDial server
ssh root@VICIDIAL_IP

# Check current iptables rules to find the right insertion point
# Look for the line number of the final DROP/REJECT rule for UDP 5060
iptables -L INPUT -n --line-numbers | grep -E "5060|DROP"

# Insert an ACCEPT rule BEFORE the DROP rule
# Replace LINE_NUMBER with the position before the DROP
# Replace GATEWAY_PUBLIC_IP with the actual public IP
iptables -I INPUT LINE_NUMBER -p udp -s GATEWAY_PUBLIC_IP -j ACCEPT

# Verify the rule was added correctly
iptables -L INPUT -n --line-numbers | grep GATEWAY_PUBLIC_IP

# Save the rules so they persist after reboot
# On CentOS/ViciBox (openSUSE):
iptables-save > /etc/sysconfig/iptables

# On Debian/Ubuntu:
iptables-save > /etc/iptables/rules.v4

If your server uses ipset (common on ViciBox setups with many SIP providers):

# Check if there's an existing ipset for SIP providers
ipset list -name

# If there's a set like 'sip-providers', add the IP to it:
ipset add sip-providers GATEWAY_PUBLIC_IP

# Save ipset so it persists:
ipset save > /etc/ipset.conf

Important: If the gateway's public IP changes (dynamic NAT, Scenario B), you will need to update this firewall rule each time. In that case, consider either: (a) allowing the entire ISP subnet, (b) using a VPN tunnel, or (c) implementing a dynamic DNS solution with a script that updates iptables.

5.2 SIP Peer (Carrier) Configuration

In ViciDial, SIP trunks are managed as "Carriers." Navigate to:

ViciDial Admin -> Admin -> Carriers -> Add A New Carrier

Field Value
Carrier ID DINSTAR_GSM
Carrier Name Dinstar GSM Gateway
Protocol SIP
Registration String (leave blank)
Global String (leave blank)

Account Entry — Scenario A: IP Peer Mode (Static Public IP)

Paste this into the Account Entry field:

[dinstar_gsm]
type=peer
host=GATEWAY_PUBLIC_IP
port=5060
context=trunkinbound
disallow=all
allow=alaw
allow=ulaw
insecure=port,invite
dtmfmode=rfc2833
qualify=yes
nat=force_rport,comedia
directmedia=no

Account Entry — Scenario B: Registration Mode (Dynamic Public IP)

If the gateway's public IP is not static, use registration mode instead:

[dinstar_gsm]
type=friend
host=dynamic
secret=PEER_PASSWORD
context=trunkinbound
disallow=all
allow=alaw
allow=ulaw
insecure=port,invite
dtmfmode=rfc2833
qualify=yes
nat=force_rport,comedia
directmedia=no

Parameter Explanation

Parameter Purpose
type=peer IP-based authentication (no password needed, trusts the source IP). Use type=friend for registration mode.
host=GATEWAY_PUBLIC_IP The IP address ViciDial sends SIP packets to. Use host=dynamic if the gateway registers.
port=5060 Standard SIP port.
context=trunkinbound The Asterisk dialplan context for incoming calls from this peer. ViciDial's trunkinbound context routes calls to the DID matching logic.
disallow=all / allow=alaw,ulaw Force G.711 codecs only. GSM audio is transcoded to G.711 by the gateway — adding G.729 here would cause double transcoding and worse quality.
insecure=port,invite Accept SIP INVITE requests without requiring authentication. Necessary because the gateway may send from a different port than it registered from (NAT rewriting).
dtmfmode=rfc2833 Send DTMF tones as RTP events (RFC 2833/4733). Must match the Dinstar's DTMF setting. In-band DTMF is unreliable over VoIP; SIP INFO adds latency. RFC 2833 is the standard.
qualify=yes Send SIP OPTIONS every 60 seconds to check if the peer is alive. ViciDial shows "OK" or "UNREACHABLE" in the carrier status.
nat=force_rport,comedia Critical for NAT. force_rport makes Asterisk use the source port from the actual packet (not the Via header). comedia makes Asterisk send RTP to the address it receives RTP from (not the SDP address). Together, these solve most NAT-related one-way audio problems.
directmedia=no Force all RTP through the Asterisk server (no direct media between endpoints). Required because the Dinstar is behind NAT and cannot receive direct RTP from agents' phones.

5.3 Outbound Dialplan Entry

The Dialplan Entry field in the carrier configuration defines how ViciDial routes outbound calls to the Dinstar. You need a dial prefix pattern so that only calls intended for the GSM gateway are sent there.

Paste this into the Dialplan Entry field:

; Outbound via Dinstar GSM Gateway
; Prefix 88 is stripped before sending to the gateway
; Example: agent dials 88393331234567 -> sends 393331234567 to Dinstar -> GSM
exten => _88X.,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _88X.,n,Dial(SIP/dinstar_gsm/${EXTEN:2},,tTo)
exten => _88X.,n,Hangup()

How the prefix works:

  1. ViciDial prepends 88 to the phone number before dialing (configured per-campaign in the Dial Prefix field)
  2. Asterisk matches the pattern _88X. (starts with 88, followed by one or more digits)
  3. ${EXTEN:2} strips the first 2 characters (the 88 prefix), passing only the actual phone number to the Dinstar
  4. The Dinstar receives the number and places the call through the GSM network

Choosing a prefix: The prefix (88 in this example) must not conflict with any real phone number patterns or other carrier prefixes in your dialplan. Common choices are 88, 77, 55, or any two-digit combination not used by your other carriers. Each GSM carrier can have its own unique prefix.

After saving the carrier:

  1. Click Submit Carrier
  2. Return to the carrier page and click RELOAD CARRIER
  3. Or restart Asterisk for a clean reload

5.4 Inbound DID Routing

When someone calls the SIM card's mobile number, the Dinstar forwards the call to ViciDial via SIP. ViciDial needs a DID entry to match and route this call.

Navigate to: ViciDial Admin -> Admin -> Inbound DID -> Add New DID

Field Value
DID Extension SIM_MOBILE_NUMBER (e.g., 393331234567)
DID Route IN_GROUP
In-Group Select the inbound group (see next step)

Critical detail: The DID Extension must exactly match the value the Dinstar sends as the called number (the SIP To/RURI). This is configured on the Dinstar as "To VOIP Hotline" in the Port Group settings (Section 6.3). You must set both to the same value. If you are unsure what the Dinstar sends, set up SIP debug on Asterisk (sip set debug peer dinstar_gsm) and make a test inbound call to see the INVITE URI.

Alternative: Wildcard DID

If you want all unmatched inbound calls from the Dinstar to go to a single group, you can create a DID with extension _X. or use ViciDial's default DID routing. However, explicit DID entries are recommended for clarity and control.

5.5 Inbound Group Setup

If you do not already have an inbound group for GSM calls, create one:

Navigate to: ViciDial Admin -> Admin -> Inbound Groups -> Add New Group

Field Value
Group ID gsm_inbound
Group Name GSM Inbound Calls
Campaign Assign to the relevant campaign
Queue Priority 0 (default)
Drop Action MESSAGE or HANGUP (your preference)
Drop Seconds 120 (how long to wait for an agent before dropping)

Configure agent assignments, call handling, and other settings according to your operational needs. The key point is that this group must be referenced by the DID entry from the previous step.


6. Dinstar Gateway Configuration

Access the Dinstar web interface by browsing to: http://GATEWAY_PRIVATE_IP

Default credentials are typically admin / admin. Change these after initial setup.

Firmware note: Menu labels and layout may vary slightly between firmware versions. The Dinstar UC2000-VE has been through several firmware revisions. Look for equivalent settings if the exact menu names in this tutorial do not match your unit. The core concepts (SIP profile, trunk, port group, routing) are the same across all versions.

6.1 SIP Profile (Codecs, DTMF, NAT)

Navigate to: Call Configuration -> SIP Configuration (or SIP Profile)

This defines the SIP behavior for the entire gateway.

Parameter Value Notes
Local SIP Port 5060 Standard SIP port
Codec First PCMA (G.711 A-law) Best quality for European GSM (GSM-FR is A-law based)
Codec Second PCMU (G.711 U-law) Fallback codec (North American preference)
Codec Third G.729 Low-bandwidth fallback (avoid if possible — double transcoding)
DTMF Mode RFC2833 Must match ViciDial peer config
RFC2833 Payload 101 Standard payload type
NAT Traversal Enable Required when gateway is behind NAT
STUN Server stun.l.google.com:19302 Free STUN server for NAT discovery
Static NAT IP GATEWAY_PUBLIC_IP Set this if your public IP is static (more reliable than STUN)
RTP Start Port 8000 Beginning of RTP port range
RTP Port Count 100 Gives range 8000-8100 (more than enough for 8 ports)

Codec Selection Rationale:

The GSM network uses its own codec (GSM-FR, AMR, or AMR-WB depending on the carrier). The Dinstar transcodes GSM audio to whatever codec you select in the SIP profile. G.711 (PCMA/PCMU) at 64 kbps is the best choice because:

Avoid G.729 unless bandwidth is severely constrained, because the call would be double-transcoded (GSM -> G.729 on the Dinstar, then G.729 -> G.711 on Asterisk if the agent phone uses G.711), resulting in noticeable quality degradation.

NAT Traversal:

Since the Dinstar sits on a private LAN, it does not know its own public IP. Without NAT traversal, it would embed its private IP (192.168.x.x) in SIP Contact and SDP headers, causing the ViciDial server to send RTP to an unreachable address (one-way or no audio).

Saving this page may restart the Dinstar's SIP service. Existing calls will drop. Plan configuration changes during maintenance windows.

6.2 SIP Trunk to ViciDial

Navigate to: Call Configuration -> SIP Trunk Configuration

This defines the connection to your ViciDial server.

Mode A: IP Peer Mode (Recommended for Static Public IP)

Parameter Value Notes
Index 0 Trunk number (0-based)
Description vicidial Friendly name
IP Address VICIDIAL_IP Your ViciDial server's public IP
Port 5060 SIP port on ViciDial
Transport UDP Standard for VoIP
Register OFF IP peer mode, no registration
Heartbeat ON Sends periodic SIP OPTIONS to check connectivity
Heartbeat Period 30 Seconds between heartbeat packets
SIP Profile (select the profile from Step 6.1)
Domain VICIDIAL_IP Used in SIP From/To headers

Mode B: Registration Mode (For Dynamic Public IP)

Parameter Value Notes
Index 0 Trunk number
Description vicidial Friendly name
IP Address VICIDIAL_IP Your ViciDial server's public IP
Port 5060 SIP port on ViciDial
Transport UDP Standard
Register ON Gateway registers with ViciDial
Heartbeat ON Keep-alive through NAT
Heartbeat Period 30 Seconds
SIP Profile (select profile)

When using registration mode, the Port Group (next step) must include the matching username and password, and the ViciDial carrier must use host=dynamic with a secret (see Section 5.2, Scenario B).

6.3 Port Group Configuration

Navigate to: Call Configuration -> Port Group Configuration

A port group bundles one or more physical SIM ports under a single SIP identity. Calls from ViciDial are distributed across the ports in the group.

Parameter Value Notes
Index 1 Port group number
Description SIMGROUP Friendly name
SIP User ID dinstar_gsm Must match the [dinstar_gsm] peer name on ViciDial
Authenticate ID dinstar_gsm Same as SIP User ID
Password (blank for IP peer mode) Set to PEER_PASSWORD for registration mode
To VOIP Hotline SIM_MOBILE_NUMBER Critical — the called number sent to ViciDial for inbound calls. Must match the DID entry in ViciDial (Section 5.4)
Register To Sip-trunk-0<vicidial> Links this port group to the trunk from Step 6.2
Mode Ascending Port selection order (Ascending, Descending, or Round-Robin)
Ports Select all ports with SIMs Check the boxes for populated ports

Understanding "To VOIP Hotline":

This is the most commonly misconfigured setting. When an external caller dials the SIM's mobile number, the Dinstar receives the GSM call and must forward it to ViciDial via SIP. The "To VOIP Hotline" value becomes the Request-URI (called number) in the SIP INVITE sent to ViciDial. ViciDial's DID matching logic compares this value against your DID entries to determine where to route the call.

If the "To VOIP Hotline" is 393331234567, then ViciDial must have a DID with extension 393331234567. If they do not match, the call will fail with "no matching DID" or route to the wrong destination.

Port Selection Modes:

Mode Behavior
Ascending Always tries the lowest-numbered port first. Good for single-SIM setups.
Descending Tries the highest-numbered port first.
Round-Robin Distributes calls evenly across ports. Best for multi-SIM setups to balance wear on SIM cards.

6.4 Outbound Routing: IP to Tel

Navigate to: Call Configuration -> IP to Tel Routing

This tells the Dinstar what to do when a SIP call arrives from ViciDial: send it out through a GSM port.

Parameter Value Notes
Index 1 Route number
Description Outbound to GSM Friendly name
Source Sip-trunk-0<vicidial> Calls arriving from this SIP trunk...
Destination Port-group-1<SIMGROUP> ...are sent out through this port group
Call Restriction Allow Call Enable this route
Source Prefix (leave blank) Accept all numbers. Or set a prefix to filter.

Multiple routes: If you have multiple port groups (e.g., different SIMs for different countries), you can create multiple IP-to-Tel routes with different source prefixes. For example, route numbers starting with 39 through an Italian SIM and numbers starting with 355 through an Albanian SIM.

6.5 Inbound Routing: Tel to IP

Navigate to: Call Configuration -> Tel to IP Routing

This tells the Dinstar what to do when a GSM call arrives on a SIM: forward it to ViciDial via SIP.

Parameter Value Notes
Index 1 Route number
Description Inbound from GSM Friendly name
Source Port-group-1<SIMGROUP> Calls arriving from GSM on this port group...
Destination Sip-trunk-0<vicidial> ...are forwarded to ViciDial via this SIP trunk
Call Restriction Allow Call Enable this route

6.6 Number Manipulation

Navigate to: Call Configuration -> Manipulation (or Number Manipulation)

Number manipulation rules modify the caller or callee number before the call is placed. This is often necessary because:

Outbound (IP to Tel) Manipulation

Action When to Use Example
Strip callee prefix ViciDial sends international format but SIM dials local Strip 39 (2 digits) from callee: 393331234567 becomes 3331234567
Add callee prefix ViciDial sends short numbers but SIM needs full number Add 0039 to callee: 3331234567 becomes 00393331234567
Set caller ID Override the caller ID for outbound GSM calls Set a specific number or use the SIM's own number

Inbound (Tel to IP) Manipulation

Action When to Use Example
Add caller prefix Normalize inbound caller IDs to international format Add 39 to caller: 3331234567 becomes 393331234567
Strip caller prefix Remove leading zeros or country codes Strip 0 from caller: 03331234567 becomes 3331234567

Testing tip: Make a test call before and after adding manipulation rules. Check the Asterisk CLI (sip set debug peer dinstar_gsm) to see exactly what number arrives in the SIP INVITE. Adjust manipulation rules until the number format matches what your ViciDial campaigns and DIDs expect.


7. Applying Configuration and Reloading

After completing all configuration on both sides, you need to apply changes.

On ViciDial

# Option 1: Reload the carrier from ViciDial Admin
# Go to Admin -> Carriers -> DINSTAR_GSM -> click "RELOAD CARRIER"

# Option 2: Force a full config rebuild and reload via CLI
ssh root@VICIDIAL_IP

# Trigger ViciDial config rebuild
mysql -e "UPDATE servers SET rebuild_conf_files='Y' WHERE server_ip='VICIDIAL_IP';" asterisk

# Wait 30-60 seconds for the keepalive process to pick up the change, then:
asterisk -rx "sip reload"
asterisk -rx "dialplan reload"

On the Dinstar

Most Dinstar configuration changes take effect immediately or after clicking "Save" on each page. Some changes (notably codec changes and SIP profile modifications) trigger an automatic SIP service restart, which will drop any active calls.

If changes do not seem to take effect:

  1. Try the "Apply" or "Save & Apply" button (firmware-dependent)
  2. Reboot the gateway from: System -> Reboot (or power cycle)

8. Testing

8.1 Connectivity Test

Check SIP peer status from Asterisk:

ssh root@VICIDIAL_IP

# Show the Dinstar peer details
asterisk -rx "sip show peer dinstar_gsm"

# Quick status check — look for OK (latency) or UNREACHABLE
asterisk -rx "sip show peers" | grep dinstar

# If using registration mode, check registration status
asterisk -rx "sip show registry"

Expected output for a healthy peer:

dinstar_gsm    GATEWAY_PUBLIC_IP    5060    OK (45 ms)

If it shows UNREACHABLE:

Check SIM status on the Dinstar:

In the Dinstar web UI, navigate to Status -> Port Status (or GSM Status). Each port should show:

Port SIM Status GSM Registration Signal Strength
Port 1 Inserted Registered 4/5 or better

If the SIM shows "Not Registered" or "No SIM," see Troubleshooting (Section 9).

8.2 Outbound Call Test

Test a call from ViciDial through the GSM gateway to a mobile phone.

Method 1: Manual Dial from Agent Interface

  1. Log into ViciDial as an agent
  2. Click "Manual Dial" or use the dial pad
  3. Enter: DIAL_PREFIX + COUNTRY_CODE + MOBILE_NUMBER (e.g., 88393331234567)
  4. The call should ring the mobile phone

Method 2: Asterisk CLI Originate

# From the ViciDial server, originate a test call
asterisk -rx "channel originate SIP/dinstar_gsm/MOBILE_NUMBER application Playback hello-world"

Method 3: Campaign Test

  1. Create a test campaign or use an existing one
  2. Set the Dial Prefix to your chosen prefix (e.g., 88)
  3. Set the carrier to DINSTAR_GSM
  4. Load a test lead and let the dialer call it

Monitor the call in real time:

# Watch SIP signaling for the Dinstar peer
asterisk -rx "sip set debug peer dinstar_gsm"

# In another terminal, watch active channels
watch -n 1 'asterisk -rx "core show channels" | grep -i dinstar'

You should see an INVITE going out, a 100 Trying, 180 Ringing, and 200 OK (call answered) in the SIP debug.

8.3 Inbound Call Test

  1. From any mobile phone, call the SIM card's number (SIM_MOBILE_NUMBER)
  2. The call should arrive at ViciDial and route to the configured inbound group
  3. An agent assigned to that inbound group should see the call ringing

Monitor on Asterisk:

# Watch for the inbound call
asterisk -rx "sip set debug peer dinstar_gsm"

# Check active channels
asterisk -rx "core show channels" | grep -i dinstar

You should see an INVITE arriving from the Dinstar with the "To VOIP Hotline" value as the called number. ViciDial will match this against your DID entries and route accordingly.

8.4 Audio Quality Verification

After connecting calls in both directions, verify:

Check How Issue If Failing
Two-way audio Both parties can hear each other One-way = NAT issue (see Section 9.1)
Audio clarity No choppy, robotic, or garbled sound Choppy = packet loss or codec issue
DTMF Press digits during the call, verify they are received DTMF mode mismatch
Call stability Call stays up for more than 30 seconds Drops at 30s = SIP session timer issue
Echo No echo or feedback Acoustic echo from GSM side (gateway setting)

For detailed audio debugging:

# Enable RTP debugging to check for audio packet flow
asterisk -rx "rtp set debug on"

# After testing, disable it (very verbose)
asterisk -rx "rtp set debug off"

9. Troubleshooting

9.1 Common Problems and Fixes

Problem Symptoms Likely Cause Fix
SIP peer UNREACHABLE sip show peers shows UNREACHABLE Firewall blocking, wrong IP, fail2ban Check iptables, verify public IP, check fail2ban (Section 9.4)
Registration failed sip show registry shows no entry or "Rejected" Wrong credentials, wrong host, firewall Verify username/password match on both sides. Check port 5060 is open.
One-way audio (caller hears, callee silent) Audio flows in one direction only NAT not configured correctly Enable NAT traversal on Dinstar. Verify nat=force_rport,comedia on ViciDial peer. Verify directmedia=no.
One-way audio (callee hears, caller silent) Audio flows in the other direction only Same NAT issue, different direction Same fix as above. Also check that RTP ports are not blocked by the NAT router.
No audio in either direction Call connects (200 OK) but silence Codec mismatch or RTP completely blocked Ensure both sides allow the same codecs (alaw/ulaw). Check that the NAT router does not block high UDP ports.
Calls drop after 30 seconds Call connects then disconnects at exactly 30s SIP session timer / re-INVITE failure Disable session timers on the Dinstar if possible. Ensure SIP 200 OK to re-INVITE passes through NAT.
"All circuits busy" Outbound calls fail immediately No IP-to-Tel route, SIM not registered, SIM has no credit, all ports busy Check routing config. Check SIM/port status in Dinstar UI. Verify SIM balance.
Inbound calls do not arrive Call rings SIM but ViciDial never sees it No Tel-to-IP route, wrong "To VOIP Hotline", no DID match Check routing on Dinstar. Verify hotline value. Check ViciDial DID entries. Enable SIP debug.
Inbound calls rejected (403/404) SIP debug shows rejection Context mismatch or IP authentication failure Verify the carrier's context is trunkinbound. Check insecure=port,invite is set.
GSM port shows "No SIM" Dinstar UI shows no SIM detected SIM not seated properly, SIM PIN enabled Re-insert SIM firmly. Disable PIN (put SIM in a phone, disable PIN lock, re-insert in gateway).
Poor audio quality Choppy, garbled, or robotic audio Weak GSM signal, network congestion, codec issue Check signal strength in Dinstar UI (aim for 3/5 or better). Use external antenna. Ensure G.711 codecs (not G.729).
DTMF not working IVR menus do not respond to key presses DTMF mode mismatch Both sides must use RFC2833. Check SIP profile on Dinstar and dtmfmode=rfc2833 on ViciDial.
Caller ID shows "anonymous" Inbound calls arrive without caller ID Dinstar not sending caller ID, or CLIR active on calling party Check Dinstar's caller ID settings. Some GSM networks withhold caller ID by default.

9.2 Asterisk Debug Commands

These commands are run on the ViciDial server via SSH:

# Enable SIP debugging for the Dinstar peer only (less noise than global debug)
asterisk -rx "sip set debug peer dinstar_gsm"

# Disable SIP debug
asterisk -rx "sip set debug off"

# Show full peer configuration and status
asterisk -rx "sip show peer dinstar_gsm"

# Quick peer status (one-line summary)
asterisk -rx "sip show peers" | grep dinstar

# Show all SIP registrations (for registration mode)
asterisk -rx "sip show registry"

# Show active channels (calls in progress)
asterisk -rx "core show channels"

# Show channels filtered by Dinstar
asterisk -rx "core show channels" | grep -i dinstar

# Enable RTP debugging (very verbose — use briefly)
asterisk -rx "rtp set debug on"
asterisk -rx "rtp set debug off"

# Show dialplan for the carrier prefix pattern
asterisk -rx "dialplan show _88X.@vicidial-auto-external"

# Reload SIP configuration without restarting Asterisk
asterisk -rx "sip reload"

# Reload dialplan without restarting Asterisk
asterisk -rx "dialplan reload"

9.3 Dinstar Debug Commands

Access the Dinstar CLI via SSH/Telnet (if enabled in the web UI under System -> Access Control) or via the web-based console:

# Show all SIP messages (INVITE, ACK, BYE, etc.)
deb sip msg all

# Stop SIP message debug
deb sip msg off

# Show GSM port status (SIM registration, signal strength)
show port status

# Show SIP trunk status (connected, heartbeat OK, etc.)
show sip trunk status

# Show active calls
show call status

# Show routing table
show route

9.4 fail2ban Considerations

This is one of the most common gotchas. ViciDial servers typically run fail2ban with an Asterisk jail that monitors /var/log/asterisk/messages for failed SIP authentication attempts. The Dinstar's heartbeat (SIP OPTIONS) packets can trigger fail2ban if:

Check if the Dinstar IP is banned:

# Check all fail2ban jails
fail2ban-client status

# Check the Asterisk jail specifically
fail2ban-client status asterisk

# Look for the gateway's public IP in the banned list
fail2ban-client status asterisk | grep GATEWAY_PUBLIC_IP

Unban if necessary:

fail2ban-client set asterisk unbanip GATEWAY_PUBLIC_IP

Whitelist the Dinstar IP permanently:

Edit /etc/fail2ban/jail.local (or /etc/fail2ban/jail.d/asterisk.local):

[asterisk]
ignoreip = 127.0.0.1/8 GATEWAY_PUBLIC_IP

Then restart fail2ban:

systemctl restart fail2ban

Important: Always whitelist your GSM gateway's IP in fail2ban after confirming the carrier is working. SIP OPTIONS heartbeats every 30 seconds can accumulate "failed" log entries if there is even a momentary config mismatch, leading to a ban that makes the peer go UNREACHABLE.


10. Multi-SIM and Scaling

The UC2000-VE supports up to 8 SIMs. Here is how to scale beyond a single SIM:

Adding More SIMs to the Same Port Group

If all SIMs are from the same carrier and serve the same purpose:

  1. Insert additional SIMs into empty ports
  2. Edit the Port Group (Section 6.3) and check the additional port boxes
  3. Set the Mode to Round-Robin for even distribution
  4. No changes needed on ViciDial — it sends calls to the same SIP peer, and the Dinstar distributes them

Each SIM supports 1 concurrent call. With 8 SIMs, you get 8 concurrent calls.

Multiple Port Groups for Different Purposes

If you have SIMs from different carriers or countries:

Port Group Ports SIM Carrier ViciDial Peer Dial Prefix
Group 1 1-4 Vodafone IT dinstar_it 88
Group 2 5-6 Vodafone AL dinstar_al 77
Group 3 7-8 T-Mobile UK dinstar_uk 66

Each port group gets its own SIP User ID, its own ViciDial carrier, and its own dial prefix. Create separate IP-to-Tel routes with prefix filtering to direct calls to the correct port group.

Multiple Dinstar Gateways

For more than 8 concurrent GSM channels, deploy additional gateways:

Capacity Planning

SIMs Concurrent Calls Recommended For
1 1 Testing, low-volume backup
4 4 Small team (5-10 agents) with mixed routing
8 8 Medium team (15-20 agents) or dedicated GSM campaign
16 (2 gateways) 16 Larger operations

SIM rotation: Some mobile carriers detect gateway usage patterns (many short calls from one SIM) and may block or throttle the SIM. With multiple SIMs in round-robin mode, the call volume is spread across SIMs, reducing the per-SIM call frequency and lowering the risk of carrier detection.


11. Production Tips

Signal Strength

GSM call quality depends entirely on signal strength. The Dinstar web UI shows signal in a 0-5 scale:

Signal Quality Action
5/5 Excellent No action needed
4/5 Good Acceptable for production
3/5 Fair Consider external antenna
2/5 Poor External antenna required, or relocate gateway
1/5 Very poor Calls will be unreliable — relocate or use directional antenna
0/5 No signal No calls possible — check SIM, antenna, coverage area

For office installations where the gateway is inside a building:

Caller ID Management

By default, outbound GSM calls show the SIM's own mobile number as caller ID. This is usually desirable (local mobile number = higher answer rates). However:

SIM Card Management

Monitoring Integration

If you run Prometheus/Grafana for monitoring (recommended), add checks for:

# Example Prometheus alerting rules
groups:
  - name: gsm_gateway
    rules:
      - alert: DinstarPeerDown
        expr: asterisk_sip_peer_status{peer="dinstar_gsm"} == 0
        for: 5m
        labels:
          severity: critical
        annotations:
          summary: "Dinstar GSM gateway SIP peer is UNREACHABLE"

      - alert: DinstarHighLatency
        expr: asterisk_sip_peer_latency_ms{peer="dinstar_gsm"} > 200
        for: 10m
        labels:
          severity: warning
        annotations:
          summary: "Dinstar GSM gateway SIP latency is high ({{ $value }}ms)"

Security


12. Quick Reference Checklist

Use this checklist when deploying a new Dinstar GSM gateway:

Pre-Installation

ViciDial Server

Dinstar Gateway

Verification


Summary

Integrating a Dinstar GSM gateway with ViciDial gives your call center a direct path to the cellular network — local mobile caller IDs, lower costs for mobile-to-mobile calls, and an additional redundancy layer independent of your SIP trunk providers. The key configuration touchpoints are:

  1. ViciDial side: Firewall rule, SIP carrier with NAT-aware settings (nat=force_rport,comedia, directmedia=no), dialplan with a unique prefix, DID for inbound, fail2ban whitelist
  2. Dinstar side: SIP profile (codecs, DTMF, NAT traversal), SIP trunk pointing to ViciDial, port group linking SIMs to the trunk, bidirectional routing rules, and number manipulation

The most common issues are NAT-related (one-way audio, peer unreachable) and fail2ban banning the gateway IP. Both are solved by the configuration patterns in this tutorial. Always test both call directions and verify two-way audio before going live.


This tutorial is based on production deployment experience with the Dinstar UC2000-VE series connecting to ViciDial/Asterisk servers. Configuration specifics may vary with different Dinstar firmware versions and Asterisk/ViciDial releases.

Need expert help with your setup?

VoIP infrastructure consulting, AI voice agent integration, monitoring stacks, scaling — I've done it all in production.

Get a Free Consultation