Skip to content

[BUG] Is it possible that the subscriber table in version 3.6 is missing an rpid field? #3790

@NFhook

Description

@NFhook

OpenSIPS version you are running

version: opensips 3.6.3 (x86_64/linux)
flags: STATS: On, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, HP_MALLOC, F_PARALLEL_MALLOC, DBG_MALLOC, FAST_LOCK-ADAPTIVE_WAIT
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535
poll method support: poll, epoll, sigio_rt, select.
git revision: d5222226a
main.c compiled on  with gcc 12

Describe the bug

After creating the database tables and inserting subscriber records using the SQL scripts provided under opensips/scripts/mysql, SIP registration fails with database-related errors when OpenSIPS attempts to authenticate the user.

The issue occurs during the digest authentication process, when the auth_db module tries to retrieve credentials from the subscriber table.


To Reproduce

  1. Install OpenSIPS 3.6.3 from the official APT repository on Debian 12
  2. Initialize the database using the SQL scripts from opensips/scripts/mysql (including auth_db-create.sql)
  3. Insert subscriber records into the subscriber table
  4. Start OpenSIPS
  5. Attempt to REGISTER a SIP user that exists in the subscriber table
  6. Observe the errors in the OpenSIPS logs during authentication

Expected behavior

OpenSIPS should successfully query the subscriber table, retrieve the user credentials, and allow the SIP REGISTER request to complete successfully when valid credentials are provided.


Relevant System Logs

ERROR:db_mysql:db_mysql_do_prepared_query: failed to create new context for query=|select password,rpid from subscriber where username=? AND domain=?|
ERROR:auth_db:get_ha1: failed to query database
WARNING:core:do_assign: no value in right expression at /etc/opensips/opensips.cfg:899

OS / environment information

  • Operating System: Debian GNU/Linux 12 (bookworm)
  • OpenSIPS installation: OpenSIPS 3.6.3 installed from the official APT repository
  • Database backend: MySQL

Additional context

Below is the exact SQL used to create the subscriber and uri tables, taken from auth_db-create.sql and related scripts:

INSERT INTO version (table_name, table_version) values ('subscriber','8');

CREATE TABLE subscriber (
    id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
    username CHAR(64) DEFAULT '' NOT NULL,
    domain CHAR(64) DEFAULT '' NOT NULL,
    password CHAR(25) DEFAULT '' NOT NULL,
    ha1 CHAR(64) DEFAULT '' NOT NULL,
    ha1_sha256 CHAR(64) DEFAULT '' NOT NULL,
    ha1_sha512t256 CHAR(64) DEFAULT '' NOT NULL,
    CONSTRAINT account_idx UNIQUE (username, domain)
) ENGINE=InnoDB;

CREATE INDEX username_idx ON subscriber (username);

INSERT INTO version (table_name, table_version) values ('uri','2');

CREATE TABLE uri (
    id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
    username CHAR(64) DEFAULT '' NOT NULL,
    domain CHAR(64) DEFAULT '' NOT NULL,
    uri_user CHAR(64) DEFAULT '' NOT NULL,
    last_modified DATETIME DEFAULT '1900-01-01 00:00:01' NOT NULL,
    CONSTRAINT account_idx UNIQUE (username, domain, uri_user)
) ENGINE=InnoDB;

This issue does not occur in OpenSIPS 3.5
In OpenSIPS 3.5, the subscriber table schema includes the rpid column, and SIP registration works correctly using the same configuration and authentication logic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions