### Install ffmpeg and ffmpeg-devel Source: https://github.com/sipwise/rtpengine/wiki/Install-RTPEngine-on-Centos-7 Installs the ffmpeg multimedia framework and its development headers after enabling the Nux desktop repository. ```bash yum -y install ffmpeg ffmpeg-devel ``` -------------------------------- ### Compile and Install RTPengine Daemon Source: https://github.com/sipwise/rtpengine/wiki/Install-RTPEngine-on-Centos-7 Compiles the RTPengine daemon from source and installs the executable to /usr/sbin/rtpengine. ```bash cd /usr/local/src/rtpengine/daemon/ make cp rtpengine /usr/sbin/rtpengine ``` -------------------------------- ### RTPengine New Configuration-File Based Syntax Example Source: https://github.com/sipwise/rtpengine/blob/master/docs/rtpengine.md A comprehensive example demonstrating the new configuration-file based syntax for defining multiple interfaces, aliases, port ranges, and round-robin usage. ```none [rtpengine] interfaces-config = interface # Create an interface "default" and pick up any non-local addresses # that are bound to the system at startup. [interface-default] address = any # Create an interface "external" and pick up any addresses bound # to the physical interface "enp63s0". [interface-external] address = enp63s0 # Create an interface "internal" with an explicitly set address, # and also set the advertised address. [interface-internal] address = 192.168.67.43 advertised = 203.0.113.7 # Create an interface "ICE" and add all addresses bound to the # physical interface "enp63s0". Use a mismatched but unique name for # the interface section so more addresses can be added to this # interface. [interface-ICE-1] name = ICE address = enp63s0 # Add addresses from interface "enp35s0" to the interface "ICE" # and use a different port range. [interface-ICE-2] name = ICE address = enp35s0 port-min = 10000 port-max = 59999 exclude-ports = 20000; 20001; 20002 # Create an alias interface "virt" pointing to "external". [interface-virt] alias = external # Create two interfaces that will be used in a round-robin way # by referring to the interface "rr". [interface-rr:0] address = enp5p0 exclude-ports = 29999 [interface-rr:1] address = enp15p0 ``` -------------------------------- ### MoH Configuration Example with File Source Source: https://github.com/sipwise/rtpengine/blob/master/docs/ng_control_protocol.md An example showing how to configure Music on Hold (MoH) using a local file path as the sound source. The mode defaults to 'sendonly' if not specified. ```none "moh" : { "file": "/tmp/music-on-hold.wav" } ``` -------------------------------- ### Example RTPengine Offer Command Source: https://github.com/sipwise/rtpengine/blob/master/docs/rtpengine.md This is an example of a raw RTPengine offer command with various flags and options. It is used to demonstrate the complexity that signalling templates aim to simplify. ```none rtpengine_offer("transport-protocol=UDP/TLS/RTP/SAVPF ICE=force trickle-ICE rtcp-mux=[offer require] no-rtcp-attribute SDES=off generate-mid"); ``` -------------------------------- ### Run multiple rtpengine instances Source: https://github.com/sipwise/rtpengine/blob/master/docs/usage.md Command-line examples for running multiple rtpengine instances on different interfaces and ports. ```bash /usr/bin/rtpengine --config-file=none --table=0 --interface=10.64.73.31 \ --listen-ng=127.0.0.1:2223 --tos=184 --pidfile=/run/rtpengine-10.pid --no-fallback /usr/bin/rtpengine --config-file=none --table=1 --interface=192.168.65.73 \ --listen-ng=127.0.0.1:2224 --tos=184 --pidfile=/run/rtpengine-192.pid --no-fallback ``` -------------------------------- ### RTPengine Offer Request Example Source: https://github.com/sipwise/rtpengine/blob/master/docs/ng_control_protocol.md An example of a complete RTPengine 'offer' request dictionary, showing various parameters including command, call-id, SDP body, flags, and media-specific settings. ```json { "command": "offer", "call-id": "cfBXzDSZqhYNcXM", "from-tag": "mS9rSAn0Cr", "sdp": "v=0\r\no=...", "via-branch": "5KiTRPZHH1nL6", "flags": [ "trust address" ], "replace": [ "origin" ], "address family": "IP6", "received-from": [ "IP4", "10.65.31.43" ], "ICE": "force", "transport protocol": "RTP/SAVPF", "media address": "2001:d8::6f24:65b", "DTLS": "passive" } ``` -------------------------------- ### MoH Configuration Example with DB ID Source: https://github.com/sipwise/rtpengine/blob/master/docs/ng_control_protocol.md An example demonstrating how to configure Music on Hold (MoH) using a database ID as the sound source, 'sendrecv' mode, and 'zero' connection type. ```none "moh" : { "db-id": "123456789", "mode": "sendrecv", "connection": "zero" } ``` -------------------------------- ### Launch rtpengine with Valgrind Source: https://github.com/sipwise/rtpengine/blob/master/docs/troubleshooting.md Start the rtpengine daemon under Valgrind with Glib memory tracking enabled. ```default LD_PRELOAD=../t/tests-preload.so G_SLICE=always-malloc valgrind --leak-check=full ./rtpengine --config-file=none -t -1 -i 203.0.113.1 -i 2001:db8:4321::1 -n 2223 -c 12345 -f -L 7 -E -u 2222 --silence-detect=1 ``` -------------------------------- ### Inject Start Message Example Source: https://github.com/sipwise/rtpengine/blob/master/docs/ng_control_protocol.md This JSON object demonstrates the structure of an 'inject start' message. It is used to initiate one-way media injection from a source participant to a destination participant. Include 'source-call-id' if the source is in a different call. ```default { "command": "inject start", "call-id": "main-call-id", "to-tag": "dst-tag", "source-call-id": "src-call-id", "source-tag": "src-tag" } ``` -------------------------------- ### Install MariaDB Development Packages Source: https://github.com/sipwise/rtpengine/wiki/Install-RTPEngine-on-Centos-7 Installs the necessary packages for MariaDB version 10 or higher, required for RTPengine's database integration. ```bash yum install mariadb-devel mariadb-client mariadb-shared ``` -------------------------------- ### RTPengine Response Example Source: https://github.com/sipwise/rtpengine/blob/master/docs/ng_control_protocol.md An example of a response message from RTPengine, containing the result status and the re-written SDP body. ```json { "result": "ok", "sdp": "v=0\r\no=..." } ``` -------------------------------- ### Typical RTPengine Command Line Source: https://github.com/sipwise/rtpengine/blob/master/docs/rtpengine.md This example shows a common rtpengine command line configuration, enabling both UDP and NG protocols. It specifies the table, interfaces, listening addresses, TOS value, and PID file location. ```none rtpengine --table=0 --interface=10.64.73.31 --interface=2001:db8::4f3:3d \ --listen-udp=127.0.0.1:22222 --listen-ng=127.0.0.1:2223 --tos=184 \ --pidfile=/run/rtpengine.pid ``` -------------------------------- ### Codec String Options Example Source: https://github.com/sipwise/rtpengine/blob/master/docs/ng_control_protocol.md Demonstrates how to append additional options like ptime, fmtp, and codec-specific parameters to a codec string. For Opus, this allows setting ffmpeg-compatible options. ```none iLBC/8000/1///mode=30 ``` ```none opus/48000/2////compression_level=2 ``` ```none iLBC/8000/1///mode--30 ``` -------------------------------- ### Manage rtpengine modules and daemon Source: https://github.com/sipwise/rtpengine/blob/master/docs/usage.md Common commands for loading kernel modules, managing nftables rules, and starting the rtpengine daemon. ```bash # Load module: this only needs to be done once after system # (re-) boot, but can be omitted if auto-load is working correctly modprobe nft_rtpengine # Load module with some options set # (usually handled via /etc/modprobe.d/rtpengine.conf) modprobe nft_rtpengine proc_uid=1234 proc_gid=5678 # Create nftables rules: This normally happens automatically during # startup. Kernel table ID and nftables chain names are taken from # the config file rtpengine --nftables-start # Create nftables rules overriding the default chain names, or the # names from the config file rtpengine --nftables-start --table=42 --nftables-chain=foobar --nftables-base-chain= # Delete a leftover table. Might be needed if the kernel module # can't be unloaded (see /proc/rtpengine/list) echo 'del 0' > /proc/rtpengine/control # Start daemon: this creates the nftables rules for table 0 /usr/bin/rtpengine --table=0 --interface=10.64.73.31 --interface=2001:db8::4f3:3d \ --listen-ng=127.0.0.1:2223 --tos=184 --pidfile=/run/rtpengine.pid --no-fallback # Start daemon without implicitly creating any nftables rules (empty chain name) /usr/bin/rtpengine --table=0 --interface=10.64.73.31 --interface=2001:db8::4f3:3d \ --listen-ng=127.0.0.1:2223 --tos=184 --pidfile=/run/rtpengine.pid --no-fallback \ --nftables-chain= ``` -------------------------------- ### Install RTPengine Dependencies on CentOS 7 Source: https://github.com/sipwise/rtpengine/wiki/Install-RTPEngine-on-Centos-7 Installs essential development packages and libraries required for compiling RTPengine. Ensure your kernel-devel package matches your running kernel version. ```bash yum install iptables-devel kernel-devel kernel-headers xmlrpc-c-devel ``` ```bash yum install "kernel-devel-uname-r == $(uname -r)" ``` ```bash yum install glib glib-devel gcc zlib zlib-devel openssl openssl-devel pcre pcre-devel libcurl libcurl-devel xmlrpc-c xmlrpc-c-devel ``` ```bash yum install libevent-devel glib2-devel json-glib-devel gperf libpcap-devel git hiredis hiredis-devel redis perl-IPC-Cmd ``` -------------------------------- ### Configure Nux Desktop Repository for ffmpeg Source: https://github.com/sipwise/rtpengine/wiki/Install-RTPEngine-on-Centos-7 Imports the GPG key and installs the Nux.ro repository configuration for accessing ffmpeg packages. ```bash rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro ``` ```bash rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm ``` -------------------------------- ### RTP Engine Flags Example Source: https://github.com/sipwise/rtpengine/blob/master/docs/ng_control_protocol.md Demonstrates the format for passing optional flags to rtpengine using a bencode string. This allows for specific behaviors for SDP offer/answer exchanges. ```none { "rtpp_flags": "replace-origin via-branch=auto-next strict-source label=callee OSRTP-accept transport-protocol=RTP/AVP address-family=IP4" } ``` -------------------------------- ### Metadata File Format Example Source: https://github.com/sipwise/rtpengine/blob/master/docs/rtpengine.md Illustrates the format of metadata files generated for call recordings, including SDP details, timestamps, and generic metadata. ```none /path/to/recording-pcap.pcap SDP mode: offer SDP before RTP packet: 1 first SDP SDP mode: answer SDP before RTP packet: 1 second SDP ... SDP mode: answer SDP before RTP packet: 100 n-th and final SDP start timestamp (YYYY-MM-DDThh:mm:ss) end timestamp (YYYY-MM-DDThh:mm:ss) generic metadata ``` -------------------------------- ### Configure nftables for rtpengine Source: https://github.com/sipwise/rtpengine/blob/master/docs/usage.md Example nftables configuration for the rtpengine filter chain. ```nftables table ip filter { chain INPUT { type filter hook input priority filter; policy accept; ip protocol udp counter packets 1 bytes 201 jump rtpengine } chain rtpengine { XT target RTPENGINE not found counter packets 1 bytes 201 } } ``` -------------------------------- ### Using a Signalling Template in Kamailio/OpenSIPS Source: https://github.com/sipwise/rtpengine/blob/master/docs/rtpengine.md This example shows how to use a previously defined signalling template ('WebRTC') in a Kamailio or OpenSIPS script. By specifying 'template=WebRTC', the complex string of flags is replaced by a simple reference. ```none rtpengine_offer("template=WebRTC"); ``` -------------------------------- ### RTPengine Configuration for rtpengine3 Source: https://github.com/sipwise/rtpengine/wiki/Redis-keyspace-notifications Configure the network interface, Redis connection, and keyspace subscription for the third rtpengine instance, with unique Redis DB and keyspace subscriptions for a complete redundant setup. ```ini interface=pub3/10.255.255.103;pub1/10.255.255.101;pub2/10.255.255.102 redis=10.255.1.200:6379/3 subscribe-keyspace=1;2 ``` -------------------------------- ### Install RTPengine Kernel Module Source: https://github.com/sipwise/rtpengine/wiki/Install-RTPEngine-on-Centos-7 Copies the compiled xt_RTPENGINE kernel module to the appropriate directory for the running kernel and updates module dependencies. ```bash cp xt_RTPENGINE.ko /lib/modules/3.10.0-957.5.1.el7.x86_64/extra/xt_RTPENGINE.ko depmod -a ``` -------------------------------- ### Enable EPEL Repository Source: https://github.com/sipwise/rtpengine/wiki/Install-RTPEngine-on-Centos-7 Installs the Extra Packages for Enterprise Linux (EPEL) repository, which provides additional software for CentOS. ```bash yum install epel-release ``` -------------------------------- ### Example query response Source: https://github.com/sipwise/rtpengine/blob/master/docs/ng_control_protocol.md A sample response structure for the 'query' command, illustrating the detailed information available for a call, including totals, last signal time, and tag-specific media stream details. ```json { "totals": { "RTCP": { "bytes": 2244, "errors": 0, "packets": 22 }, "RTP": { "bytes": 100287, "errors": 0, "packets": 705 } }, "last_signal": 1402064116, "tags": { "cs6kn1rloc": { "created": 1402064111, "medias": [ { "flags": [ "initialized" ], "streams": [ { "endpoint": { "port": 57370, "address": "10.xx.xx.xx", "family": "IPv4" }, "flags": [ "RTP", "filled", "confirmed", "kernelized" ], ``` -------------------------------- ### Connect Multiple Source Subscriptions Directionally Source: https://github.com/sipwise/rtpengine/blob/master/docs/ng_control_protocol.md This example demonstrates using the 'from-tags' array to create multiple new subscriptions from different source parties to a single destination party in directional mode. ```default { "command": "connect", "call-id": "main-call-id", "from-tags": ["tag1", "tag2", "tag3"], "to-tag": "callee-tag", "directional": "true" } ``` -------------------------------- ### RTPengine Transcode Configuration Example Source: https://github.com/sipwise/rtpengine/blob/master/docs/rtpengine.md Defines two transcoding configurations: one with a higher preference for PCMA to PCMU, and another with a lower preference for G723 to GSM. These are used to influence codec selection when transcoding is necessary. ```none transcode-config = tc [tc-PCMA-PCMU-higher] source = PCMA destination = PCMU preference = 5 [tc-GSM-G723-lower] source = G723 destination = GSM preference = -5 ``` -------------------------------- ### Stop One-Way Media Injection Source: https://github.com/sipwise/rtpengine/blob/master/docs/ng_control_protocol.md Use this command to stop one-way media injection that was previously started with 'inject start'. Ensure you provide the same participant selection keys as used for starting the injection. ```default { "command": "inject stop", "call-id": "main-call-id", "to-tag": "dst-tag", "source-call-id": "src-call-id", "source-tag": "src-tag" } ``` -------------------------------- ### Run Rtpengine with ASAN Source: https://github.com/sipwise/rtpengine/blob/master/docs/troubleshooting.md Execute the binary with the required preload library and configuration flags. ```bash LD_PRELOAD=../t/tests-preload.so ./rtpengine --config-file=none -t -1 -i 203.0.113.1 -i 2001:db8:4321::1 -n 2223 -c 12345 -f -L 7 -E -u 2222 --silence-detect=1 ``` -------------------------------- ### Install Spandsp Development Packages Source: https://github.com/sipwise/rtpengine/wiki/Install-RTPEngine-on-Centos-7 Installs the Spandsp library development files, which may be a dependency for certain RTPengine features. ```bash yum install spandsp-devel spandsp ``` -------------------------------- ### inject stop Source: https://github.com/sipwise/rtpengine/blob/master/docs/ng_control_protocol.md Stops one-way media injection previously started by `inject start`. Requires call-id, to-tag, and source-tag, with optional source-call-id. ```APIDOC ## inject stop ### Description Stops one-way media injection previously started by `inject start`. ### Parameters #### Path Parameters - **call-id** (string) - Required - The ID of the call. - **to-tag** (string) - Required - The TO tag of the call party. - **source-tag** (string) - Required - The source tag of the call party. - **source-call-id** (string) - Optional - The source call ID. ### Request Example ```json { "command": "inject stop", "call-id": "main-call-id", "to-tag": "dst-tag", "source-call-id": "src-call-id", "source-tag": "src-tag" } ``` ``` -------------------------------- ### Compile rtpengine binary Source: https://github.com/sipwise/rtpengine/blob/master/docs/troubleshooting.md Build the rtpengine binary in the daemon folder. ```default make ``` -------------------------------- ### Configure Module Loading at Boot Source: https://github.com/sipwise/rtpengine/wiki/Install-RTPEngine-on-Centos-7 Configures the system to automatically load the xt_RTPENGINE module when the system boots by adding it to the modules-load configuration file. ```bash vi /etc/modules-load.d/rtpengine.conf # load xt_RTPENGINE module xt_RTPENGINE_ ``` -------------------------------- ### RTPengine Configuration for rtpengine1 Source: https://github.com/sipwise/rtpengine/wiki/Redis-keyspace-notifications Configure the network interface, Redis connection, and keyspace subscription for the first rtpengine instance. ```ini interface=pub1/10.255.255.101;pub2/10.255.255.102;pub3/10.255.255.103 redis=10.255.1.200:6379/1 subscribe-keyspace=2;3 ``` -------------------------------- ### Valgrind output report Source: https://github.com/sipwise/rtpengine/blob/master/docs/troubleshooting.md Example of the heap and leak summary output generated by Valgrind upon exit. ```default ==978252== HEAP SUMMARY: ==978252== in use at exit: 58,918 bytes in 335 blocks ==978252== total heap usage: 23,833 allocs, 23,498 frees, 3,749,442 bytes allocated ==978252== ==978252== LEAK SUMMARY: ==978252== definitely lost: 0 bytes in 0 blocks ==978252== indirectly lost: 0 bytes in 0 blocks ==978252== possibly lost: 0 bytes in 0 blocks ==978252== still reachable: 56,902 bytes in 314 blocks ==978252== suppressed: 0 bytes in 0 blocks ==978252== Reachable blocks (those to which a pointer was found) are not shown. ==978252== To see them, rerun with: --leak-check=full --show-leak-kinds=all ==978252== ==978252== Use --track-origins=yes to see where uninitialised values come from ==978252== For lists of detected and suppressed errors, rerun with: -s ==978252== ERROR SUMMARY: 9 errors from 1 contexts (suppressed: 0 from 0) ``` -------------------------------- ### Determine Kernel Release Source: https://github.com/sipwise/rtpengine/wiki/Install-RTPEngine-on-Centos-7 Displays detailed kernel information, including the version, which is needed for correctly installing the kernel module. ```bash uname -a ``` -------------------------------- ### Run RTPEngine with Address Sanitizer Source: https://github.com/sipwise/rtpengine/wiki/RTPEngine-project-architecture Execute the RTPEngine binary compiled with ASan. This command includes necessary runtime configurations and arguments for testing. ```bash LD_PRELOAD=../t/tests-preload.so ./rtpengine --config-file=none -t -1 -i 203.0.113.1 -i 2001:db8:4321::1 -n 2223 -c 12345 -f -L 7 -E -u 2222 --silence-detect=1 ``` -------------------------------- ### Controlling Traffic Dropping Source: https://github.com/sipwise/rtpengine/blob/master/docs/ng_control_protocol.md Use `drop-traffic` with `start` to signal that all RTP for a call should be dropped, or `stop` to signal that it should not be dropped. `stop` has priority. ```string start ``` ```string stop ```