etc/kamailio.cfg: do sanity check for sip responses
authorDaniel-Constantin Mierla <miconda@gmail.com>
Thu, 21 Mar 2019 13:30:06 +0000 (14:30 +0100)
committerDaniel-Constantin Mierla <miconda@gmail.com>
Thu, 21 Mar 2019 13:30:06 +0000 (14:30 +0100)
etc/kamailio.cfg

index 9b8cc52..851a3d0 100644 (file)
@@ -310,6 +310,9 @@ modparam("jsonrpcs", "pretty_format", 1)
 /* set the path to RPC unix socket control file */
 # modparam("ctl", "binrpc", "unix:/var/run/kamailio/kamailio_ctl")
 
+# ----- sanity params -----
+modparam("sanity", "autodrop", 0)
+
 # ----- tm params -----
 # auto-discard branches from previous serial forking leg
 modparam("tm", "failure_reply_mode", 3)
@@ -595,7 +598,7 @@ route[REQINIT] {
        }
 
        if(!sanity_check("17895", "7")) {
-               xlog("Malformed SIP message from $si:$sp\n");
+               xlog("Malformed SIP request from $si:$sp\n");
                exit;
        }
 }
@@ -951,6 +954,14 @@ branch_route[MANAGE_BRANCH] {
 }
 
 # Manage incoming replies
+reply_route {
+       if(!sanity_check("17604", "6")) {
+               xlog("Malformed SIP response from $si:$sp\n");
+               drop;
+       }
+}
+
+# Manage incoming replies in transaction context
 onreply_route[MANAGE_REPLY] {
        xdbg("incoming reply\n");
        if(status=~"[12][0-9][0-9]") {