Skip to content

[mod_sofia] Pass deflect targets with a URI scheme through unchanged - #3210

Open
morbit85 wants to merge 1 commit into
masterfrom
dmitry/fix_deflect
Open

morbit85 wants to merge 1 commit into
masterfrom
dmitry/fix_deflect

Conversation

@morbit85

@morbit85 morbit85 commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

The deflect handler prefixed sip: and appended the profile address to any target not starting with sip:. tel:, sips: and other URIs went out as sip:tel:...@<ip>. A name-addr target, as a proxied Refer-To or ${sip_refer_to} passes it, went out as sip:<sip:...>@<ip>, or was not sent at all when it carried a display name, URI params or ?Replaces=.

sofia_deflect_build_refer_to() now builds the Refer-To:

  • a target that has a URI scheme or contains < goes out as given
  • user@host, with or without a host port, only gains the sip: scheme
  • a bare user or number is addressed at the profile, as before
  • an empty or NULL target, which the deflect app passes when run without data, is rejected; the handler logs it and sends no REFER

Adds test_sofia_deflect_build_refer_to to test_sofia_funcs: rejected targets, bare users with IPv4 and IPv6 profile addresses, user@host forms, URIs with a scheme, name-addr forms, the known limitations and truncation.

The deflect handler prefixed `sip:` and appended the profile address to any
target not starting with `sip:`. `tel:`, `sips:` and other URIs went out as
`sip:tel:...@<ip>`. A name-addr target, as a proxied `Refer-To` or
`${sip_refer_to}` passes it, went out as `sip:<sip:...>@<ip>`, or was not sent
at all when it carried a display name, URI params or `?Replaces=`.

`sofia_deflect_build_refer_to()` now builds the `Refer-To`:
- a target that has a URI scheme or contains `<` goes out as given
- `user@host`, with or without a host port, only gains the `sip:` scheme
- a bare user or number is addressed at the profile, as before
- an empty or `NULL` target, which the `deflect` app passes when run without
  data, is rejected; the handler logs it and sends no REFER

Adds `test_sofia_deflect_build_refer_to` to `test_sofia_funcs`: rejected
targets, bare users with IPv4 and IPv6 profile addresses, `user@host` forms,
URIs with a scheme, name-addr forms, the known limitations and truncation.
@morbit85
morbit85 requested a review from andywolk October 2, 2026 13:01
@morbit85 morbit85 added the bug Something isn't working label Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant