Created: 26th Nov 2026
Introduction
The Cisco VG204XM is a 4-port FXS analogue gateway. This document describes how to use the device by registering it to an Asterisk server as extensions 501–504.
For this example the following settings wee used.
| Item | Value |
|---|---|
| Hardware | Cisco VG204XM (4 × FXS, 2 × FastEthernet) |
| Hostname | vg204 |
| Management | SSH (user john), telnet as fallback |
| IOS | 15.6(3)M3a – vg20xxm-advipservicesk9-mz.156-3.M3a.bin |
| VG address | 192.168.1.55/24 (static, on FastEthernet0/0) |
| Asterisk server | 192.168.1.58, UDP 5060 |
| Default gateway | 192.168.1.1 |
| FXS ports | 0/0 → 501, 0/1 → 502, 0/2 → 503, 0/3 → 504 |
| SIP auth user | vg204 (shared by all four ports) |
| Codec | G.711 µ-law, 20 ms, VAD off, DTMF RFC 2833 |
Console access
Terminal access is via RS232 using the blue Cisco RS232 (RJ45) console cable, 9600 8N1, no flow control.
Perform all address changes from the console to prevent an SSH session dropping when the IP changes.
First steps: hostname, passwords and SSH
Do this first, from the console. Afterwards everything else can be done over SSH.
⚠️ Replace every
<…>placeholder with a real value before pasting. IOS will happily accept<PASSWORD>as a literal password.
configure terminal
hostname vg204
ip domain name local
service password-encryption
enable secret <ENABLE-PASSWORD>
username john privilege 15 secret <LOGIN-PASSWORD>
crypto key generate rsa modulus 2048
ip ssh version 2
line vty 0 4
login local
transport input ssh telnet
end
write memory
| Line | Purpose |
|---|---|
hostname / ip domain name |
Required before an RSA key can be generated (IOS refuses while the hostname is the default router). |
service password-encryption |
Stores plain passwords as type 7 rather than clear text. |
enable secret |
Password for enable (privileged mode). Stored as a one-way hash. |
username … privilege 15 secret |
Login account; privilege 15 goes straight to the # prompt. One-way hash – cannot be decoded, only reset. |
crypto key generate rsa modulus 2048 |
Creates the SSH host key. |
login local |
vty logins use the username/password above. |
transport input ssh telnet |
Allows both. Change to transport input ssh once SSH is confirmed working. |
Check: show ip ssh → SSH Enabled – version 2.0.
Changing a password later
Re-entering the line replaces the old value:
configure terminal
username john privilege 15 secret <NEW-PASSWORD>
enable secret <NEW-ENABLE-PASSWORD>
end
write memory
Check for leftover placeholders or unexpected entries:
show running-config | include enable|username|password
SSH client settings (Mac / Linux)
IOS 15.6 uses SHA-1 RSA host keys and older key exchange, which modern OpenSSH disables by default (error: "no matching
host key type found"). Enable them for this host only in ~/.ssh/config:
Host vg204
HostName 192.168.1.55
User john
HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa
KexAlgorithms +diffie-hellman-group14-sha1
Then: ssh vg204
On Fedora the system crypto policy may still block SHA-1. Either connect from the Mac, or (system-wide)
sudo update-crypto-policies --set DEFAULT:SHA1.
Full configuration
Enter from vg204# with configure terminal. Replace <SIP-PASSWORD> with the real value before pasting.
⚠️
<SIP-PASSWORD>must be identical topassword=in the[vg204auth]section of Asterisk'spjsip.conf.
! ---------- Network (static address) ----------
interface FastEthernet0/0
no ip address dhcp
ip address 192.168.1.55 255.255.255.0
no shutdown
!
ip route 0.0.0.0 0.0.0.0 192.168.1.1
!
! ---------- SIP / VoIP service ----------
voice service voip
ip address trusted list
ipv4 192.168.1.58
sip
bind control source-interface FastEthernet0/0
bind media source-interface FastEthernet0/0
!
! ---------- FXS ports ----------
voice-port 0/0
cptone GB
pulse-digit-detection
!
voice-port 0/1
cptone GB
pulse-digit-detection
!
voice-port 0/2
cptone GB
pulse-digit-detection
!
voice-port 0/3
cptone GB
pulse-digit-detection
!
! ---------- POTS dial-peers (number -> physical port) ----------
dial-peer voice 501 pots
destination-pattern 501
port 0/0
!
dial-peer voice 502 pots
destination-pattern 502
port 0/1
!
dial-peer voice 503 pots
destination-pattern 503
port 0/2
!
dial-peer voice 504 pots
destination-pattern 504
port 0/3
!
! ---------- VoIP dial-peers (calls to Asterisk) ----------
! Internal 3-digit extensions 2xx-6xx (also matches incoming calls from Asterisk)
dial-peer voice 100 voip
destination-pattern [2-6]..
incoming called-number .
session protocol sipv2
session target ipv4:192.168.1.58
codec g711ulaw
dtmf-relay rtp-nte
no vad
!
! External calls via sipgate: 9 + 0 + number (press # to send immediately)
dial-peer voice 101 voip
destination-pattern 90T
session protocol sipv2
session target ipv4:192.168.1.58
codec g711ulaw
dtmf-relay rtp-nte
no vad
!
! OPTIONAL – reach 9xx internal extensions (e.g. Telstar 917/918)
dial-peer voice 102 voip
destination-pattern 9[1-9].
session protocol sipv2
session target ipv4:192.168.1.58
codec g711ulaw
dtmf-relay rtp-nte
no vad
!
! ---------- SIP registration ----------
sip-ua
authentication username vg204 password 0 <SIP-PASSWORD> realm asterisk
registrar ipv4:192.168.1.58 expires 3600
sip-server ipv4:192.168.1.58
!
end
write memory
What the key lines do
| Line | Purpose |
|---|---|
ip address trusted list / ipv4 192.168.1.58 |
IOS 15.x toll-fraud protection rejects SIP from untrusted sources with 403. Trusts the Asterisk server. |
bind control/media source-interface |
Forces SIP signalling and RTP to use FastEthernet0/0's address. |
cptone GB |
UK dial tone, ringing, engaged tones and line characteristics. |
pulse-digit-detection |
Rotary (loop-disconnect) dialling. Tested and working. |
POTS destination-pattern 50x |
Maps each number to a port; with a registrar configured, IOS automatically registers each POTS number. |
incoming called-number . |
Makes calls arriving from Asterisk use dial-peer 100 (G.711, no VAD) instead of IOS's default dial-peer 0 (G.729 + VAD). |
90T |
T = wait for the inter-digit timeout (10 s default) or # before sending. |
no vad |
Disables silence suppression – important for modem (V.23) calls. |
dtmf-relay rtp-nte |
RFC 2833 DTMF, matching Asterisk's dtmf_mode=rfc4733 default. |
Matching Asterisk configuration
pjsip.conf
All four endpoints share one auth section.
[vg204auth]
type=auth
auth_type=userpass
username=vg204
password=<SIP-PASSWORD>
[501]
type=endpoint
transport=transport-udp
context=from-internal
disallow=all
allow=ulaw,alaw
direct_media=no
auth=vg204auth
aors=501
[501]
type=aor
max_contacts=1
remove_existing=yes
; Repeat the endpoint + aor pair for 502, 503 and 504,
; changing BOTH section names and the aors= line each time.
remove_existing=yes lets a new registration replace the old contact (needed when the VG's IP changes or it reboots);
without it, max_contacts=1 causes the new registration to be rejected.
extensions.conf – in [from-internal]
exten => 501,1,Dial(PJSIP/501)
exten => 502,1,Dial(PJSIP/502)
exten => 503,1,Dial(PJSIP/503)
exten => 504,1,Dial(PJSIP/504)
; Outgoing via sipgate: 9 + 0 + number
exten => _90X.,1,NoOp(Outgoing via sipgate to ${EXTEN:1})
same => n,Dial(PJSIP/${EXTEN:1}@sipgate,60)
same => n,Hangup()
Then: pjsip reload and dialplan reload.
Verification
On the VG
| Command | Expect |
|---|---|
show ip ssh |
SSH Enabled – version 2.0 |
show ip interface brief |
Fa0/0 = 192.168.1.55, up/up |
show voice port summary |
0/0–0/3, fxs-ls, admin up |
show dial-peer voice summary |
501–504 pots, 100/101(/102) voip, all up |
show sip-ua register status |
All four lines reg = yes |
show dialplan number 907700900123 |
Matches dial-peer 101 |
show running-config | section sip-ua |
Exactly one authentication line |
debug ccsip messages / undebug all |
Live SIP trace |
On Asterisk
| Command | Expect |
|---|---|
pjsip show contacts |
501–504 at 192.168.1.55 |
pjsip set logger host 192.168.1.55 |
SIP trace for the VG only (pjsip set logger off to stop) |
pjsip show channelstats (during a call) |
ulaw, ~50 packets/s each way, no loss |
dialplan show 901234567890@from-internal |
Matches _90X. |
Troubleshooting notes (lessons learned)
"No matching endpoint found" (Asterisk log) – the endpoint for that number doesn't exist. Check
pjsip show endpoints; copied sections must have all names changed.
"Failed to authenticate" – password mismatch. Asterisk's value: pjsip show auth vg204auth. The VG's stored (type
7) password can be decoded:
configure terminal
key chain decode
key 1
key-string 7 <encrypted-string-from-running-config>
end
show key chain decode
configure terminal
no key chain decode
end
Type 7 length check: hex digits = 2 + (2 × password length).
Changing the SIP password – remove the old line exactly as stored (including password 7 …), then add the new
one:
configure terminal
sip-ua
no authentication username vg204 password 7 <string as shown> realm asterisk
authentication username vg204 password 0 <SIP-PASSWORD> realm asterisk
end
write memory
Old credentials still being sent after a change – IOS can cache the credentials from the first registration. Fix:
write memory then reload. After a reload, show sip-ua register status shows no until the countdown in the
expires column runs out and it registers.
Forcing re-registration – no registrar ipv4:… is rejected on this IOS ("Invalid input"); use no registrar then
re-add the line, or simply reload.
Engaged tone immediately after dialling – no dial-peer can match the digits. Check show dial-peer voice summary /
show dialplan number <digits>.
Engaged tone after dialling the full number – the call reached Asterisk but was refused; check
dialplan show <number>@from-internal.
"exited non-zero" in the Asterisk log – normal when the caller hangs up during Dial().
Optional extras
Shorter wait after the last digit
voice-port 0/0
timeouts interdigit 4
(Repeat per port. 4 s still suits rotary dials.)
Modem (V.23) calls
dial-peer voice 100 voip
modem passthrough nse codec g711ulaw
or per port: no echo-cancel enable under the voice-port.
Second Ethernet port as a private network with DHCP (not yet configured)
interface FastEthernet0/1
ip address 192.168.2.1 255.255.255.0
ip nat inside
no shutdown
!
interface FastEthernet0/0
ip nat outside
!
ip dhcp excluded-address 192.168.2.1 192.168.2.99
ip dhcp pool PRIVATE
network 192.168.2.0 255.255.255.0
default-router 192.168.2.1
dns-server 192.168.1.1
!
access-list 10 permit 192.168.2.0 0.0.0.255
ip nat inside source list 10 interface FastEthernet0/0 overload
Without NAT instead: omit the ip nat lines and the access-list, and add a route on the server:
192.168.2.0/24 via 192.168.1.55.