### Install dsiprouter v0.523 Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/upgrade_0.522_to_0.523.md Clone the repository and run the installation script. ```bash cd /opt/ apt-get update apt-get install -y git curl cd /opt git clone -b v0.523 https://github.com/dOpensource/dsiprouter.git cd dsiprouter ./dsiprouter.sh install ``` -------------------------------- ### Start DSIPRouter Service Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/command_line_options.md Use this command to start the dSIPRouter service. Ensure the command is available in your PATH or execute it from the installation directory. ```bash dsiprouter start ``` -------------------------------- ### Install dSIPRouter (With RTP Proxy) Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/debian_install.md Installation process including RTPEngine for proxying audio traffic. ```bash apt-get update -y apt-get install -y git cd /opt git clone https://github.com/dOpensource/dsiprouter.git cd dsiprouter ./dsiprouter.sh install -all ``` ```bash apt-get update -y && apt-get install -y git && cd /opt && git clone https://github.com/dOpensource/dsiprouter.git && cd dsiprouter && ./dsiprouter.sh install -all ``` -------------------------------- ### Set System Hostname Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/debian_install.md Configure the server hostname to a fully qualified domain name (FQDN) before starting the installation. ```bash hostnamectl set-hostname ``` -------------------------------- ### Install dSIPRouter with Development Options Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/dev/external_links/CONTRIBUTING.md Executes the installation script with flags to enable development features and server NAT support. ```bash ./dsiprouter.sh install -all -servernat -with_dev ``` -------------------------------- ### Install dsiprouter v0.51 Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/upgrade_0.50_to_0.51.md Download and install the new version of dsiprouter. ```bash cd /opt/ apt-get update apt-get install -y git curl cd /opt git clone -b v0.51 https://github.com/dOpensource/dsiprouter.git cd dsiprouter ./dsiprouter.sh install ``` -------------------------------- ### Install dSIPRouter (No RTP Proxy) Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/debian_install.md Standard installation process for dSIPRouter without RTP proxying capabilities. ```bash apt-get update -y apt-get install -y git cd /opt git clone https://github.com/dOpensource/dsiprouter.git cd dsiprouter ./dsiprouter.sh install ``` ```bash apt-get update -y && apt-get install -y git && cd /opt && git clone https://github.com/dOpensource/dsiprouter.git && cd dsiprouter && ./dsiprouter.sh install ``` -------------------------------- ### Wildcard Subdomain Authorization Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/use-cases.md Example of a wildcard subdomain configuration for multi-tenant setups. ```text * ``` -------------------------------- ### Backup Kamailio Database Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/upgrade_0.50_to_0.51.md Create a backup of the existing Kamailio database before starting the upgrade. ```bash cd /opt/ mysqldump kamailio > kamailio-bk.sql ``` -------------------------------- ### Enable RTPEngine via JSON-RPC Source: https://context7.com/dopensource/dsiprouter/llms.txt Activates RTPEngine for media proxying. Ensure RTPEngine is installed and reachable by the dSIPRouter service. ```python sendJsonRpcCmd('127.0.0.1', 'rtpengine.enable', ['all', 1]) ``` -------------------------------- ### Connect to Microsoft Teams via PowerShell Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/use-cases.md Initial setup and authentication commands for the MicrosoftTeams PowerShell module. ```powershell Install-Module -Name MicrosoftTeams Import-Module MicrosoftTeams $userCredential = Get-Credential Connect-MicrosoftTeams -Credential $userCredential ``` -------------------------------- ### Manage dSIPRouter via CLI Source: https://context7.com/dopensource/dsiprouter/llms.txt Use the dSIPRouter shell script for installation, service control, and configuration management. ```bash # Clone the repository git clone https://github.com/dOpensource/dsiprouter.git cd dsiprouter # Install dSIPRouter with all components (Kamailio, RTPEngine, web GUI) ./dsiprouter.sh install -all # Install with specific options ./dsiprouter.sh install -kam -dsip -rtp -servernat # Start dSIPRouter services dsiprouter start # Stop dSIPRouter services dsiprouter stop # Restart dSIPRouter services dsiprouter restart # Reconfigure Kamailio based on current settings dsiprouter configurekam # Reconfigure RTPEngine dsiprouter configurertp # Reset admin password dsiprouter resetpassword # Set API token credentials DSIP_TOKEN="your-api-token" dsiprouter setcredentials -ac $DSIP_TOKEN # Renew SSL certificate (Let's Encrypt) dsiprouter renewsslcert # Uninstall dSIPRouter completely dsiprouter uninstall -all # Show version dsiprouter version ``` -------------------------------- ### Upgrade dSIPRouter via CLI Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/upgrade_0.621_to_0.63.md Execute these commands within the installation directory to stash local changes, switch to the target version, and run the upgrade utility. ```bash cd /opt/dsiprouter git stash git checkout v0.63 dsiprouter upgrade -rel 0.63 ``` -------------------------------- ### Apply Terraform for Demo Instance with DNS and Custom Commands Source: https://github.com/dopensource/dsiprouter/blob/master/resources/terraform/do/README.md This command applies the Terraform configuration to create a demo dSIPRouter instance with specific DNS settings and executes custom commands during setup, such as setting credentials. ```bash terraform apply -var branch=master -var dns_hostname=test -var dns_demo_domain=dsiprouter.org -var additional_commands='dsiprouter setcredentials -dc admin:ZmIwMTdmY2I5NjE4' ``` -------------------------------- ### Remove or Move dsiprouter Directory Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/upgrade_0.50_to_0.51.md Clear the old installation directory to prepare for the new version. ```bash mv /dsiprouter /usr/local/src (moving directory) ``` ```bash rm -r /dsiprouter (removing directory) ``` -------------------------------- ### Copy and Compile dsiprouter Module Source: https://github.com/dopensource/dsiprouter/blob/master/kamailio/modules/dsiprouter/README.md Copies the dsiprouter module source to the Kamailio source directory and compiles it. Assumes DSIP_PROJECT_DIR is set to your dSIPRouter installation path. ```bash DSIP_PROJECT_DIR=/opt/dsiprouter cp -rf ${DSIP_PROJECT_DIR}/kamailio/modules/dsiprouter/ /tmp/kamailio/src/modules/ cd /tmp/kamailio/src/modules/dsiprouter make ``` -------------------------------- ### GET /api/v1/lease/endpoint Source: https://context7.com/dopensource/dsiprouter/llms.txt Creates a temporary endpoint lease for dynamic SIP device registration with automatic expiration. ```APIDOC ## GET /api/v1/lease/endpoint ### Description Creates a temporary endpoint lease for dynamic SIP device registration with automatic expiration. ### Method GET ### Endpoint /api/v1/lease/endpoint ### Parameters #### Query Parameters - **ttl** (string) - Required - Time to live for the lease (e.g., 15m) - **email** (string) - Required - Email address associated with the lease ### Response #### Success Response (200) - **error** (string) - Error message if any - **msg** (string) - Status message - **kamreload** (boolean) - Indicates if a reload is pending - **data** (array) - Lease details #### Response Example { "error": "", "msg": "Lease created", "kamreload": true, "data": [{ "leaseid": 42, "username": "lease123", "password": "randomGeneratedPassword32chars", "domain": "sip.dsiprouter.org", "ttl": 900 }] } ``` -------------------------------- ### Apply Terraform Configuration to Create Instance Source: https://github.com/dopensource/dsiprouter/blob/master/resources/terraform/do/README.md Use the 'terraform apply' command to create a new dSIPRouter instance. You can specify the branch to use, for example, 'master'. ```bash terraform apply -var branch=master ``` -------------------------------- ### Restart DSIPRouter Service Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/command_line_options.md Use this command to restart the dSIPRouter service. This command is equivalent to stopping and then starting the service. ```bash dsiprouter restart ``` -------------------------------- ### Reset dSIPRouter Credentials Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/api.md Use this command to reset your API token if you did not save it during installation. Ensure DSIP_HOSTNAME and DSIP_TOKEN environment variables are set. ```bash DSIP_HOSTNAME= DSIP_TOKEN= dsiprouter setcredentials -ac $DSIP_TOKEN ``` -------------------------------- ### GET /api/v1/kamailio/stats Source: https://context7.com/dopensource/dsiprouter/llms.txt Retrieves real-time statistics from the Kamailio SIP proxy, including transaction manager metrics. ```APIDOC ## GET /api/v1/kamailio/stats ### Description Retrieves real-time statistics from the Kamailio SIP proxy including transaction manager stats. ### Method GET ### Endpoint /api/v1/kamailio/stats ### Response #### Success Response (200) - **error** (string) - Error message if any - **msg** (string) - Status message - **kamreload** (boolean) - Indicates if a reload is pending - **data** (array) - List of statistics objects #### Response Example { "error": "", "msg": "Successfully retrieved kamailio stats", "kamreload": false, "data": [{ "current": 0, "waiting": 0, "total": 1234, "total_local": 567, "rpl_received": 890, "rpl_generated": 123, "rpl_sent": 456 }] } ``` -------------------------------- ### Get Endpoint Group Details Source: https://context7.com/dopensource/dsiprouter/llms.txt Retrieves detailed configuration for a specific endpoint group including endpoints, authentication, and call settings. ```bash curl -k -H "Authorization: Bearer $DSIP_TOKEN" \ -X GET "https://$DSIP_HOSTNAME:5000/api/v1/endpointgroups/1" ``` -------------------------------- ### Clone Kamailio Version Branch Source: https://github.com/dopensource/dsiprouter/blob/master/kamailio/modules/dsiprouter/README.md Clones the specific version of Kamailio that matches your installed version. Ensure you have the KAM_VERSION environment variable set. ```bash KAM_VERSIONL=$(kamailio -v 2>/dev/null | grep '^version:' | awk '{print $3}' | sed -e 's/\([0-9]\.[0-9]\)\.[0-9]/\1/) rm -rf /tmp/kamailio 2>/dev/null git clone --depth 1 -c advice.detachedHead=false -b ${KAM_VERSION} https://github.com/kamailio/kamailio.git /tmp/kamailio ``` -------------------------------- ### Get Specific SSL Certificate by Domain Source: https://context7.com/dopensource/dsiprouter/llms.txt Retrieves the SSL certificate details for a specific domain. The domain name is used as a path parameter. ```bash curl -k -H "Authorization: Bearer $DSIP_TOKEN" \ -X GET "https://$DSIP_HOSTNAME:5000/api/v1/certificates/sbc.example.com" ``` -------------------------------- ### Clone and Prepare Feature Branch Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/dev/external_links/CONTRIBUTING.md Initializes the development environment by cloning the repository and creating a new feature branch. ```bash git clone -b master https://github.com/dOpensource/dsiprouter.git /opt/dsiprouter cd /opt/dsiprouter git checkout -b feature-ubuntu-20.04 ``` -------------------------------- ### Initialize Syntax Highlighting Source: https://github.com/dopensource/dsiprouter/blob/master/gui/templates/fullwidth_layout.html Configures highlight.js to process all pre code blocks upon document readiness. ```javascript $(document).ready(function() { /* add code syntax highlighting */ $('pre code').each(function(i, block) { hljs.highlightBlock(block); }); }); ``` -------------------------------- ### GET /api/v1/numberenrichment Source: https://context7.com/dopensource/dsiprouter/llms.txt Retrieves number enrichment rules for LNP and routing. ```APIDOC ## GET /api/v1/numberenrichment ### Description Retrieves DNID enrichment rules for LNP and routing number prefixing. ### Method GET ### Endpoint /api/v1/numberenrichment/{rule_id} ### Parameters #### Path Parameters - **rule_id** (integer) - Optional - The ID of the specific rule. ``` -------------------------------- ### Create Endpoint Lease Source: https://context7.com/dopensource/dsiprouter/llms.txt Generate a temporary registration lease for dynamic SIP devices. ```bash curl -k -H "Authorization: Bearer $DSIP_TOKEN" \ -H "Content-Type: application/json" \ -X GET "https://$DSIP_HOSTNAME:5000/api/v1/lease/endpoint?ttl=15m&email=admin@example.com" # Response: { "error": "", "msg": "Lease created", "kamreload": true, "data": [{ "leaseid": 42, "username": "lease123", "password": "randomGeneratedPassword32chars", "domain": "sip.dsiprouter.org", "ttl": 900 }] } ``` -------------------------------- ### GET /api/v1/cdrs/endpointgroups/{id} Source: https://context7.com/dopensource/dsiprouter/llms.txt Retrieves Call Detail Records for a specific endpoint group. ```APIDOC ## GET /api/v1/cdrs/endpointgroups/{id} ### Description Retrieves Call Detail Records for a specific endpoint group. ### Method GET ### Endpoint /api/v1/cdrs/endpointgroups/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The endpoint group ID. ``` -------------------------------- ### GET /api/v1/inboundmapping Source: https://context7.com/dopensource/dsiprouter/llms.txt Retrieves a list of inbound DID routing rules, optionally filtered by rule ID or DID pattern. ```APIDOC ## GET /api/v1/inboundmapping ### Description Retrieves a list of inbound DID routing rules. Can be filtered by rule ID or DID pattern. ### Method GET ### Endpoint /api/v1/inboundmapping ### Parameters #### Query Parameters - **ruleid** (integer) - Optional - The ID of the rule to retrieve. - **did** (string) - Optional - The DID pattern to filter by. ### Response #### Success Response (200) - **data** (array) - List of routing rules. #### Response Example { "error": "", "msg": "Rules Found", "data": [ { "ruleid": 1, "did": "18005551234", "name": "Main Line", "servers": ["1", "2"] } ] } ``` -------------------------------- ### Bootstrap Upgrade to dSIPRouter 0.721 from 0.70 Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/upgrading.md This script bootstraps the upgrade process to version 0.721 from version 0.70. SSH into your instance before running. ```bash curl -s https://raw.githubusercontent.com/dOpensource/dsiprouter/v0.721/resources/upgrade/v0.721/scripts/bootstrap.sh | bash ``` -------------------------------- ### Bootstrap Upgrade to dSIPRouter 0.73 from 0.72/0.721 Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/upgrading.md This script bootstraps the upgrade process to version 0.73 from versions 0.72 or 0.721. SSH into your instance before running. ```bash curl -s https://raw.githubusercontent.com/dOpensource/dsiprouter/v0.73/resources/upgrade/v0.73/scripts/bootstrap.sh | bash ``` -------------------------------- ### Execute All Unit Tests Source: https://github.com/dopensource/dsiprouter/blob/master/testing/README.md Run all available unit tests for dSIPRouter. Ensure you are in the testing directory. ```bash make all ``` -------------------------------- ### Settings Module Overview Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/dev/settings.rst Documentation for the settings module, covering members and configuration management. ```APIDOC ## Settings Module ### Description The settings module handles the configuration and internal parameters for the DSIPRouter project. It includes public, private, and special members used for system operation. ### Members - **Public Members**: Accessible configuration settings. - **Private Members**: Internal configuration logic and state. - **Special Members**: Python special methods used for object configuration. ``` -------------------------------- ### Configure FreePBX Firewall for dSIPRouter Source: https://github.com/dopensource/dsiprouter/blob/master/gui/templates/endpointgroups.html Run these commands as root on the FreePBX server to allow dSIPRouter to connect to the PBX SIP ports. This involves adding iptables rules for UDP traffic and optionally updating fail2ban configuration. ```bash DSIPROUTER_IP={{ dsiprouter_ip }} PBX_SIP_PORTS=(5060 5080) for PORT in ${PBX_SIP_PORTS[@]}; do iptables -A INPUT -p udp -s $DSIPROUTER_IP/32 --dport $PORT -j ACCEPT done iptables-save >/etc/iptables/rules.v4 # Run this command if your using fail2ban sed -i -r "s|(ignoreip = .*)|"1 $DSIPROUTER_IP/32|" /etc/fail2ban/jail.conf systemctl restart fail2ban ``` ```bash DSIPROUTER_IP={{ dsiprouter_ip }} PBX_SIP_PORTS=(5060 5080) for PORT in ${PBX_SIP_PORTS[@]}; do iptables -A INPUT -p udp -s $DSIPROUTER_IP/32 --dport $PORT -j ACCEPT done iptables-save >/etc/iptables/rules.v4 # Run this command if your using fail2ban sed -i -r "s|(ignoreip = .*)|"1 $DSIPROUTER_IP/32|" /etc/fail2ban/jail.conf systemctl restart fail2ban ``` -------------------------------- ### GET /api/v1/endpointgroups/{id} Source: https://context7.com/dopensource/dsiprouter/llms.txt Retrieves detailed configuration for a specific endpoint group including endpoints, authentication, and call settings. ```APIDOC ## GET /api/v1/endpointgroups/{id} ### Description Retrieves detailed configuration for a specific endpoint group including endpoints, authentication, and call settings. ### Method GET ### Endpoint /api/v1/endpointgroups/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the endpoint group to retrieve. ### Response #### Success Response (200) - **error** (string) - Error message if any. - **msg** (string) - Status message. - **data** (array) - List containing the endpoint group details. #### Response Example { "error": "", "msg": "Endpoint group found", "data": [{ "gwgroupid": 1, "name": "FreePBX-Cluster", "call_settings": { "limit": 100, "timeout": 300 }, "auth": { "type": "userpwd", "user": "pbx-user", "pass": "secret123", "domain": "sip.example.com" }, "endpoints": [ { "gwid": 1, "host": "192.168.1.10", "port": 5060, "signalling": "proxy", "media": "proxy", "description": "PBX-Primary", "rweight": 50, "keepalive": 1 } ] }] } ``` -------------------------------- ### Get Inbound Mapping by DID Pattern Source: https://context7.com/dopensource/dsiprouter/llms.txt Retrieves inbound DID routing rules that match a specific DID pattern. The did parameter should contain the desired pattern. ```bash curl -k -H "Authorization: Bearer $DSIP_TOKEN" \ -X GET "https://$DSIP_HOSTNAME:5000/api/v1/inboundmapping?did=18005551234" ``` -------------------------------- ### Bootstrap Upgrade to dSIPRouter 0.75 from 0.72/0.721 Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/upgrading.md This script bootstraps the upgrade process to version 0.75 from versions 0.72 or 0.721. Ensure you are on a supported OS version. ```bash curl -s https://raw.githubusercontent.com/dOpensource/dsiprouter/v0.75/resources/upgrade/v0.75/scripts/bootstrap.sh | bash ``` -------------------------------- ### Reload dSIPRouter Application Source: https://context7.com/dopensource/dsiprouter/llms.txt Restart the web GUI and API services. ```bash # Check if reload is in progress curl -k -H "Authorization: Bearer $DSIP_TOKEN" \ -X GET "https://$DSIP_HOSTNAME:5000/api/v1/reload/dsiprouter" # Trigger a reload curl -k -H "Authorization: Bearer $DSIP_TOKEN" \ -X POST "https://$DSIP_HOSTNAME:5000/api/v1/reload/dsiprouter" # Response: { "error": "", "msg": "dSIPRouter reload started" } ``` -------------------------------- ### Configure FusionPBX Database Access Source: https://github.com/dopensource/dsiprouter/blob/master/gui/templates/endpointgroups.html Run these commands as root on the FusionPBX server to allow dSIPRouter to access the PostgreSQL database. This involves modifying PostgreSQL configuration and iptables rules, and optionally configuring trust-based authentication and fail2ban. ```bash DSIPROUTER_IP={{ dsiprouter_ip }} sed -i -r "s/^#?listen_addresses[ ]?=[ ]?.*/listen_addresses = '*' /m" /etc/postgresql/*/main/postgresql.conf iptables -A INPUT -p tcp -s $DSIPROUTER_IP/32 --dport 5432 -j ACCEPT iptables-save >/etc/iptables/rules.v4 # Run this command if your don't want to enter a password for the FusionPBX Database(DB) Password echo -e "host all all $DSIPROUTER_IP/32 trust" >>/etc/postgresql/*/main/pg_hba.conf systemctl restart postgresql # Run this command if your using fail2ban sed -i -r "s|^#?(ignoreip = .*)|"1 $DSIPROUTER_IP/32|" /etc/fail2ban/jail.conf systemctl restart fail2ban ``` ```bash DSIPROUTER_IP={{ dsiprouter_ip }} sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*' /" /etc/postgresql/*/main/postgresql.conf iptables -A INPUT -p tcp -s $DSIPROUTER_IP/32 --dport 5432 -j ACCEPT iptables-save >/etc/iptables/rules.v4 # Run this command if your don't want to enter a password for the FusionPBX Database(DB) Password echo -e "host all all $DSIPROUTER_IP/32 trust" >>/etc/postgresql/*/main/pg_hba.conf systemctl restart postgresql # Run this command if your using fail2ban sed -i -r "s|^#?(ignoreip = .*)|"1 $DSIPROUTER_IP/32|" /etc/fail2ban/jail.conf systemctl restart fail2ban ``` -------------------------------- ### Restore and Update Database Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/upgrade_0.522_to_0.523.md Restore the database from the backup and apply necessary schema changes. ```bash cd /opt/ mysql kamailio < kamailio-bk.sql mysql kamailio -e "alter table dsip_multidomain_mapping add column domain_list_hash varchar(255) after domain_list;" ``` -------------------------------- ### Define Global GUI and API Base URLs Source: https://github.com/dopensource/dsiprouter/blob/master/gui/templates/fullwidth_layout.html Sets immutable window properties for GUI_BASE_URL and API_BASE_URL using settings from the server-side configuration. ```javascript Object.defineProperty(window, "GUI_BASE_URL", { configurable: false, writable: false, value: "{{ settings.DSIP_PROTO }}" + "://" + window.location.hostname + ":" + "{{ settings.DSIP_PORT }}" + "/" }); Object.defineProperty(window, "API_BASE_URL", { configurable: false, writable: false, value: "{{ settings.DSIP_API_PROTO }}" + "://" + window.location.hostname + ":" + "{{ settings.DSIP_API_PORT }}" + "/api/v1/" }); ``` -------------------------------- ### Get CDRs for Endpoint Group Source: https://context7.com/dopensource/dsiprouter/llms.txt Retrieves Call Detail Records (CDRs) for a specific endpoint group. The endpoint group ID is required as a path parameter. ```bash curl -k -H "Authorization: Bearer $DSIP_TOKEN" \ -X GET "https://$DSIP_HOSTNAME:5000/api/v1/cdrs/endpointgroups/1" ``` -------------------------------- ### Copy Terraform Configuration Sample Source: https://github.com/dopensource/dsiprouter/blob/master/resources/terraform/do/README.md Copy the sample Terraform variables file to a new file named terraform.tfvars. You will then modify this file to customize your deployment. ```bash cp terraform.tfvars.sample terraform.tfvars ``` -------------------------------- ### Get Specific Number Enrichment Rule by ID Source: https://context7.com/dopensource/dsiprouter/llms.txt Retrieves a single DNID enrichment rule based on its unique rule ID. The ID is appended to the endpoint path. ```bash curl -k -H "Authorization: Bearer $DSIP_TOKEN" \ -X GET "https://$DSIP_HOSTNAME:5000/api/v1/numberenrichment/1" ``` -------------------------------- ### Configure Nginx Proxy for FusionPBX Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/resources.md Add this stanza to the dsiprouter.nginx.tpl file to enable proxying the FusionPBX UI through dSIPRouter. ```default location / { proxy_pass https://fusionpbx; proxy_redirect off; proxy_next_upstream error timeout http_404 http_403 http_500 http_502 http_503 http_504 non_idempotent; } ``` -------------------------------- ### Get Inbound Mapping by Rule ID Source: https://context7.com/dopensource/dsiprouter/llms.txt Retrieves a specific inbound DID routing rule using its unique rule ID. Ensure the ruleid parameter is correctly set. ```bash curl -k -H "Authorization: Bearer $DSIP_TOKEN" \ -X GET "https://$DSIP_HOSTNAME:5000/api/v1/inboundmapping?ruleid=1" ``` -------------------------------- ### Compare Configuration Changes Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/dev/external_links/CONTRIBUTING.md Identifies differences between the generated configuration files and the project source files to ensure only necessary changes are committed. ```bash diff /etc/dsiprouter/gui/settings.py /opt/dsiprouter/gui/settings.py ``` -------------------------------- ### Load dsiprouter Module in Kamailio Source: https://github.com/dopensource/dsiprouter/blob/master/kamailio/modules/dsiprouter/README.md Loads the dsiprouter module by adding the 'loadmodule' directive to your Kamailio configuration file (/etc/kamailio/kamailio.cfg). ```kamailio loadmodule "dsiprouter.so" ``` -------------------------------- ### Upgrade dSIPRouter to 0.76 via CLI Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/upgrading.md Use this command to perform an auto-upgrade to version 0.76 via the command line interface. ```bash dsiprouter upgrade -rel 0.76 ``` -------------------------------- ### Reload Kamailio Configuration Source: https://context7.com/dopensource/dsiprouter/llms.txt Apply routing table and permission changes without interrupting active services. ```bash curl -k -H "Authorization: Bearer $DSIP_TOKEN" \ -X POST "https://$DSIP_HOSTNAME:5000/api/v1/reload/kamailio" # Response: { "error": "", "msg": "Kamailio reload succeeded", "kamreload": false } ``` -------------------------------- ### Upload SSL Certificate for Domain Source: https://context7.com/dopensource/dsiprouter/llms.txt Uploads a new SSL certificate and its private key for a specific domain. Requires multipart/form-data with 'cert' and 'key' fields. ```bash curl -k -H "Authorization: Bearer $DSIP_TOKEN" \ -F "cert=@/path/to/cert.pem" \ -F "key=@/path/to/key.pem" \ -X POST "https://$DSIP_HOSTNAME:5000/api/v1/certificates/upload/sbc.example.com" ``` -------------------------------- ### Edit RTPEngine Syslog Configuration Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/troubleshooting.md Use 'vi' to edit the rtpengine syslog configuration file. Ensure the line for local1 is uncommented to enable logging. ```bash vi /etc/rsyslog.d/rtpengine.conf ``` -------------------------------- ### Copy Compiled Module to Deployment Location Source: https://github.com/dopensource/dsiprouter/blob/master/kamailio/modules/dsiprouter/README.md Copies the compiled dsiprouter module (.so file) to the Kamailio module path. The module path is determined by parsing the kamailio.cfg file. ```bash MPATH=$(grep mpath /etc/kamailio/kamailio.cfg | awk 'NR==2' | awk '{print $3}') cp /tmp/kamailio/src/modules/dsiprouter/*.so $MPATH ``` -------------------------------- ### Upgrade dSIPRouter to 0.77 via CLI Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/upgrading.md Use this command to perform an auto-upgrade to version 0.77 via the command line interface. ```bash dsiprouter upgrade -rel 0.77 ``` -------------------------------- ### dSIPRouter Database Models with SQLAlchemy Source: https://context7.com/dopensource/dsiprouter/llms.txt Defines core database models using SQLAlchemy ORM for Kamailio integration. Includes models for gateways, subscribers, gateway groups, call settings, inbound mappings, domains, and dispatcher entries. ```python from database import ( startSession, Gateways, GatewayGroups, Address, InboundMapping, OutboundRoutes, Subscribers, Domain, DomainAttrs, Dispatcher, dSIPCallSettings, dSIPNotification, dSIPLeases, dSIPCertificates, UAC ) # Start a database session db = startSession() # Create a new gateway (SIP endpoint) gateway = Gateways( name="PBX-Primary", address="192.168.1.100:5060", strip=0, prefix="", type=8, # FLT_PBX gwgroup=1, signalling="proxy", media="proxy" ) db.add(gateway) db.flush() # Create a subscriber for username/password auth subscriber = Subscribers( username="pbx-trunk-user", password="SecurePassword123", domain="sip.example.com", gwid=gateway.gwid, email_address="admin@example.com" ) db.add(subscriber) # Create a gateway group (endpoint group) gwgroup = GatewayGroups( name="PBX-Cluster", gwlist=[gateway.gwid], type=8 # FLT_PBX ) db.add(gwgroup) # Create call settings for the group call_settings = dSIPCallSettings( gwgroupid=gwgroup.id, limit=100, timeout=300 ) db.add(call_settings) # Create inbound DID mapping inbound_rule = InboundMapping( groupid=9, # FLT_INBOUND prefix="18005551234", gwlist=str(gateway.gwid), description="name:Main Number" ) db.add(inbound_rule) # Create a domain for multi-tenant hosting domain = Domain( domain="tenant1.example.com", did="tenant1.example.com" ) db.add(domain) # Create dispatcher entry for load balancing dispatcher = Dispatcher( setid=gwgroup.id, destination="sip:192.168.1.100:5060", flags=8, # KEEP_ALIVE priority=0, rweight=100, signalling="proxy", media="proxy", name="PBX-Primary", gwid=gateway.gwid ) db.add(dispatcher) # Commit all changes db.commit() db.close() ``` -------------------------------- ### Backup and Restore API Source: https://context7.com/dopensource/dsiprouter/llms.txt Provides endpoints for creating backups of dSIPRouter configuration and restoring from backup files. ```APIDOC ## Backup and Restore ### Description Creates backups of dSIPRouter configuration and restores from backup files. ### Method GET (Backup), POST (Restore) ### Endpoint - Backup: /api/v1/backupandrestore/backup - Restore: /api/v1/backupandrestore/restore ### Parameters #### Request Body (Restore) - **file** (file) - Required - The backup file to restore from. ### Request Example (Backup) ```bash curl -k -H "Authorization: Bearer $DSIP_TOKEN" \ -X GET "https://$DSIP_HOSTNAME:5000/api/v1/backupandrestore/backup" \ --output backup.tar.gz ``` ### Request Example (Restore) ```bash curl -k -H "Authorization: Bearer $DSIP_TOKEN" \ -F "file=@backup.tar.gz" \ -X POST "https://$DSIP_HOSTNAME:5000/api/v1/backupandrestore/restore" ``` ### Response #### Success Response (200) - **msg** (string) - A message indicating the status of the operation (e.g., 'Restore completed successfully'). #### Response Example (Restore) ```json { "error": "", "msg": "Restore completed successfully" } ``` ``` -------------------------------- ### Retrieve Kamailio Statistics Source: https://context7.com/dopensource/dsiprouter/llms.txt Fetch real-time transaction manager statistics from the Kamailio proxy. ```bash curl -k -H "Authorization: Bearer $DSIP_TOKEN" \ -X GET "https://$DSIP_HOSTNAME:5000/api/v1/kamailio/stats" # Response: { "error": "", "msg": "Successfully retrieved kamailio stats", "kamreload": false, "data": [{ "current": 0, "waiting": 0, "total": 1234, "total_local": 567, "rpl_received": 890, "rpl_generated": 123, "rpl_sent": 456 }] } ``` -------------------------------- ### Upgrade dSIPRouter to 0.75 via CLI Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/upgrading.md Use this command for an auto-upgrade to version 0.75 when upgrading from version 0.73 or 0.74. ```bash dsiprouter upgrade ``` -------------------------------- ### List Endpoint Groups Source: https://context7.com/dopensource/dsiprouter/llms.txt Retrieve all configured PBX endpoint groups and their gateways. ```bash curl -k -H "Authorization: Bearer $DSIP_TOKEN" \ -X GET "https://$DSIP_HOSTNAME:5000/api/v1/endpointgroups" ``` -------------------------------- ### Create Endpoint Group Source: https://context7.com/dopensource/dsiprouter/llms.txt Creates a new PBX endpoint group with authentication, call settings, and endpoints. ```bash curl -k -H "Authorization: Bearer $DSIP_TOKEN" \ -H "Content-Type: application/json" \ -X POST "https://$DSIP_HOSTNAME:5000/api/v1/endpointgroups" \ -d '{ "name": "NewPBXCluster", "call_settings": { "limit": 50, "timeout": 300 }, "auth": { "type": "userpwd", "user": "pbx-trunk", "pass": "SecurePassword123", "domain": "pbx.example.com" }, "endpoints": [ { "host": "10.0.0.100", "port": 5060, "signalling": "proxy", "media": "proxy", "description": "PBX-Node-1", "rweight": 100, "keepalive": 1 } ], "strip": 0, "prefix": "", "notifications": { "overmaxcalllimit": "admin@example.com", "endpointfailure": "admin@example.com" } }' ``` -------------------------------- ### Upgrade dSIPRouter to 0.78 via CLI Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/upgrading.md Use this command to perform an auto-upgrade to version 0.78 via the command line interface. ```bash dsiprouter upgrade -rel 0.78 ``` -------------------------------- ### Testing the new API endpoint Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/dev/external_links/CONTRIBUTING.md Use curl to verify the new API endpoint by providing the required authorization token and host information. ```bash export DSIP_TOKEN= export DSIP_HOST= curl --insecure -H "Authorization: Bearer $DSIP_TOKEN" -X GET https://$DSIP_HOST:5000/api/v1/new_api/new_entity ``` -------------------------------- ### Registering the API blueprint Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/dev/external_links/CONTRIBUTING.md Register the new API blueprint within the main application file. ```python app.register_blueprint(new_api) ``` -------------------------------- ### Execute Single Unit Test Source: https://github.com/dopensource/dsiprouter/blob/master/testing/README.md Run a specific unit test by its number. Replace '1.sh' with the desired test file name. ```bash make run UNIT=1.sh ``` -------------------------------- ### Restore Kamailio Database Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/upgrade_0.50_to_0.51.md Restore the database from the backup file created previously. ```bash cd /opt/ mysql kamailio < kamailio-bk.sql ``` -------------------------------- ### Edit dSIPRouter Syslog Configuration Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/troubleshooting.md Use 'vi' to edit the dSIPRouter syslog configuration file. Ensure the line for local2 is uncommented to enable logging. ```bash vi /etc/rsyslog.d/dsiprouter.conf ``` -------------------------------- ### Edit Kamailio Syslog Configuration Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/troubleshooting.md Use 'vi' to edit the Kamailio syslog configuration file. Ensure the line for local0 is uncommented to enable logging. ```bash vi /etc/rsyslog.d/kamailio.conf ``` -------------------------------- ### List All Inbound Mappings Source: https://context7.com/dopensource/dsiprouter/llms.txt Retrieves all configured inbound DID routing rules. No specific parameters are needed for listing all rules. ```bash curl -k -H "Authorization: Bearer $DSIP_TOKEN" \ -X GET "https://$DSIP_HOSTNAME:5000/api/v1/inboundmapping" ``` -------------------------------- ### Generate Self-Signed STIR/SHAKEN Certificate Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/use-cases.md Run this script via SSH to generate a self-signed certificate for testing purposes. ```bash /opt/dsiprouter/resources/stir_shaken/generate_self_signed_cert.sh ``` -------------------------------- ### Backup and Restore dSIPRouter Configuration API Source: https://context7.com/dopensource/dsiprouter/llms.txt API endpoints for creating backups of dSIPRouter configuration and restoring from existing backup files. The backup endpoint outputs a tar.gz file, while the restore endpoint accepts a file upload. ```bash # Create backup curl -k -H "Authorization: Bearer $DSIP_TOKEN" \ -X GET "https://$DSIP_HOSTNAME:5000/api/v1/backupandrestore/backup" \ --output backup.tar.gz ``` ```bash # Restore from backup curl -k -H "Authorization: Bearer $DSIP_TOKEN" \ -F "file=@backup.tar.gz" \ -X POST "https://$DSIP_HOSTNAME:5000/api/v1/backupandrestore/restore" ``` ```json { "error": "", "msg": "Restore completed successfully" } ``` -------------------------------- ### Create a New Endpoint Lease via curl Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/api.md This command creates a new endpoint lease with a specified Time-To-Live (TTL) and email address. It requires the Authorization header and Content-Type. ```bash curl -k -H "Authorization: Bearer $DSIP_TOKEN" -H "Content-Type: application/json" -X GET "https://$DSIP_HOSTNAME:5000/api/v1/endpoint/lease?ttl=15&email=mack@dsiprouter.org" ``` -------------------------------- ### Uninstall DSIPRouter with All Options Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/command_line_options.md This command uninstalls dSIPRouter and all related services. Use the '-all' flag to ensure a complete removal. ```bash dsiprouter uninstall -all ``` -------------------------------- ### Importing a new API module Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/dev/external_links/CONTRIBUTING.md Add this import statement to the imports section of gui/dsiprouter.py. ```python from modules.api.new_api.routes import new_api ``` -------------------------------- ### Database Models Source: https://context7.com/dopensource/dsiprouter/llms.txt Core database models used by dSIPRouter with SQLAlchemy ORM for Kamailio integration. ```APIDOC ## Database Models (SQLAlchemy) ### Description Core database models used by dSIPRouter with SQLAlchemy ORM for Kamailio integration. ### Usage These models can be used to interact with the dSIPRouter database for managing gateways, subscribers, domains, and more. ### Example (Python) ```python from database import ( startSession, Gateways, GatewayGroups, Address, InboundMapping, OutboundRoutes, Subscribers, Domain, DomainAttrs, Dispatcher, dSIPCallSettings, dSIPNotification, dSIPLeases, dSIPCertificates, UAC ) # Start a database session db = startSession() # Create a new gateway (SIP endpoint) gateway = Gateways( name="PBX-Primary", address="192.168.1.100:5060", strip=0, prefix="", type=8, # FLT_PBX gwgroup=1, signalling="proxy", media="proxy" ) db.add(gateway) db.flush() # Create a subscriber for username/password auth subscriber = Subscribers( username="pbx-trunk-user", password="SecurePassword123", domain="sip.example.com", gwid=gateway.gwid, email_address="admin@example.com" ) db.add(subscriber) # Create a gateway group (endpoint group) gwgroup = GatewayGroups( name="PBX-Cluster", gwlist=[gateway.gwid], type=8 # FLT_PBX ) db.add(gwgroup) # Create call settings for the group call_settings = dSIPCallSettings( gwgroupid=gwgroup.id, limit=100, timeout=300 ) db.add(call_settings) # Create inbound DID mapping inbound_rule = InboundMapping( groupid=9, # FLT_INBOUND prefix="18005551234", gwlist=str(gateway.gwid), description="name:Main Number" ) db.add(inbound_rule) # Create a domain for multi-tenant hosting domain = Domain( domain="tenant1.example.com", did="tenant1.example.com" ) db.add(domain) # Create dispatcher entry for load balancing dispatcher = Dispatcher( setid=gwgroup.id, destination="sip:192.168.1.100:5060", flags=8, # KEEP_ALIVE priority=0, rweight=100, signalling="proxy", media="proxy", name="PBX-Primary", gwid=gateway.gwid ) db.add(dispatcher) # Commit all changes db.commit() db.close() ``` ``` -------------------------------- ### Add Additional Teams User Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/use-cases.md Commands to provision an additional user with voice routing and DID settings. ```powershell # Get Credentials, if using MFA/2FA just run Connect-MicrosoftTeams $userCredential = Get-Credential Connect-MicrosoftTeams -Credential $userCredential # Apply and the US Only Voice Routing Policy to the user Grant-CsOnlineVoiceRoutingPolicy -Identity “user@example.com“ -PolicyName "US Only" # Define a outgoing phone number (aka DID) and set Enterprise Voice and Voicemail Set-CsUser -Identity "user@example.com" -OnPremLineURI tel:+13137175555 -EnterpriseVoiceEnabled $true -HostedVoiceMail $true ``` -------------------------------- ### List All SSL Certificates Source: https://context7.com/dopensource/dsiprouter/llms.txt Retrieves a list of all managed SSL certificates. This is useful for auditing and managing certificate inventory. ```bash curl -k -H "Authorization: Bearer $DSIP_TOKEN" \ -X GET "https://$DSIP_HOSTNAME:5000/api/v1/certificates" ``` -------------------------------- ### Enable WebSockets via JSON-RPC Source: https://context7.com/dopensource/dsiprouter/llms.txt Enables WebSocket support for WebRTC gateway functionality. ```python sendJsonRpcCmd('127.0.0.1', 'ws.enable') ``` -------------------------------- ### DSIPRouter API Overview Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/routes/summary.rst This section provides a summary of the available API routes for the DSIPRouter application. ```APIDOC ## API Overview ### Description The DSIPRouter API provides programmatic access to manage SIP routing configurations and system settings. The routes are dynamically generated from the Flask application instance. ### Accessing Details For specific endpoint parameters, request bodies, and response schemas, please refer to the individual endpoint documentation pages linked within the application's internal routing table. ``` -------------------------------- ### Update Runtime Configuration via JSON-RPC Source: https://context7.com/dopensource/dsiprouter/llms.txt Updates the server role configuration. Requires a running dSIPRouter instance at the specified address. ```python sendJsonRpcCmd('127.0.0.1', 'cfg.sets', ['server', 'role', 'proxy']) ``` -------------------------------- ### POST /api/v1/endpointgroups Source: https://context7.com/dopensource/dsiprouter/llms.txt Creates a new PBX endpoint group with authentication, call settings, and endpoints. ```APIDOC ## POST /api/v1/endpointgroups ### Description Creates a new PBX endpoint group with authentication, call settings, and endpoints. ### Method POST ### Endpoint /api/v1/endpointgroups ### Request Body - **name** (string) - Required - Name of the group. - **call_settings** (object) - Required - Call limit and timeout settings. - **auth** (object) - Required - Authentication configuration. - **endpoints** (array) - Required - List of endpoints to add. ### Response #### Success Response (200) - **gwgroupid** (integer) - The ID of the created group. - **kamreload** (boolean) - Indicates if Kamailio reload is required. #### Response Example { "error": "", "msg": "Endpoint group created", "kamreload": true, "data": [{ "gwgroupid": 5, "endpoints": [10] }] } ``` -------------------------------- ### Default STIR/SHAKEN Key Path Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/use-cases.md The default file system path for the STIR/SHAKEN private key. ```text /etc/dsiprouter/certs/stirshaken/sp-key.pem ``` -------------------------------- ### FusionPBX Sync Functions Module Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/dev/modules.rst This section covers the functions for synchronizing data with FusionPBX. ```APIDOC ## FusionPBX Sync Functions ### Description Contains functions responsible for synchronizing data between the DSIP Router and FusionPBX. ### Method (Specific methods depend on the synchronization implementation) ### Endpoint (Specific endpoints depend on the synchronization implementation) ### Parameters (No specific parameters are detailed in the provided text.) ### Request Example (No request examples are provided in the source text.) ### Response (No specific response details are provided in the source text.) ``` -------------------------------- ### Configure Voice Routing Policies Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/use-cases.md Commands to define PSTN usage, voice routes, and apply routing policies to users. ```powershell Set-CsOnlinePstnUsage -Identity Global -Usage @{Add="US and Canada"} Set-CsOnlineVoiceRoute -Identity "LocalRoute" -NumberPattern ".*" -OnlinePstnGatewayList sbc.example.com New-CsOnlineVoiceRoutingPolicy "US Only" -OnlinePstnUsages "US and Canada" # This is suppose to stop MSTeams from using the Microsoft Dialing Plan and using the routing policies that was defined above Set-CsTenantHybridConfiguration -UseOnPremDialPlan $False # Apply and the US Only Voice Routing Policy to the user Grant-CsOnlineVoiceRoutingPolicy -Identity “user@example.com“ -PolicyName "US Only" # If it doesn’t return a value of US Only, then wait 15 minutes and try it again. It sometime takes a while for the policy to be ready. Get-CsOnlineUser “user@example.com" | select OnlineVoiceRoutingPolicy # Define a outgoing phone number (aka DID) and set Enterprise Voice and Voicemail Set-CsUser -Identity "user@example.com" -OnPremLineURI tel:+13137175555 -EnterpriseVoiceEnabled $true -HostedVoiceMail $true ``` -------------------------------- ### Uninstall dsiprouter v0.50 Source: https://github.com/dopensource/dsiprouter/blob/master/docs/source/user/upgrade_0.50_to_0.51.md Remove the existing version of dsiprouter from the system. ```bash cd /opt/dsiprouter ./dsiprouter.sh uninstall ``` -------------------------------- ### POST /api/v1/reload/kamailio Source: https://context7.com/dopensource/dsiprouter/llms.txt Reloads all Kamailio routing tables, permissions, and settings without service interruption. ```APIDOC ## POST /api/v1/reload/kamailio ### Description Reloads all Kamailio routing tables, permissions, and settings without service interruption. ### Method POST ### Endpoint /api/v1/reload/kamailio ### Response #### Success Response (200) - **error** (string) - Error message if any - **msg** (string) - Status message - **kamreload** (boolean) - Indicates if a reload is pending #### Response Example { "error": "", "msg": "Kamailio reload succeeded", "kamreload": false } ```