Configuration Generation Examples
April 28, 2026 ยท View on GitHub
The OpenSIPS MCP Server includes a powerful configuration engine that generates complete, production-ready OpenSIPS configurations from templates.
List Available Scenarios
{
"tool": "cfg_list_scenarios",
"arguments": {}
}
Response:
{
"result": [
{"name": "load_balancer", "description": "Load balancer with health checking", "required_params": ["db_url"], "optional_params": ["listen_ip", "listen_port"]},
{"name": "class4_sbc", "description": "Class 4 SBC / transit switch", "required_params": ["db_url"], "optional_params": ["listen_ip"]},
{"name": "registrar_class5", "description": "Registrar with user authentication", "required_params": ["db_url", "domain"], "optional_params": ["listen_ip"]},
{"name": "webrtc_gateway", "description": "WebRTC to SIP gateway", "required_params": ["db_url"], "optional_params": ["ws_port", "wss_port", "tls_cert", "tls_key"]},
{"name": "residential_pbx", "description": "Residential PBX with routing", "required_params": ["db_url", "domain"], "optional_params": ["listen_ip"]},
{"name": "call_center", "description": "Call center with agent queues", "required_params": ["db_url"], "optional_params": ["listen_ip"]},
{"name": "b2bua", "description": "Back-to-back user agent", "required_params": ["db_url"], "optional_params": ["listen_ip"]},
{"name": "sbc_with_rtpengine", "description": "SBC with RTPEngine media relay", "required_params": ["db_url", "rtpengine_sock"], "optional_params": ["listen_ip"]}
]
}
Get Scenario Parameters
Before generating, check what parameters a scenario needs:
{
"tool": "cfg_get_scenario_params",
"arguments": {
"scenario": "load_balancer"
}
}
Response:
{
"description": "Load balancer with health checking",
"required_params": ["db_url"],
"optional_params": ["listen_ip", "listen_port"]
}
Generate a Load Balancer Config
{
"tool": "cfg_generate",
"arguments": {
"scenario": "load_balancer",
"params": {
"db_url": "mysql://opensips:opensipsrw@localhost/opensips",
"listen_ip": "0.0.0.0",
"listen_port": 5060
}
}
}
The response contains a complete OpenSIPS configuration file ready to deploy.
Generate a Registrar Config
{
"tool": "cfg_generate",
"arguments": {
"scenario": "registrar_class5",
"params": {
"db_url": "mysql://opensips:opensipsrw@localhost/opensips",
"domain": "voip.example.com",
"listen_ip": "10.0.0.1"
}
}
}
Generate a WebRTC Gateway Config
{
"tool": "cfg_generate",
"arguments": {
"scenario": "webrtc_gateway",
"params": {
"db_url": "mysql://opensips:opensipsrw@localhost/opensips",
"ws_port": 8080,
"wss_port": 4443,
"tls_cert": "/etc/opensips/tls/server.pem",
"tls_key": "/etc/opensips/tls/server-key.pem"
}
}
}
Generate an SBC with RTPEngine Config
{
"tool": "cfg_generate",
"arguments": {
"scenario": "sbc_with_rtpengine",
"params": {
"db_url": "mysql://opensips:opensipsrw@localhost/opensips",
"rtpengine_sock": "udp:10.0.0.5:22222",
"listen_ip": "0.0.0.0"
}
}
}
Generate a Call Center Config
{
"tool": "cfg_generate",
"arguments": {
"scenario": "call_center",
"params": {
"db_url": "mysql://opensips:opensipsrw@localhost/opensips",
"listen_ip": "10.0.0.1"
}
}
}
Generate a Class 4 SBC Config
{
"tool": "cfg_generate",
"arguments": {
"scenario": "class4_sbc",
"params": {
"db_url": "mysql://opensips:opensipsrw@localhost/opensips",
"listen_ip": "0.0.0.0"
}
}
}
Generate a Residential PBX Config
{
"tool": "cfg_generate",
"arguments": {
"scenario": "residential_pbx",
"params": {
"db_url": "mysql://opensips:opensipsrw@localhost/opensips",
"domain": "home.example.com",
"listen_ip": "192.168.1.1"
}
}
}
Generate a B2BUA Config
{
"tool": "cfg_generate",
"arguments": {
"scenario": "b2bua",
"params": {
"db_url": "mysql://opensips:opensipsrw@localhost/opensips",
"listen_ip": "0.0.0.0"
}
}
}
Validate a Generated Config
After generating, validate the configuration against the OpenSIPS binary:
{
"tool": "cfg_validate",
"arguments": {
"config": "# paste the generated config here..."
}
}
Response on success:
{
"valid": true,
"output": "config file ok, exiting..."
}
Response on failure:
{
"valid": false,
"output": "parse error in config file at line 42: unknown module 'nonexistent.so'"
}
Generate and Iteratively Validate
Use cfg_generate_iterative to generate a config and automatically fix validation errors:
{
"tool": "cfg_generate_iterative",
"arguments": {
"scenario": "load_balancer",
"params": {
"db_url": "mysql://opensips:opensipsrw@localhost/opensips"
},
"max_iterations": 3
}
}
Compare Two Configs
Diff two configurations to see what changed:
{
"tool": "cfg_diff",
"arguments": {
"config_a": "# old config...",
"config_b": "# new config..."
}
}
Explain a Route Block
Get an explanation of what a route block does:
{
"tool": "cfg_explain_route",
"arguments": {
"route_code": "route[relay] {\n if (!t_relay()) {\n sl_reply_error();\n }\n}"
}
}
Add a Module to an Existing Config
{
"tool": "cfg_add_module",
"arguments": {
"config": "# existing opensips.cfg content...",
"module": "pike",
"params": {
"sampling_time_unit": 2,
"reqs_density_per_unit": 30,
"remove_latency": 120
}
}
}
Optimize a Config
Get optimization suggestions:
{
"tool": "cfg_optimize",
"arguments": {
"config": "# existing opensips.cfg content..."
}
}
Using the build_config Prompt
For an interactive, guided experience, use the build_config prompt:
{
"prompt": "build_config",
"arguments": {
"requirements": "I need a SIP load balancer that distributes calls across 4 media servers with health checking and failover. Should use MySQL for persistence."
}
}
The prompt guides the conversation through scenario selection, parameter collection, generation, and validation.
Using the design_architecture Prompt
For multi-node architectures:
{
"prompt": "design_architecture",
"arguments": {
"requirements": "High-availability VoIP platform for 10,000 concurrent calls with geographic redundancy",
"scale": "500 CPS peak, 10k concurrent"
}
}