{"id":61,"date":"2015-08-11T10:48:27","date_gmt":"2015-08-11T14:48:27","guid":{"rendered":"http:\/\/blog.voipxswitch.com\/?p=61"},"modified":"2021-04-14T09:44:10","modified_gmt":"2021-04-14T13:44:10","slug":"rtpengine-with-kamailio-as-load-balancer-and-ip-gateway","status":"publish","type":"post","link":"https:\/\/blog.voipxswitch.com\/?p=61","title":{"rendered":"RTPEngine with Kamailio as Load-balancer and IP Gateway"},"content":{"rendered":"<p>This post explains how to setup Kamailio as an SBC and IP Gateway. We are using Debian 8 in this example. It uses Kamailio&#8217;s dispatcher module to distribute calls to Asterisk. It uses RTPEngine to proxy media to &amp; from the public internet across the LAN to Asterisk.<br \/>\nThis is a powerful setup as you can easily scale out using a single public IP address.<br \/>\nHere is the IP layout we will be implementing:<\/p>\n<pre>Kamailio Public (eth0) 7.6.5.4\nKamailio Private (eth1) 10.10.10.254\nAsterisk machine 1 - 10.10.10.3\nAsterisk machine 2 - 10.10.10.4<\/pre>\n<p>Setup Debian and iptables to act as IP Gateway:<\/p>\n<pre># edit \/etc\/sysctl.conf\nenabled net.ipv4.ip_forward=1\n\n# add iptables rules\niptables -F\niptables -t nat -F\n\niptables -P INPUT ACCEPT\niptables -P OUTPUT ACCEPT\niptables -P FORWARD ACCEPT\n\niptables -A INPUT -i lo -j ACCEPT\niptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT\niptables -A FORWARD -i eth1 -s 10.10.10.0\/255.255.255.0 -j ACCEPT\niptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE\n\n<\/pre>\n<p>Install RTPEngine + Kamailio with RTPEngine Module.<\/p>\n<p>Download <a href=\"http:\/\/blog.voipxswitch.com\/wp-content\/uploads\/2015\/08\/kamailio.cfg-rtpengine.txt\">kamailio.cfg<\/a><\/p>\n<p>Download <a href=\"http:\/\/blog.voipxswitch.com\/wp-content\/uploads\/2015\/08\/sip.conf-asterisk.txt\">sip.conf<\/a><\/p>\n<p>Download <a href=\"http:\/\/blog.voipxswitch.com\/wp-content\/uploads\/2015\/08\/ngcp-rtpengine-daemon.txt\">\/etc\/default\/ngcp-rtpengine-daemon<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post explains how to setup Kamailio as an SBC and IP Gateway. We are using Debian 8 in this example. It uses Kamailio&#8217;s dispatcher module to distribute calls to Asterisk. It uses RTPEngine to proxy media to &amp; from the public internet across the LAN to Asterisk. This is a powerful setup as you [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,6,21,9,22,23,25,15],"tags":[],"class_list":["post-61","post","type-post","status-publish","format-standard","hentry","category-asterisk","category-high-availability","category-kamailio","category-load-balancer","category-rtp","category-rtpengine","category-sip","category-voip"],"_links":{"self":[{"href":"https:\/\/blog.voipxswitch.com\/index.php?rest_route=\/wp\/v2\/posts\/61","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.voipxswitch.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.voipxswitch.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.voipxswitch.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.voipxswitch.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=61"}],"version-history":[{"count":3,"href":"https:\/\/blog.voipxswitch.com\/index.php?rest_route=\/wp\/v2\/posts\/61\/revisions"}],"predecessor-version":[{"id":234,"href":"https:\/\/blog.voipxswitch.com\/index.php?rest_route=\/wp\/v2\/posts\/61\/revisions\/234"}],"wp:attachment":[{"href":"https:\/\/blog.voipxswitch.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=61"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.voipxswitch.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=61"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.voipxswitch.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=61"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}