← All Tutorials

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

ViciDial Administration Intermediate 13 min read #78

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:


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:


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"

Have the phone attempt registration, then check logs:

tail -f /var/log/asterisk/messages | grep -i "does not match"

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

Turn off debug after troubleshooting to reduce log noise:

asterisk -rx "sip set debug off"

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';

Example output:

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

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';

Example output:

+-----------+-----------------+-------------+--------------------+
| extension | dialplan_number | voicemail_id| voicemail_password |
+-----------+-----------------+-------------+--------------------+
| 6001      | 6001            | 6001        | 1234               |
+-----------+-----------------+-------------+--------------------+

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%';

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

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\]"

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

Common Issues in sip-vicidial.conf

Issue 1: Extension field missing

[6001]
type=friend
context=from-internal
secret=password123
host=dynamic

Fix: Add the extension line:

[6001]
type=friend
context=from-internal
secret=password123
host=dynamic
extension=6001

Issue 2: Extension mismatch

[6001]
type=friend
extension=6000

Fix: Ensure the section header matches the extension field:

[6001]
type=friend
extension=6001

Issue 3: Duplicate extensions

[6001]
type=friend
extension=6001

[softphone-john]
type=friend
extension=6001

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

Check Extensions Dialplan

Verify the extension exists in the Asterisk dialplan:

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

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()

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"

Monitor the output for errors:

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

Reload Dialplan

asterisk -rx "dialplan reload"

Verify the Extension is Recognized

asterisk -rx "sip show peer 6001"

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

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)

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

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

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');

To update an existing record:

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

Update vicidial_users Record

Ensure the user's extension matches:

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

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';

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"

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"

Verify Registration Status

Check if the phone is now registered:

asterisk -rx "sip show peers" | grep 6001

Expected output:

6001/6001                              192.168.1.50:54321   OK (53 ms)

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:

Monitor Registration Status

Check the ViciDial logs directory:

tail -f /var/log/asterisk/messages | grep -i "6001"

Also check the ViciDial application log:

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

Verify Call Flow

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

asterisk -rx "core show channels" | grep 6001

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',
 '[email protected]', '[email protected]', 1, NOW());

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');

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

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()

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

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

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"
    
  2. Check for firewall blocking SIP:

    iptables -L -n | grep 5060
    
  3. Ensure port 5060 is open:

    firewall-cmd --add-port=5060/udp --permanent
    firewall-cmd --reload
    
  4. Check phone can reach server:

    ping 192.168.1.100
    nmap -p 5060 192.168.1.100
    

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;
    
  2. Remove duplicate SIP peer sections:

    grep -n "^\[6001\]" /etc/asterisk/sip-vicidial.conf
    

    Delete duplicate sections, keeping only one.

  3. Reload:

    asterisk -rx "module reload chan_sip.so"
    

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';
    
  2. Check user's active status:

    UPDATE vicidial_users SET active = 'Y' WHERE user_name = 'john.smith';
    
  3. Verify user has correct extension:

    SELECT extension FROM vicidial_users WHERE user_name = 'john.smith';
    
  4. Check ViciDial application logs:

    tail -50 /var/log/vicidial.log | tail -20
    
  5. Verify user has a campaign assignment:

    SELECT * FROM vicidial_user_groups 
    WHERE user_id = 125;
    

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

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
    
  2. Assign unique extensions to each agent:

    UPDATE vicidial_users SET extension = '6002' WHERE user_name = 'jane.doe';
    
  3. Create SIP peer for new extension:

    [6002]
    type=friend
    context=from-internal
    secret=sipchannel456
    extension=6002
    
  4. Reload:

    asterisk -rx "sip reload"
    

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"
    
  2. Verify dialplan:

    asterisk -rx "dialplan show 6001@from-internal"
    
  3. Enable call logging:

    grep -i "6001" /var/log/asterisk/messages | tail -20
    
  4. Test dial directly:

    asterisk -rx "channel originate SIP/6001 extension 6001@from-internal"
    

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)

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

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" [email protected]

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"

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

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).

Stuck on something specific?

Book a free 30-minute call. I run ViciDial centers across 3 countries and can usually unblock your setup in one session — or build it for you.

Book a Free Consultation