DEV Community

Moisi Trungu
Moisi Trungu

Posted on • Originally published at flixzone.icu

ViciDial 'Extension Does Not Match' Error — Phone Registration Issues

ViciDial 'Extension Does Not Match' Error — Phone Registration Issues

Learn how to diagnose and resolve the "Extension Does Not Match" registration error in ViciDial, including SIP endpoint configuration, database validation, and real-world fixes for agent phone registration failures.

Prerequisites

Before troubleshooting this error, you should have:

  • ViciDial installation (4.x or 5.x) running on CentOS 7+ or Ubuntu 18.04+
  • Root or sudo access to the ViciDial server
  • Basic knowledge of Asterisk configuration files and SIP protocol
  • Access to the ViciDial web admin panel at http://<server-ip>/vicidial/admin.php
  • Ability to read Asterisk logs in /var/log/asterisk/messages
  • MySQL/MariaDB command-line access to the asterisk database
  • An IP phone or softphone capable of SIP registration

Understanding the "Extension Does Not Match" Error

The "Extension Does Not Match" error occurs when an SIP endpoint (phone, softphone, or device) attempts to register with Asterisk but the extension number provided during registration does not match what ViciDial expects in its configuration or database.

Why This Happens

  1. Mismatched extension in phone config — The phone is configured to register as extension 6001 but ViciDial expects 6000
  2. Database record mismatch — The extension in vicidial_users table differs from the SIP device definition in vicidial_extensions table
  3. Stale SIP cache — Asterisk cached the old extension number and hasn't reloaded the configuration
  4. Username/extension confusion — Using a username instead of extension number in the phone's registration settings
  5. Multiple devices with the same extension — Two phones attempting to register with identical extension numbers

Where the Error Appears

You'll see this error in:

  • Asterisk CLI: asterisk -rx "core show hints" output
  • Logs: /var/log/asterisk/messages
  • ViciDial web interface: Agent login fails silently or shows "Registration Failed"
  • Agent screen (/agc/vicidial.php): Agent cannot log in

Step 1: Verify the Error in Asterisk Logs

Start by capturing the actual error message in Asterisk's debug output.

Enable SIP Debug Logging

Connect to the Asterisk CLI and enable SIP debug mode:

asterisk -rx "sip set debug on"
Enter fullscreen mode Exit fullscreen mode

Have the phone attempt registration, then check logs:

tail -f /var/log/asterisk/messages | grep -i "does not match"
Enter fullscreen mode Exit fullscreen mode

You should see output similar to:

[2024-01-15 14:32:45] WARNING[12345]: chan_sip.c:1234 check_auth: SIP auth failure for user "6001" from 192.168.1.50 - extension does not match
[2024-01-15 14:32:45] NOTICE[12345]: chan_sip.c:1235 handle_request_register: Registration attempt for extension 6001 does not match configured extension
Enter fullscreen mode Exit fullscreen mode

Turn off debug after troubleshooting to reduce log noise:

asterisk -rx "sip set debug off"
Enter fullscreen mode Exit fullscreen mode

Step 2: Check ViciDial Database Configuration

The error typically stems from mismatches between three related database tables: vicidial_users, vicidial_extensions, and the SIP peer definition.

Query the vicidial_users Table

First, find the user record:

USE asterisk;
SELECT user_id, user_name, extension, pass, full_name, active 
FROM vicidial_users 
WHERE user_name = 'agent_username' 
OR extension = '6001';
Enter fullscreen mode Exit fullscreen mode

Example output:

+---------+---------------+-----------+------+------------+--------+
| user_id | user_name     | extension | pass | full_name  | active |
+---------+---------------+-----------+------+------------+--------+
|     125 | john.smith    | 6001      | pass | John Smith | Y      |
+---------+---------------+-----------+------+------------+--------+
Enter fullscreen mode Exit fullscreen mode

Note the extension number — this is critical.

Query the vicidial_extensions Table

