Skip to content
ViciDial AI ViciDial AI ViciDial AI

The VICIdial Community Blog

ViciDial AI ViciDial AI ViciDial AI

The VICIdial Community Blog

  • Home
  • Vicidial Hosting
  • Home
  • Vicidial Hosting
Close

Search

  • Home
  • Vicidial Hosting
Subscribe
PSTNVICIdial

Configuring a GSM Gateway with Asterisk and VICIdial

By raghavan
August 16, 2022 3 Min Read
0

GSM gateways put SIM cards behind a SIP interface, letting a dialer place calls over mobile networks rather than a wholesale SIP trunk. In markets where mobile-to-mobile rates beat VoIP termination, or where local caller ID matters more than cost, they earn their place.

The configuration is straightforward. The operational side is where people struggle.

How the Gateway Presents Itself

Whatever the vendor — Dinstar, Yeastar, OpenVox, GoIP, Synway — a GSM gateway does the same thing: it accepts SIP on its LAN side and bridges to GSM on its radio side. To Asterisk it looks like any other SIP device.

There are two ways to connect it:

Use IP mode unless you have a reason not to.

Asterisk Side: IP Trunk

In your VICIdial carrier’s Account Entry:

[gsmgw]
type=friend
host=192.168.1.200
port=5060
context=trunkinbound
insecure=port,invite
disallow=all
allow=ulaw
allow=alaw
dtmfmode=rfc2833
qualify=yes
canreinvite=no
nat=no

Notes specific to GSM gateways:

  • canreinvite=no — keep media on the server. Gateways handle re-invites inconsistently and you will get one-way audio.
  • nat=no when the gateway is on your LAN. Setting force_rport against a local device causes more problems than it solves.
  • Codec. Most gateways transcode GSM to ulaw or alaw internally. Offer only what the gateway lists as supported — negotiating a codec it does not have produces call setup failures that look like network faults.

Leave Registration String empty for IP mode.

Dialplan Entry

exten => _9X.,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _9X.,n,Dial(SIP/gsmgw/${EXTEN:1},60,tTo)
exten => _9X.,n,Hangup()

GSM call setup is slower than SIP — the network has to locate the handset. A 60-second timeout is reasonable; 30 will cut off calls that would have connected.

Gateway Side

In the gateway’s web interface, configure a SIP endpoint pointing back at Asterisk:

  • Server address: your VICIdial server IP
  • Port: 5060
  • Registration: disabled, for IP mode
  • Codec: match what you allowed in Asterisk

Then set the routing rules. Most gateways use a table mapping inbound SIP calls to outbound GSM channels. A basic rule sends everything from your Asterisk IP to any available channel:

IP->Tel:  source=192.168.1.50  ->  channel group: all
Tel->IP:  any channel          ->  192.168.1.50:5060

The Tel->IP rule handles inbound calls to the SIM numbers. Without it, calls to your SIMs ring nowhere.

Per-Channel Routing

Where GSM gets interesting is selecting a specific SIM. You might want each campaign on its own number, or to present a caller ID matching the region being dialled.

Most gateways expose channels via a prefix. Check your vendor’s syntax — a common pattern is to prefix the dialled number with the channel or group identifier. If channel 3 is addressed as a prefix, the dialplan becomes:

exten => _93X.,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _93X.,n,Dial(SIP/gsmgw/3${EXTEN:2},60,tTo)
exten => _93X.,n,Hangup()

Then set the campaign’s dial prefix to 93 to route it out channel 3 specifically.

For round-robin across a group, most gateways handle selection internally when you dial the group rather than a channel. That is preferable — let the gateway do channel selection, since it knows which SIMs are registered and which are in a call.

Verifying

asterisk -rx "sip show peer gsmgw"

Status OK with a latency figure means the qualify ping is answered.

Place a test call and watch:

asterisk -rvvvvv
sip set debug peer gsmgw

Read the SIP response codes:

CodeUsual cause on GSM
404Routing rule on the gateway does not match, or number format wrong
480SIM not registered to the mobile network
486Called party busy, or all channels in use
503Gateway out of available channels
603Network rejected the call — often SIM blocked or out of credit

Check SIM registration on the gateway’s status page before assuming Asterisk is at fault. A SIM that has lost network registration will fail every call while the gateway itself looks perfectly healthy.

Audio Problems Specific to GSM

Operational Realities

Three things that are not configuration but will determine whether this works:

Summary

Connect over IP rather than registration, keep media on the server with canreinvite=no, allow a 60-second dial timeout for GSM setup, and let the gateway pick channels within a group. Then spend your time on SIM rotation and pacing, because that is what actually determines whether a GSM setup survives past the first month.

Tags:

asteriskdinstargoipgsm gatewaysimsip trunkvicidialyeastar
Author

raghavan

Follow Me
Other Articles
Previous

VICIdial Agent Error: ‘No One Is In Your Session’ (8600051)

Concentric dashed security perimeters drawn around a single amber core point.
Next

Hardening VICIdial: AMI Users, MySQL Accounts and Default Web Paths

No Comment! Be the first one.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

About This Site

Vicidial, Asterisk, GoAutoDial and FreePBX tutorials — with practical guides to AI answering machine detection and AI agent integration.

Search

Recent Posts

  • AI Answering Machine Detection for VICIdial: Integrating VM Hunter
  • Piping VICIdial Call Recordings Into a Speech-to-Text Workflow
  • Fixing ‘Extension s Rejected Because Extension Not Found’ on Inbound Calls
  • Connecting FreePBX to VICIdial Over a SIP Trunk
  • Asterisk Variable Manipulation: Substrings, Math and Caller ID Rewriting

ViciDial AI

Vicidial, Asterisk, GoAutoDial and FreePBX tutorials — with practical guides to AI answering machine detection and AI agent integration.

Recent Posts

  • AI Answering Machine Detection for VICIdial: Integrating VM Hunter
  • Piping VICIdial Call Recordings Into a Speech-to-Text Workflow
  • Fixing ‘Extension s Rejected Because Extension Not Found’ on Inbound Calls
  • Connecting FreePBX to VICIdial Over a SIP Trunk
  • Asterisk Variable Manipulation: Substrings, Math and Caller ID Rewriting

Archives

  • June 2025 (1)
  • April 2024 (1)
  • January 2024 (1)
  • December 2023 (1)
  • October 2023 (1)
  • September 2023 (1)
  • August 2023 (1)
  • June 2023 (1)
  • May 2023 (1)
  • March 2023 (1)
  • February 2023 (1)
  • December 2022 (1)
  • November 2022 (1)
  • October 2022 (1)
  • September 2022 (1)
  • August 2022 (1)
  • July 2022 (1)
  • June 2022 (1)
  • April 2022 (1)
  • March 2022 (1)

Find Us

Contact Us:

email: info@vicidialai.com

Copyright 2026 — ViciDial AI. All rights reserved. | Privacy Policy