kamailio.cfg: option to use rtpengine for nat traversal
authorDaniel-Constantin Mierla <miconda@gmail.com>
Tue, 29 Oct 2019 09:22:05 +0000 (10:22 +0100)
committerDaniel-Constantin Mierla <miconda@gmail.com>
Tue, 29 Oct 2019 09:22:05 +0000 (10:22 +0100)
- define WITH_NAT
- define WITH_RTPENGINE

etc/kamailio.cfg

index 9047f49..21470ce 100644 (file)
 #
 # *** To enable nat traversal execute:
 #     - define WITH_NAT
+#     - option for NAT SIP OPTIONS keepalives: WITH_NATSIPPING
 #     - install RTPProxy: http://www.rtpproxy.org
 #     - start RTPProxy:
 #        rtpproxy -l _your_public_ip_ -s udp:localhost:7722
-#     - option for NAT SIP OPTIONS keepalives: WITH_NATSIPPING
+#
+# *** To use RTPEngine (instead of RTPProxy) for nat traversal execute:
+#     - define WITH_RTPENGINE
+#     - install RTPEngine: https://github.com/sipwise/rtpengine
+#     - start RTPEngine:
+#        rtpengine --listen-ng=127.0.0.1:2223 ...
 #
 # *** To enable PSTN gateway routing execute:
 #     - define WITH_PSTN
@@ -417,9 +423,13 @@ modparam("presence_xml", "force_active", 1)
 #!endif
 
 #!ifdef WITH_NAT
+#!ifdef WITH_RTPENGINE
+# ----- rtpengine params -----
+modparam("rtpengine", "rtpengine_sock", "udp:127.0.0.1:2223")
+#!else
 # ----- rtpproxy params -----
 modparam("rtpproxy", "rtpproxy_sock", "udp:127.0.0.1:7722")
-
+#!endit
 # ----- nathelper params -----
 modparam("nathelper", "natping_interval", 30)
 modparam("nathelper", "ping_nated_only", 1)
@@ -809,9 +819,16 @@ route[NATMANAGE] {
        if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB))) return;
 
        if(nat_uac_test("8")) {
+#!ifdef WITH_RTPENGINE
+               rtpengine_manage("replace-origin replace-session-connection");
+#!else
                rtpproxy_manage("co");
+#!endif
        } else {
+               rtpengine_manage("trust-address replace-origin replace-session-connection");
+#!else
                rtpproxy_manage("cor");
+#!endif
        }
 
        if (is_request()) {