sipproxy

command module
v0.0.0-...-b1b296b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

README

Description


  • Enables the use of Dialfire in conjunction with a SIP trunk that only supports IP based authentication.
  • In addition, the proxy can dynamically register with the SIP Trunk if required.

Start-up


sipProxy -ip {public ip of your machine} -ld {directory for logfiles} -t {operation mode}

Operation modes


  • {your tenant id} ... use your tenant id to only allow calls from your Dialfire tenant (recommended)
  • all ... accept all calls from Dialfire
  • open ... accept all calls from anywhere WITHOUT authorization (not recommended)

Full list of command line options


sipProxy --help

Header Rewriting Flags (v2.0.8+)

For strict trunk providers (e.g., OVH) that require specific header formats:

⚠️ Warning: These flags modify SIP headers in non-RFC-compliant ways. Only use if required by your trunk provider.

Flag RFC Compliant? Description
-rewrite-aor ❌ No Enable all header rewriting (master switch)
-rewrite-from ❌ No Rewrite From/P-Asserted-Identity to match registered AoR
-normalize-e164 ⚠️ Gray Add "+" prefix to phone numbers (e.g., 33123 → +33123)
-remove-port ✅ Mostly Remove port from Request-URI (e.g., sip:user@host:5060 → sip:user@host)

When -rewrite-aor/-rewrite-from is enabled the proxy also rewrites the INVITE Contact to the Contact acknowledged in the last REGISTER 200 OK (public IP:port, transport=UDP) and leaves the To header without a transport suffix to match common OVH/Zoiper behaviour.

Usage examples:

# Default (RFC-compliant, safe for all trunks)
sipProxy -ip 1.2.3.4 -t all

# For OVH and similar strict providers
sipProxy -ip 1.2.3.4 -t all -rewrite-aor

# Custom: Only E.164 normalization
sipProxy -ip 1.2.3.4 -t all -normalize-e164

Local Test Harness


The repository contains a small self-contained simulator to exercise the full REGISTER/INVITE flow locally without real trunks.

simulator/
├── api         # HTTP stub for /authorize and /signature/create
├── registrar   # UDP registrar that issues 401 challenges and reports 200 OK
├── caller      # INVITE generator that sends ACK and BYE responses
└── run.sh      # Orchestrates the components and the sipProxy binary

Prerequisites

  • Go toolchain installed (the simulator is executed via go run)
  • A compiled proxy binary (default path: ./sipProxy_2.0.8)

Running the end-to-end test

From the repository root:

# Full integration test
./simulator/run.sh -b ./sipProxy_2.0.8

# Flag-specific tests
./tests/test_rewrite_flag.sh        # Test -rewrite-aor flag
./tests/test_granular_flags.sh      # Test individual flags

run.sh launches the API stub, registrar, proxy, and caller in sequence and prints the logs when the call completes. Useful flags:

  • -b PATH – proxy binary to execute
  • -t TENANT – tenant id used when starting the proxy (default: all)
  • -i IP / -P PORT – proxy bind address
  • -D DOMAIN – SIP domain/realm advertised by the registrar (default: 127.0.0.2)
  • -R ROUTE – registrar host:port the proxy will register against (default: 127.0.0.2:5060)
  • -p FILE – source additional environment overrides from a profile file

To emulate provider-specific behaviour without committing credentials, copy simulator/profiles/ovh.env.example to simulator/profiles/ovh.env, replace the placeholder values, and run ./simulator/run.sh -b ./sipProxy_2.0.8 -p simulator/profiles/ovh.env. Profile files with real tokens are ignored by Git.

The simulator writes its logs to simulator/*.log; these files are ignored by .gitignore.

Contributing

Contributions are welcome! Please:

  • Fork the repository
  • Create a feature branch
  • Add tests for new functionality
  • Ensure all tests pass
  • Update documentation
  • Submit a pull request

See SECURITY.md for security guidelines.

License

This project is licensed under the Apache License 2.0. See the LICENSE.txt file for details.

Copyright 2025 Modima GmbH

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
simulator
api command
caller command
registrar command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL