{"id":1469,"date":"2020-10-27T11:39:10","date_gmt":"2020-10-27T06:39:10","guid":{"rendered":"http:\/\/alexeyka.zantsev.com\/?p=1469"},"modified":"2021-05-24T11:49:50","modified_gmt":"2021-05-24T06:49:50","slug":"opensips-invite-filtering","status":"publish","type":"post","link":"https:\/\/alexeyka.zantsev.com\/?p=1469","title":{"rendered":"OpenSIPS: INVITE filtering"},"content":{"rendered":"\n<p class=\"has-text-align-left\">A small snippet for passing only valid INVITEs from the Internet to your OpenSIPS server: allowing calls from VoIP ISPs and registered users only.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># antiflood\nif(!is_myself(\"$si\") &amp;&amp; $Rp == 5060)\n{\n  if(!is_registered(\"location\", \"$fu\") &amp;&amp; !check_source_address(\"1\")) \n  {\n    exit;\n  }\n}<\/pre>\n\n\n\n<p>In this example we store ISPs IP addresses in the <a rel=\"noreferrer noopener\" href=\"https:\/\/www.opensips.org\/Documentation\/Install-DBSchema-2-4#GEN-DB-ADDRESS\" target=\"_blank\">&#8216;address&#8217; table<\/a> of the <a rel=\"noreferrer noopener\" href=\"https:\/\/opensips.org\/docs\/modules\/2.4.x\/permissions.html\" target=\"_blank\">permissions<\/a> module, in group 1, which is seen from the output of the corresponding fifo command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@voip-srv ~]# opensipsctl fifo address_dump\npart:: default\ndest:: grp=1 ip=193.201.229.35 mask=32 port=0 proto=any pattern= context_info=VoIP ISP Multifon\ndest:: grp=1 ip=81.211.59.102 mask=32 port=0 proto=any pattern= context_info=VoIP ISP ekt.ip.Beeline\ndest:: grp=1 ip=212.119.246.230 mask=32 port=0 proto=any pattern= context_info=VoIP ISP ip.Beeline<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>A small snippet for passing only valid INVITEs from the Internet to your OpenSIPS server: allowing calls from VoIP ISPs and registered users only. # antiflood if(!is_myself(&#8220;$si&#8221;) &amp;&amp; $Rp == 5060) { if(!is_registered(&#8220;location&#8221;, &#8220;$fu&#8221;) &amp;&amp; !check_source_address(&#8220;1&#8221;)) { exit; } } In this example we store ISPs IP addresses in the &#8216;address&#8217; table of the permissions [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[267,208,137],"class_list":["post-1469","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-filtering","tag-opensips","tag-permissions"],"_links":{"self":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/1469","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1469"}],"version-history":[{"count":4,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/1469\/revisions"}],"predecessor-version":[{"id":12073,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/1469\/revisions\/12073"}],"wp:attachment":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1469"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}