Branch: refs/heads/master
  Home:   https://github.com/OpenSIPS/opensips
  Commit: e6686119de2bbe1e672943437978618efdf2ebd4
      
https://github.com/OpenSIPS/opensips/commit/e6686119de2bbe1e672943437978618efdf2ebd4
  Author: Norm Brandinger <[email protected]>
  Date:   2026-06-09 (Tue, 09 Jun 2026)

  Changed paths:
    M modules/stir_shaken/stir_shaken.c
    M parser/parse_uri.c
    M parser/parse_uri.h
    M parser/test/test_parser.c

  Log Message:
  -----------
  stir_shaken: strip RFC 4904 user parameters from telephone numbers (#3904)

get_orig_tn_from_msg()/get_dest_tn_from_msg() take the originating and
destination telephone numbers straight from parse_uri()'s .user field. When a
From/To/P-Asserted-Identity URI carries RFC 4904 parameters in the userinfo
part, e.g.

    sip:+33123456789;tgrp=grp1;trunk-context=example.com@host

parse_uri() folds the whole userinfo into .user (the still_at_user backtrack in
parser/parse_uri.c) and leaves .user_param empty, so the parameters stay glued
to the number, the E.164 check in check_passport_phonenum() fails, and
stir_shaken_verify() errors out unless orig_tn/dest_tn are pre-cleaned from
script.

Add trim_user_params() in parser/parse_uri.c (declared in parse_uri.h) so it
can be reused from other modules/parts, and call it from both TN extraction
sites. It trims the userinfo str in place at the first ';' via the length-based
q_memchr() core util, so it is binary-safe and a no-op for params-free userinfo
(e.g. tel: URIs, where parse_uri() already splits the params off into
.host/params). No change for URIs without user parameters.

Unit tests (parser/test/test_parser.c, test_trim_user_params) pin the contract:
RFC 4904 params stripped, param-less userinfo untouched, cut at the first of
several ';', leading/bare ';' -> empty, empty/NULL-safe, idempotency, in-place
(.s unchanged), and that backslashes, special characters and an embedded NUL
are preserved up to the first ';'. An end-to-end case composes the real
parse_uri() with trim_user_params() to pin the fold-into-.user premise.
make test module=core: 1..2564, all ok.

Based on the patch proposed by @StellaTeam in #3904.

Closes #3904


  Commit: 2c99890996a49949e03bc36ad43dc926a0065128
      
https://github.com/OpenSIPS/opensips/commit/2c99890996a49949e03bc36ad43dc926a0065128
  Author: Bogdan Andrei IANCU <[email protected]>
  Date:   2026-06-09 (Tue, 09 Jun 2026)

  Changed paths:
    M modules/stir_shaken/stir_shaken.c
    M parser/parse_uri.c
    M parser/parse_uri.h
    M parser/test/test_parser.c

  Log Message:
  -----------
  Merge pull request #3906 from NormB/fix/stir-shaken-tn-params

stir_shaken: strip RFC 4904 user parameters from telephone numbers


Compare: 
https://github.com/OpenSIPS/opensips/compare/c7528472d429...2c99890996a4

To unsubscribe from these emails, change your notification settings at 
https://github.com/OpenSIPS/opensips/settings/notifications

_______________________________________________
Devel mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel

Reply via email to