Skip to content

Generating Config Files

OpenSIPS provides ready-to-use GNU M4 configuration templates under examples/templates/:

  • residential.m4
  • trunking.m4
  • loadbalancer.m4

They are installed as shared examples under $PREFIX/share/opensips/examples/templates/. Distribution packages typically use /usr/share/opensips/examples/templates/.

Each template starts with definitions for its listening interface, database URL, optional endpoints, and feature switches. Edit these definitions before using the template. Feature switches accept yes or no.

Use -f to select the template and -p m4 to preprocess it before OpenSIPS parses it:

Terminal window
opensips -C -f examples/templates/residential.m4 -p m4
opensips -f examples/templates/residential.m4 -p m4

The first command checks the generated configuration. The second starts OpenSIPS. GNU M4 must be installed and available in PATH.

For an installed distribution package, use the template from the shared examples directory:

Terminal window
opensips -f /usr/share/opensips/examples/templates/residential.m4 -p m4

You can render a template into a regular configuration file:

Terminal window
m4 examples/templates/residential.m4 > opensips.cfg

The resulting file no longer requires preprocessing. Edit it as needed, then check or start it normally:

Terminal window
opensips -C -f opensips.cfg
opensips -f opensips.cfg

See examples/templates/README.md for additional examples.