Skip to content

[BUG] do_routing() doesn't populate variables properly #4071

Description

@FlyingDutchfrog

OpenSIPS version you are running

version: opensips 4.0.0-rc1 (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, CC_O0, 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: 43c43ae42
main.c compiled on 12:42:38 Jun 12 2026 with cc 14

Describe the bug

When checking for a route with do_routing() and its 'C' flag, the function seems to only populate the variable "rule_attrs_pvar" as seen in the documentation, but not "gw_attrs_pvar" and "carrier_attrs_pvar". Both of the latter are <null> when xlog()'d. This only happens with 'C' flag enabled; it works properly without it.

To Reproduce

  1. Have a do_routing() function call with check-only flag in loose_route{}
do_routing(1, "C", , $avp(rule_attrs), $avp(gw_attrs), $avp(carrier_attrs));
  1. Log all 3 variables
xlog(rule_attrs: $avp(rule_attrs));           # is populated with value from db
xlog(gw_attrs: $avp(gw_attrs));              # is <null>, even when value is present in db
xlog(carrier_attrs: $avp(carrier_attrs));   # is <null>, even when value is present in db

Expected behavior

For do_routing() with 'C' flag to populate all AVP variables.

Relevant System Logs

No errors displayed, variables are just <null> without explanation.

OS/environment information

  • Operating System:
    • Linux
    • 6.12.90+deb13.1-cloud-amd64
    • #1 SMP PREEMPT_DYNAMIC
    • Debian 6.12.90-2 (2026-05-27)
    • Debian 13 trixie
    • x86_64
    • GNU/Linux
  • OpenSIPS installation: git pull, make menuconfig
  • other relevant information: n/a

Additional context
n/a

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions