siprec icon indicating copy to clipboard operation
siprec copied to clipboard

SIP_HOST is not being used

Open a72 opened this issue 1 year ago • 3 comments

Hello, and thank you for your work on this project.

I noticed that the SIP_HOST parameter seems to be ignored. I tried setting all SIP-related environment variables like this:

EXTERNAL_IP=127.0.0.1
INTERNAL_IP=127.0.0.1
SIP_HOST=127.0.0.1

However, the 100 Trying SIP response was still sent from the network interface address 10.10.0.1, instead of 127.0.0.1.

It looks like SIP_HOST is currently not being used, or it is not applied when building SIP responses.

Expected behavior

When SIP_HOST is set, SIP messages should use this value as the source address.

Actual behavior

SIP responses are sent using the interface IP (in my case 10.10.0.1), even though SIP_HOST is defined.

Could you please check this behavior and make SIP_HOST take effect?

Thank you!

a72 avatar Oct 22 '25 08:10 a72

The SIP_HOST environment variable was documented but not actually implemented in the code. The server was hardcoded to bind to 0.0.0.0 (all interfaces), which caused SIP responses to use the interface IP (10.10.0.1) instead of the configured value (127.0.0.1). Changes Made:

  1. Added Host field to NetworkConfig (pkg/config/config.go:73) - Maps to SIP_HOST environment variable - Default value: "0.0.0.0"
  2. Updated SIP server binding (cmd/siprec/main.go:887) - Changed from hardcoded "0.0.0.0" to appConfig.Network.Host - Server now respects the configured bind address
  3. Enhanced logging (cmd/siprec/main.go:1059) - Added sip_host to network configuration log output
  4. Updated documentation (docs/configuration/ENVIRONMENT.md:8) - Clarified how SIP_HOST affects bind address and SIP headers
  5. Added test coverage (pkg/config/config_test.go:186) - Verifies default value is correctly applied

loreste avatar Oct 22 '25 14:10 loreste

that has been fixed

loreste avatar Oct 22 '25 16:10 loreste

https://github.com/loreste/siprec/commit/e4e8f49888e768e6b38bed41e767d0c3b3885186

loreste avatar Oct 22 '25 16:10 loreste