Now verify the extension exists in the extensions table:

SELECT extension, dialplan_number, voicemail_id, voicemail_password, 
       outbound_cid, recording_status, active 
FROM vicidial_extensions 
WHERE extension = '6001';
Enter fullscreen mode Exit fullscreen mode

Example output:

+-----------+-----------------+-------------+--------------------+
| extension | dialplan_number | voicemail_id| voicemail_password |
+-----------+-----------------+-------------+--------------------+
| 6001      | 6001            | 6001        | 1234               |
+-----------+-----------------+-------------+--------------------+
Enter fullscreen mode Exit fullscreen mode

Query the vicidial_carrier_log Table (SIP Peers)

Check if a SIP peer is defined for this extension:

SELECT carrier_id, carrier_name, active 
FROM vicidial_carrier_log 
WHERE carrier_name LIKE '%6001%' 
OR description LIKE '%6001%';
Enter fullscreen mode Exit fullscreen mode

More directly, check the extensions configuration:

grep -n "6001" /etc/asterisk/extensions-vicidial.conf | head -20
grep -n "6001" /etc/asterisk/sip-vicidial.conf | head -20
Enter fullscreen mode Exit fullscreen mode

Step 3: Review SIP Configuration Files

Examine the Main SIP Configuration

Check /etc/asterisk/sip-vicidial.conf for the agent's SIP peer:

cat /etc/asterisk/sip-vicidial.conf | grep -A 20 "\[6001\]"
Enter fullscreen mode Exit fullscreen mode

You should see a section like:

[6001]
type=friend
context=from-internal
secret=password123
host=dynamic
port=5060
dtmfmode=rfc2833
canreinvite=no
nat=yes
insecure=port,invite
disallow=all
allow=ulaw
allow=gsm
qualify=yes
registrar_server=asterisk
extension=6001
Enter fullscreen mode Exit fullscreen mode

Common Issues in sip-vicidial.conf

Issue 1: Extension field missing

[6001]
type=friend
context=from-internal
secret=password123
host=dynamic
Enter fullscreen mode Exit fullscreen mode

Fix: Add the extension line:

[6001]
type=friend
context=from-internal
secret=password123
host=dynamic
extension=6001
Enter fullscreen mode Exit fullscreen mode

Issue 2: Extension mismatch

[6001]
type=friend
extension=6000
Enter fullscreen mode Exit fullscreen mode

Fix: Ensure the section header matches the extension field:

[6001]
type=friend
extension=6001
Enter fullscreen mode Exit fullscreen mode

Issue 3: Duplicate extensions

[6001]
type=friend
extension=6001

[softphone-john]
type=friend
extension=6001
Enter fullscreen mode Exit fullscreen mode

Fix: Use unique identifiers; the section header should match the extension or be descriptive:

[6001]
type=friend
extension=6001

[6001-backup]
type=friend
extension=6002
Enter fullscreen mode Exit fullscreen mode

Check Extensions Dialplan

Verify the extension exists in the Asterisk dialplan:

cat /etc/asterisk/extensions-vicidial.conf | grep -B 2 -A 5 "exten => 6001"
Enter fullscreen mode Exit fullscreen mode

Expected output:

[from-internal]
exten => 6001,1,NoOp(Agent 6001 dialing)
exten => 6001,n,Dial(SIP/6001,20,tT)
exten => 6001,n,Voicemail(6001@default)
exten => 6001,n,Hangup()
Enter fullscreen mode Exit fullscreen mode

Step 4: Reload Asterisk Configuration

After making changes, you must reload the affected modules. Do not restart Asterisk in production unless necessary.

Reload Only SIP Configuration

asterisk -rx "sip reload"
Enter fullscreen mode Exit fullscreen mode

Monitor the output for errors:

asterisk -rx "sip reload" 2>&1 | tee /tmp/sip_reload.log
Enter fullscreen mode Exit fullscreen mode

Reload Dialplan

asterisk -rx "dialplan reload"
Enter fullscreen mode Exit fullscreen mode

Verify the Extension is Recognized

asterisk -rx "sip show peer 6001"
Enter fullscreen mode Exit fullscreen mode

Expected output:

Name       : 6001
Secret     : <set>
MD5Secret  : <not set>
Context    : from-internal
Subscr.Cont: <not set>
Language   : en
AMA flags  : Unknown
Transfer   : Yes (disabled)
Callgroup  : 
Pickupgroup: 
Named CG   : 
Named PG   : 
Videosupp. : No
TextSupp.  : No
Statusmsg  : No
Ignore SDP : No
SRTP Protect: No
Encryption : No
DTMFmode   : rfc2833
SIP Options: 
Codecs     : (ulaw|gsm)
Non-Codec  : 
Use Crypto : No
Type       : Friend
Qualify    : Yes (60000 ms)
Maxexpire  : 3600 (seconds)
Minexpire  : 60 (seconds)
Default-Expire: 300 (seconds)
Reg. Contact: <not registered>
Reg. Expires: 0 seconds
Reg. Refresh : 0 seconds
Enter fullscreen mode Exit fullscreen mode

If you see Reg. Contact: <not registered>, the phone hasn't registered yet.


Step 5: Validate Phone Configuration

The phone must be configured to register with the correct parameters.

Typical Softphone Settings (Zoiper, X-Lite, Linphone)

For a phone configured to register as extension 6001:

Server/Domain: 192.168.1.100 (your ViciDial server IP)
Username/Extension: 6001
Password: password123
Port: 5060 (or 5061 for TLS)
Protocol: UDP (or TCP/TLS)
Display Name: John Smith (optional)
Enter fullscreen mode Exit fullscreen mode

Critical: Use the extension number (6001), not the user name (john.smith), in the Username field.

Example: Zoiper Configuration

Account Settings:
  Domain: 192.168.1.100
  Username: 6001
  Password: password123
  Transport: UDP
  Outbound Proxy: 192.168.1.100:5060
  Port: 5060
Enter fullscreen mode Exit fullscreen mode

Example: Grandstream GXP IP Phone Configuration

Via web interface at http://phone-ip:

Network > NAT Traversal:
  SIP Server: 192.168.1.100
  SIP Server Port: 5060
  SIP User ID: 6001
  SIP Authentication ID: 6001
  SIP Authentication Password: password123
  Outbound Proxy: 192.168.1.100
Enter fullscreen mode Exit fullscreen mode

Step 6: Synchronize Database Records

If multiple configuration sources exist, ensure they're synchronized.

Create or Update vicidial_extensions Record

If the extension doesn't exist in vicidial_extensions, create it:

INSERT INTO vicidial_extensions 
(extension, dialplan_number, voicemail_id, voicemail_password, 
 outbound_cid, recording_status, active, description)
VALUES 
('6001', '6001', '6001', '1234', '6001', '', 'Y', 'Agent extension 6001');
Enter fullscreen mode Exit fullscreen mode

To update an existing record:

UPDATE vicidial_extensions 
SET dialplan_number = '6001', 
    voicemail_id = '6001', 
    voicemail_password = '1234',
    active = 'Y'
WHERE extension = '6001';
Enter fullscreen mode Exit fullscreen mode

Update vicidial_users Record

Ensure the user's extension matches:

UPDATE vicidial_users 
SET extension = '6001', 
    active = 'Y'
WHERE user_name = 'john.smith';
Enter fullscreen mode Exit fullscreen mode

Verify Consistency

Run a query to ensure no conflicts:

SELECT vu.user_name, vu.extension, ve.extension as db_extension
FROM vicidial_users vu
LEFT JOIN vicidial_extensions ve ON vu.extension = ve.extension
WHERE vu.user_name = 'john.smith';
Enter fullscreen mode Exit fullscreen mode

Both should return 6001.


Step 7: Clear SIP Cache and Reconnect

Asterisk maintains an in-memory cache of SIP peers. Stale entries can cause registration failures.

Option A: Reload SIP Module (Preferred)

asterisk -rx "module reload chan_sip.so"
Enter fullscreen mode Exit fullscreen mode

This reloads the SIP module and clears the peer cache without restarting Asterisk.

Option B: Full Asterisk Restart (Last Resort)

Only do this in maintenance windows:

systemctl stop asterisk
sleep 2
systemctl start asterisk
sleep 5
asterisk -rx "sip show peers"
Enter fullscreen mode Exit fullscreen mode

Verify Registration Status

Check if the phone is now registered:

asterisk -rx "sip show peers" | grep 6001
Enter fullscreen mode Exit fullscreen mode

Expected output:

6001/6001                              192.168.1.50:54321   OK (53 ms)
Enter fullscreen mode Exit fullscreen mode

The format is Extension/AuthUser IP:Port Status.


Step 8: Test Agent Login

Once the phone registers successfully, test the agent login in ViciDial.

Login via Agent Screen

Navigate to http://<server-ip>/agc/vicidial.php and log in with:

  • Agent ID: john.smith (or user_name from database)
  • Password: agent password
  • Phone Ext: Should auto-populate or match the extension (6001)

Monitor Registration Status

Check the ViciDial logs directory:

tail -f /var/log/asterisk/messages | grep -i "6001"
Enter fullscreen mode Exit fullscreen mode

Also check the ViciDial application log:

tail -f /var/log/vicidial.log | grep -i "6001\|john.smith"
Enter fullscreen mode Exit fullscreen mode

Verify Call Flow

From the agent's phone, dial an extension or make a test call:

asterisk -rx "core show channels" | grep 6001
Enter fullscreen mode Exit fullscreen mode

Should show active channel when the agent is on a call.


Real-World Scenario: Complete Working Example

Here's a complete, working configuration for extension 6001:

Database: Insert User

USE asterisk;

INSERT INTO vicidial_users 
(user_id, user_name, pass, full_name, user_level, active, 
 extension, phone_login, phone_pass, voicemail_id, voicemail_pass,
 vm_from_email, email, manager_id, created_date)
VALUES
(125, 'john.smith', 'userpass123', 'John Smith', 1, 'Y',
 '6001', 'john.smith', 'pin123', '6001', '1234',
 'john@company.com', 'john@company.com', 1, NOW());
Enter fullscreen mode Exit fullscreen mode

Database: Insert Extension

INSERT INTO vicidial_extensions
(extension, dialplan_number, voicemail_id, voicemail_password, 
 outbound_cid, recording_status, active, description)
VALUES
('6001', '6001', '6001', '1234', '6001', '', 'Y', 'John Smith Agent');
Enter fullscreen mode Exit fullscreen mode

SIP Configuration: /etc/asterisk/sip-vicidial.conf

[6001]
type=friend
context=from-internal
secret=sipchannel123
host=dynamic
port=5060
dtmfmode=rfc2833
canreinvite=no
nat=yes
insecure=port,invite
disallow=all
allow=ulaw
allow=gsm
allow=g729
qualify=yes
extension=6001
description=John Smith Agent Phone
Enter fullscreen mode Exit fullscreen mode

Dialplan: /etc/asterisk/extensions-vicidial.conf

[from-internal]
exten => 6001,1,NoOp(Agent Extension 6001 - John Smith)
exten => 6001,n,Dial(SIP/6001,20,tT)
exten => 6001,n,VoiceMail(6001@default)
exten => 6001,n,Hangup()
Enter fullscreen mode Exit fullscreen mode

Phone Configuration: Zoiper

Account Name: john.smith
Domain: 192.168.1.100
Username: 6001
Password: sipchannel123
Port: 5060
Protocol: UDP
Display Name: John Smith
Outbound Proxy: 192.168.1.100:5060
STUN Server: stun.l.google.com
NAT Traversal: Enabled
Enter fullscreen mode Exit fullscreen mode

Reload and Test

# Reload configuration
asterisk -rx "sip reload"
asterisk -rx "dialplan reload"

# Wait 2 seconds for phone to register
sleep 2

# Verify registration
asterisk -rx "sip show peer 6001"

# Check if registered
asterisk -rx "sip show peers" | grep 6001
Enter fullscreen mode Exit fullscreen mode

Troubleshooting Section

Issue: Registration Fails Silently

Symptom: Phone shows "Not Registered" but no error in logs

Solution:

  1. Enable debug:
   asterisk -rx "sip set debug on"
Enter fullscreen mode Exit fullscreen mode
  1. Check for firewall blocking SIP:
   iptables -L -n | grep 5060
Enter fullscreen mode Exit fullscreen mode
  1. Ensure port 5060 is open:
   firewall-cmd --add-port=5060/udp --permanent
   firewall-cmd --reload
Enter fullscreen mode Exit fullscreen mode
  1. Check phone can reach server:
   ping 192.168.1.100
   nmap -p 5060 192.168.1.100
Enter fullscreen mode Exit fullscreen mode

Issue: "Extension Does Not Match" Repeats Every Few Seconds

Symptom: Constant error messages in logs despite configuration appearing correct

Solution:

  1. Check for duplicate extensions:
   SELECT section, COUNT(*) as count FROM vicidial_extensions 
   GROUP BY section HAVING count > 1;
Enter fullscreen mode Exit fullscreen mode
  1. Remove duplicate SIP peer sections:
   grep -n "^\[6001\]" /etc/asterisk/sip-vicidial.conf
Enter fullscreen mode Exit fullscreen mode

Delete duplicate sections, keeping only one.

  1. Reload:
   asterisk -rx "module reload chan_sip.so"
Enter fullscreen mode Exit fullscreen mode

Issue: Phone Registers But Agent Login Fails

Symptom: Phone registers (shows in sip show peers), but agent cannot log in

Solution:

  1. Verify user exists in database:
   SELECT * FROM vicidial_users WHERE user_name = 'john.smith';
Enter fullscreen mode Exit fullscreen mode
  1. Check user's active status:
   UPDATE vicidial_users SET active = 'Y' WHERE user_name = 'john.smith';
Enter fullscreen mode Exit fullscreen mode
  1. Verify user has correct extension:
   SELECT extension FROM vicidial_users WHERE user_name = 'john.smith';
Enter fullscreen mode Exit fullscreen mode
  1. Check ViciDial application logs:
   tail -50 /var/log/vicidial.log | tail -20
Enter fullscreen mode Exit fullscreen mode
  1. Verify user has a campaign assignment:
   SELECT * FROM vicidial_user_groups 
   WHERE user_id = 125;
Enter fullscreen mode Exit fullscreen mode

Issue: "911 Registration Failed"

Symptom: Phone registers but with 911 warning in logs

Solution:
This is typically a warning, not a failure. Add a registered server address to SIP config:

[6001]
type=friend
registrar_server=asterisk
extension=6001
Enter fullscreen mode Exit fullscreen mode

Reload and test again.

Issue: Multiple Agents Registered to Same Extension

Symptom: Multiple phones showing registered as 6001

Solution:

  1. Query active registrations:
   asterisk -rx "sip show peers" | grep 6001
Enter fullscreen mode Exit fullscreen mode
  1. Assign unique extensions to each agent:
   UPDATE vicidial_users SET extension = '6002' WHERE user_name = 'jane.doe';
Enter fullscreen mode Exit fullscreen mode
  1. Create SIP peer for new extension:
   [6002]
   type=friend
   context=from-internal
   secret=sipchannel456
   extension=6002
Enter fullscreen mode Exit fullscreen mode
  1. Reload:
   asterisk -rx "sip reload"
Enter fullscreen mode Exit fullscreen mode

Issue: Extension Works But Phone Doesn't Ring

Symptom: Registration successful, but calls don't reach phone

Solution:

  1. Check if channel is being used:
   asterisk -rx "core show channels"
Enter fullscreen mode Exit fullscreen mode
  1. Verify dialplan:
   asterisk -rx "dialplan show 6001@from-internal"
Enter fullscreen mode Exit fullscreen mode
  1. Enable call logging:
   grep -i "6001" /var/log/asterisk/messages | tail -20
Enter fullscreen mode Exit fullscreen mode
  1. Test dial directly:
   asterisk -rx "channel originate SIP/6001 extension 6001@from-internal"
Enter fullscreen mode Exit fullscreen mode

Prevention Best Practices

1. Use a Naming Convention

Keep extensions and SIP peer names consistent:

; GOOD - extension matches section header
[6001]
extension=6001

; ALSO GOOD - descriptive with matching extension
[agent-john-smith]
type=friend
extension=6001
description=John Smith (Agent ID: 125)
Enter fullscreen mode Exit fullscreen mode

2. Automate Provisioning

Use a script to create extensions from database:

#!/bin/bash
# Provision SIP peers from database

mysql -u root -p asterisk -e "
SELECT extension, pass FROM vicidial_extensions WHERE active = 'Y'
" | while read ext pass; do
  echo "[$ext]" >> /etc/asterisk/sip-vicidial.conf
  echo "type=friend" >> /etc/asterisk/sip-vicidial.conf
  echo "secret=$pass" >> /etc/asterisk/sip-vicidial.conf
  echo "extension=$ext" >> /etc/asterisk/sip-vicidial.conf
done
Enter fullscreen mode Exit fullscreen mode

3. Regular Consistency Checks

Create a monitoring script:

#!/bin/bash
# Check for mismatched extensions

mysql -u root -p asterisk -e "
SELECT vu.user_name, vu.extension as user_ext, ve.extension as db_ext
FROM vicidial_users vu
LEFT JOIN vicidial_extensions ve ON vu.extension = ve.extension
WHERE vu.extension != ve.extension OR ve.extension IS NULL
" | mail -s "ViciDial Extension Mismatch Alert" admin@company.com
Enter fullscreen mode Exit fullscreen mode

4. Version Control Configuration

Use Git to track /etc/asterisk changes:

cd /etc/asterisk
git init
git add sip-vicidial.conf extensions-vicidial.conf
git commit -m "Initial SIP configuration"
Enter fullscreen mode Exit fullscreen mode

5. Test Before Production

Create a test extension before assigning to users:

# In /etc/asterisk/sip-vicidial.conf
[9999]
type=friend
context=from-internal
secret=testpass
extension=9999

# Test with a softphone
asterisk -rx "sip reload"
# Register softphone as 9999
# Verify: asterisk -rx "sip show peers" | grep 9999
Enter fullscreen mode Exit fullscreen mode

Summary

The "Extension Does Not Match" error in ViciDial stems from misalignment between the phone's registration attempt and ViciDial's configuration or database. To resolve this:

  1. Identify the error — Enable SIP debug and check /var/log/asterisk/messages
  2. Verify database records — Ensure vicidial_users and vicidial_extensions entries are synchronized
  3. Review SIP configuration — Confirm the section header matches the extension field in /etc/asterisk/sip-vicidial.conf
  4. Check dialplan — Verify the extension exists in /etc/asterisk/extensions-vicidial.conf
  5. Reload configuration — Use sip reload and dialplan reload (not full restart)
  6. Test phone settings — Use the extension number, not user name, in the phone's SIP configuration
  7. Clear cache — Reload the SIP module to clear cached peer data
  8. Monitor registration — Verify with sip show peers and test login in the agent screen

By following this systematic approach and implementing the prevention practices outlined, you'll eliminate extension registration issues in your ViciDial deployment. Most problems resolve at Step 3 (SIP configuration) or Step 2 (database synchronization).

Top comments (0)