<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hello,</p>
    <p>that error should appear when request_route {} block is not
      found. It can be due to the fact that some #!ifdef are not
      properly closed with #!endif, can you double check? If still not
      fixed, set in your kamailio.cfg:</p>
    <p>verbose_startup=1<br>
    </p>
    <p> debug=3</p>
    <p>and then send the debug messages when kamailio is started.<br>
    </p>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 16.01.18 22:27, Christian Scheid
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CACoEH8YwR1fHqmZ2pBCny3TLGNj+t7sODmu9-9XX81PTi4KFkA@mail.gmail.com">
      <div dir="ltr">Experts,
        <div><br>
        </div>
        <div>I'm currently setting up Kamailio for the first time (yay!)
          and ran into an issue (DOH!!!).</div>
        <div><br>
        </div>
        <div>The install went fine and I modified a few lines in the
          kamailio-basic.cfg (below).</div>
        <div>I also set up two users 'bob' and 'alice' and am trying to
          start a simple chat session between two QjSimple clients.<br>
          <div><br>
          </div>
          <div>In the syslog I see the following error.</div>
          <div>
            <div>/usr/sbin/kamailio[32998]: ERROR: <core>
              [core/receive.c:257]: receive_msg(): no config routing
              engine registered</div>
          </div>
          <div><br>
          </div>
          <div>I followed the Debian installation instructions below but
            didn't see anything about config routing engine setup.</div>
          <div><a
href="https://www.kamailio.org/wiki/tutorials/getting-started/main#debian"
              moz-do-not-send="true">https://www.kamailio.org/wiki/tutorials/getting-started/main#debian</a><br>
          </div>
          <div><br>
          </div>
        </div>
        <div>Can you point me in the right direction what is missing? </div>
        <div><br>
        </div>
        <div>Thanks! </div>
        <div><br>
        </div>
        <div>Chris</div>
        <div>-----------------------</div>
        <div><br>
        </div>
        <div>
          <div>#!KAMAILIO</div>
          <div>#</div>
          <div># Kamailio (OpenSER) SIP Server v5.0 - default
            configuration script</div>
          <div>#     - web: <a href="http://www.kamailio.org"
              moz-do-not-send="true">http://www.kamailio.org</a></div>
          <div>#     - git: <a href="http://sip-router.org"
              moz-do-not-send="true">http://sip-router.org</a></div>
          <div>#</div>
          <div># Direct your questions about this file to: <<a
              href="mailto:sr-users@lists.sip-router.org"
              moz-do-not-send="true">sr-users@lists.sip-router.org</a>></div>
          <div>#</div>
          <div># Refer to the Core CookBook at <a
              href="http://www.kamailio.org/wiki/"
              moz-do-not-send="true">http://www.kamailio.org/wiki/</a></div>
          <div># for an explanation of possible statements, functions
            and parameters.</div>
          <div>#</div>
          <div># Several features can be enabled using '#!define
            WITH_FEATURE' directives:</div>
          <div>#</div>
          <div># *** To run in debug mode:</div>
          <div>#     - define WITH_DEBUG</div>
          <div>#</div>
          <div># *** To enable mysql:</div>
          <div>#     - define WITH_MYSQL</div>
          <div>#</div>
          <div># *** To enable authentication execute:</div>
          <div>#     - enable mysql</div>
          <div>#     - define WITH_AUTH</div>
          <div>#     - add users using 'kamctl'</div>
          <div>#</div>
          <div># *** To enable IP authentication execute:</div>
          <div>#     - enable mysql</div>
          <div>#     - enable authentication</div>
          <div>#     - define WITH_IPAUTH</div>
          <div>#     - add IP addresses with group id '1' to 'address'
            table</div>
          <div>#</div>
          <div># *** To enable persistent user location execute:</div>
          <div>#     - enable mysql</div>
          <div>#     - define WITH_USRLOCDB</div>
          <div>#</div>
          <div># *** To enable nat traversal execute:</div>
          <div>#     - define WITH_NAT</div>
          <div>#     - install RTPProxy: <a
              href="http://www.rtpproxy.org" moz-do-not-send="true">http://www.rtpproxy.org</a></div>
          <div>#     - start RTPProxy:</div>
          <div>#        rtpproxy -l _your_public_ip_ -s
            udp:localhost:7722</div>
          <div>#     - option for NAT SIP OPTIONS keepalives:
            WITH_NATSIPPING</div>
          <div>#</div>
          <div># *** To enable TLS support execute:</div>
          <div>#     - adjust CFGDIR/tls.cfg as needed</div>
          <div>#     - define WITH_TLS</div>
          <div>#</div>
          <div># *** To enhance accounting execute:</div>
          <div>#     - enable mysql</div>
          <div>#     - define WITH_ACCDB</div>
          <div>#     - add following columns to database</div>
          <div>#!ifdef ACCDB_COMMENT</div>
          <div>  ALTER TABLE acc ADD COLUMN src_user VARCHAR(64) NOT
            NULL DEFAULT '';</div>
          <div>  ALTER TABLE acc ADD COLUMN src_domain VARCHAR(128) NOT
            NULL DEFAULT '';</div>
          <div>  ALTER TABLE acc ADD COLUMN src_ip varchar(64) NOT NULL
            default '';</div>
          <div>  ALTER TABLE acc ADD COLUMN dst_ouser VARCHAR(64) NOT
            NULL DEFAULT '';</div>
          <div>  ALTER TABLE acc ADD COLUMN dst_user VARCHAR(64) NOT
            NULL DEFAULT '';</div>
          <div>  ALTER TABLE acc ADD COLUMN dst_domain VARCHAR(128) NOT
            NULL DEFAULT '';</div>
          <div>  ALTER TABLE missed_calls ADD COLUMN src_user
            VARCHAR(64) NOT NULL DEFAULT '';</div>
          <div>  ALTER TABLE missed_calls ADD COLUMN src_domain
            VARCHAR(128) NOT NULL DEFAULT '';</div>
          <div>  ALTER TABLE missed_calls ADD COLUMN src_ip varchar(64)
            NOT NULL default '';</div>
          <div>  ALTER TABLE missed_calls ADD COLUMN dst_ouser
            VARCHAR(64) NOT NULL DEFAULT '';</div>
          <div>  ALTER TABLE missed_calls ADD COLUMN dst_user
            VARCHAR(64) NOT NULL DEFAULT '';</div>
          <div>  ALTER TABLE missed_calls ADD COLUMN dst_domain
            VARCHAR(128) NOT NULL DEFAULT '';</div>
          <div>#!endif</div>
          <div><br>
          </div>
          <div>####### Include Local Config If Exists #########</div>
          <div>import_file "kamailio-local.cfg"</div>
          <div><br>
          </div>
          <div>#  Custom Setup #</div>
          <div>#!define WITH_MYSQL</div>
          <div>#!define WITH_AUTH</div>
          <div>#!define WITH_USRLOCDB</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>####### Defined Values #########</div>
          <div><br>
          </div>
          <div># *** Value defines - IDs used later in config</div>
          <div>#!ifdef WITH_MYSQL</div>
          <div># - database URL - used to connect to database server by
            modules such</div>
          <div>#       as: auth_db, acc, usrloc, a.s.o.</div>
          <div>#!ifndef DBURL</div>
          <div>#!define DBURL
            "mysql://kamailio:kamailiorw@localhost/kamailio"</div>
          <div>#!endif</div>
          <div>#!endif</div>
          <div>#!define MULTIDOMAIN 0</div>
          <div><br>
          </div>
          <div># - flags</div>
          <div>#   FLT_ - per transaction (message) flags</div>
          <div>#<span style="white-space:pre">    </span>FLB_ - per branch
            flags</div>
          <div>#!define FLT_ACC 1</div>
          <div>#!define FLT_ACCMISSED 2</div>
          <div>#!define FLT_ACCFAILED 3</div>
          <div>#!define FLT_NATS 5</div>
          <div><br>
          </div>
          <div>#!define FLB_NATB 6</div>
          <div>#!define FLB_NATSIPPING 7</div>
          <div><br>
          </div>
          <div>####### Global Parameters #########</div>
          <div><br>
          </div>
          <div>### LOG Levels: 3=DBG, 2=INFO, 1=NOTICE, 0=WARN, -1=ERR</div>
          <div>#!ifdef WITH_DEBUG</div>
          <div>debug=4</div>
          <div>log_stderror=yes</div>
          <div>#!else</div>
          <div>debug=2</div>
          <div>log_stderror=no</div>
          <div>#!endif</div>
          <div><br>
          </div>
          <div>memdbg=5</div>
          <div>memlog=5</div>
          <div><br>
          </div>
          <div>log_facility=LOG_LOCAL0</div>
          <div><br>
          </div>
          <div>fork=yes</div>
          <div>children=4</div>
          <div><br>
          </div>
          <div>/* uncomment the next line to disable TCP (default on) */</div>
          <div>#disable_tcp=yes</div>
          <div><br>
          </div>
          <div>/* uncomment the next line to disable the auto discovery
            of local aliases</div>
          <div> * based on reverse DNS on IPs (default on) */</div>
          <div>#auto_aliases=no</div>
          <div><br>
          </div>
          <div>/* add local domain aliases */</div>
          <div>#alias="<a href="http://sip.mydomain.com"
              moz-do-not-send="true">sip.mydomain.com</a>"</div>
          <div><br>
          </div>
          <div>/* uncomment and configure the following line if you want
            Kamailio to</div>
          <div> * bind on a specific interface/port/proto (default bind
            on all available) */</div>
          <div>#listen=udp:<a href="http://10.0.0.10:5060"
              moz-do-not-send="true">10.0.0.10:5060</a></div>
          <div><br>
          </div>
          <div>/* port to listen to</div>
          <div> * - can be specified more than once if needed to listen
            on many ports */</div>
          <div>port=5060</div>
          <div><br>
          </div>
          <div>#!ifdef WITH_TLS</div>
          <div>enable_tls=yes</div>
          <div>#!endif</div>
          <div><br>
          </div>
          <div># life time of TCP connection when there is no traffic</div>
          <div># - a bit higher than registration expires to cope with
            UA behind NAT</div>
          <div>tcp_connection_lifetime=3605</div>
          <div><br>
          </div>
          <div>####### Modules Section ########</div>
          <div><br>
          </div>
          <div># set paths to location of modules (to sources or
            installation folders)</div>
          <div>#!ifdef WITH_SRCPATH</div>
          <div>mpath="modules"</div>
          <div>#!else</div>
          <div>mpath="/usr/lib/x86_64-linux-gnu/kamailio/modules/"</div>
          <div>#!endif</div>
          <div><br>
          </div>
          <div>#!ifdef WITH_MYSQL</div>
          <div>loadmodule "db_mysql.so"</div>
          <div>#!endif</div>
          <div><br>
          </div>
          <div>loadmodule "jsonrpcs.so"</div>
          <div>loadmodule "kex.so"</div>
          <div>loadmodule "corex.so"</div>
          <div>loadmodule "tm.so"</div>
          <div>loadmodule "tmx.so"</div>
          <div>loadmodule "sl.so"</div>
          <div>loadmodule "rr.so"</div>
          <div>loadmodule "pv.so"</div>
          <div>loadmodule "maxfwd.so"</div>
          <div>loadmodule "usrloc.so"</div>
          <div>loadmodule "registrar.so"</div>
          <div>loadmodule "textops.so"</div>
          <div>loadmodule "siputils.so"</div>
          <div>loadmodule "xlog.so"</div>
          <div>loadmodule "sanity.so"</div>
          <div>loadmodule "ctl.so"</div>
          <div>loadmodule "cfg_rpc.so"</div>
          <div>loadmodule "acc.so"</div>
          <div>loadmodule "counters.so"</div>
          <div><br>
          </div>
          <div>#!ifdef WITH_AUTH</div>
          <div>loadmodule "auth.so"</div>
          <div>loadmodule "auth_db.so"</div>
          <div>#!ifdef WITH_IPAUTH</div>
          <div>loadmodule "permissions.so"</div>
          <div>#!endif</div>
          <div>#!endif</div>
          <div><br>
          </div>
          <div>#!ifdef WITH_NAT</div>
          <div>loadmodule "nathelper.so"</div>
          <div>loadmodule "rtpproxy.so"</div>
          <div>#!endif</div>
          <div><br>
          </div>
          <div>#!ifdef WITH_TLS</div>
          <div>loadmodule "tls.so"</div>
          <div>#!endif</div>
          <div><br>
          </div>
          <div>#!ifdef WITH_DEBUG</div>
          <div>loadmodule "debugger.so"</div>
          <div>#!endif</div>
          <div><br>
          </div>
          <div># ----------------- setting module-specific parameters
            ---------------</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div># ----- jsonrpcs params -----</div>
          <div>modparam("jsonrpcs", "pretty_format", 1)</div>
          <div>/* set the path to RPC fifo control file */</div>
          <div># modparam("jsonrpcs", "fifo_name",
            "/var/run/kamailio/kamailio_rpc.fifo")</div>
          <div>/* set the path to RPC unix socket control file */</div>
          <div># modparam("jsonrpcs", "dgram_socket",
            "/var/run/kamailio/kamailio_rpc.sock")</div>
          <div><br>
          </div>
          <div># ----- ctl params -----</div>
          <div>#modparam("ctl", "binrpc",
            "unix:/var/run/kamailio/kamailio_ctl")</div>
          <div><br>
          </div>
          <div># ----- tm params -----</div>
          <div># auto-discard branches from previous serial forking leg</div>
          <div>modparam("tm", "failure_reply_mode", 3)</div>
          <div># default retransmission timeout: 30sec</div>
          <div>modparam("tm", "fr_timer", 30000)</div>
          <div># default invite retransmission timeout after 1xx: 120sec</div>
          <div>modparam("tm", "fr_inv_timer", 120000)</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div># ----- rr params -----</div>
          <div># add value to ;lr param to cope with most of the UAs</div>
          <div>modparam("rr", "enable_full_lr", 1)</div>
          <div># do not append from tag to the RR (no need for this
            script)</div>
          <div>modparam("rr", "append_fromtag", 0)</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div># ----- registrar params -----</div>
          <div>modparam("registrar", "method_filtering", 1)</div>
          <div>/* uncomment the next line to disable parallel forking
            via location */</div>
          <div># modparam("registrar", "append_branches", 0)</div>
          <div>/* uncomment the next line not to allow more than 10
            contacts per AOR */</div>
          <div>#modparam("registrar", "max_contacts", 10)</div>
          <div># max value for expires of registrations</div>
          <div>modparam("registrar", "max_expires", 3600)</div>
          <div># set it to 1 to enable GRUU</div>
          <div>modparam("registrar", "gruu_enabled", 0)</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div># ----- acc params -----</div>
          <div>/* what special events should be accounted ? */</div>
          <div>modparam("acc", "early_media", 0)</div>
          <div>modparam("acc", "report_ack", 0)</div>
          <div>modparam("acc", "report_cancels", 0)</div>
          <div>/* by default we do not adjust the direct of the
            sequential requests.</div>
          <div> * if you enable this parameter, be sure the enable
            "append_fromtag"</div>
          <div> * in "rr" module */</div>
          <div>modparam("acc", "detect_direction", 0)</div>
          <div>/* account triggers (flags) */</div>
          <div>modparam("acc", "log_flag", FLT_ACC)</div>
          <div>modparam("acc", "log_missed_flag", FLT_ACCMISSED)</div>
          <div>modparam("acc", "log_extra",</div>
          <div><span style="white-space:pre">     </span>"src_user=$fU;src_domain=$fd;src_ip=$si;"</div>
          <div><span style="white-space:pre">     </span>"dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")</div>
          <div>modparam("acc", "failed_transaction_flag", FLT_ACCFAILED)</div>
          <div>/* enhanced DB accounting */</div>
          <div>#!ifdef WITH_ACCDB</div>
          <div>modparam("acc", "db_flag", FLT_ACC)</div>
          <div>modparam("acc", "db_missed_flag", FLT_ACCMISSED)</div>
          <div>modparam("acc", "db_url", DBURL)</div>
          <div>modparam("acc", "db_extra",</div>
          <div><span style="white-space:pre">     </span>"src_user=$fU;src_domain=$fd;src_ip=$si;"</div>
          <div><span style="white-space:pre">     </span>"dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")</div>
          <div>#!endif</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div># ----- usrloc params -----</div>
          <div>/* enable DB persistency for location entries */</div>
          <div>#!ifdef WITH_USRLOCDB</div>
          <div>modparam("usrloc", "db_url", DBURL)</div>
          <div>modparam("usrloc", "db_mode", 2)</div>
          <div>modparam("usrloc", "use_domain", MULTIDOMAIN)</div>
          <div>#!endif</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div># ----- auth_db params -----</div>
          <div>#!ifdef WITH_AUTH</div>
          <div>modparam("auth_db", "db_url", DBURL)</div>
          <div>modparam("auth_db", "calculate_ha1", yes)</div>
          <div>modparam("auth_db", "password_column", "password")</div>
          <div>modparam("auth_db", "load_credentials", "")</div>
          <div>modparam("auth_db", "use_domain", MULTIDOMAIN)</div>
          <div><br>
          </div>
          <div># ----- permissions params -----</div>
          <div>#!ifdef WITH_IPAUTH</div>
          <div>modparam("permissions", "db_url", DBURL)</div>
          <div>modparam("permissions", "db_mode", 1)</div>
          <div>#!endif</div>
          <div><br>
          </div>
          <div>#!endif</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>#!ifdef WITH_NAT</div>
          <div># ----- rtpproxy params -----</div>
          <div>modparam("rtpproxy", "rtpproxy_sock", "udp:<a
              href="http://127.0.0.1:7722" moz-do-not-send="true">127.0.0.1:7722</a>")</div>
          <div><br>
          </div>
          <div># ----- nathelper params -----</div>
          <div>modparam("nathelper", "natping_interval", 30)</div>
          <div>modparam("nathelper", "ping_nated_only", 1)</div>
          <div>modparam("nathelper", "sipping_bflag", FLB_NATSIPPING)</div>
          <div>modparam("nathelper", "sipping_from", "<a
              href="mailto:sip%3Apinger@kamailio.org"
              moz-do-not-send="true">sip:pinger@kamailio.org</a>")</div>
          <div><br>
          </div>
          <div># params needed for NAT traversal in other modules</div>
          <div>modparam("nathelper|registrar", "received_avp",
            "$avp(RECEIVED)")</div>
          <div>modparam("usrloc", "nat_bflag", FLB_NATB)</div>
          <div>#!endif</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>#!ifdef WITH_TLS</div>
          <div># ----- tls params -----</div>
          <div>modparam("tls", "config", "/etc/kamailio/tls.cfg")</div>
          <div>#!endif</div>
          <div><br>
          </div>
          <div>#!ifdef WITH_DEBUG</div>
          <div># ----- debugger params -----</div>
          <div>modparam("debugger", "cfgtrace", 1)</div>
          <div>#!endif</div>
          <div><br>
          </div>
          <div>####### Routing Logic ########</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div># Main SIP request routing logic</div>
          <div># - processing of any incoming SIP request starts with
            this route</div>
          <div># - note: this is the same as route { ... }</div>
          <div>request_route {</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span># per request
            initial checks</div>
          <div><span style="white-space:pre">     </span>route(REQINIT);</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span># NAT detection</div>
          <div><span style="white-space:pre">     </span>route(NATDETECT);</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span># CANCEL processing</div>
          <div><span style="white-space:pre">     </span>if
            (is_method("CANCEL")) {</div>
          <div><span style="white-space:pre">             </span>if
            (t_check_trans()) {</div>
          <div><span style="white-space:pre">                     </span>route(RELAY);</div>
          <div><span style="white-space:pre">             </span>}</div>
          <div><span style="white-space:pre">             </span>exit;</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span># handle requests
            within SIP dialogs</div>
          <div><span style="white-space:pre">     </span>route(WITHINDLG);</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span>### only initial
            requests (no To tag)</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span># handle
            retransmissions</div>
          <div><span style="white-space:pre">     </span>if(t_precheck_trans())
            {</div>
          <div><span style="white-space:pre">             </span>t_check_trans();</div>
          <div><span style="white-space:pre">             </span>exit;</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div><span style="white-space:pre">     </span>t_check_trans();</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span># authentication</div>
          <div><span style="white-space:pre">     </span>route(AUTH);</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span># record routing
            for dialog forming requests (in case they are routed)</div>
          <div><span style="white-space:pre">     </span># - remove
            preloaded route headers</div>
          <div><span style="white-space:pre">     </span>remove_hf("Route");</div>
          <div><span style="white-space:pre">     </span>if
            (is_method("INVITE|SUBSCRIBE"))</div>
          <div><span style="white-space:pre">             </span>record_route();</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span># account only
            INVITEs</div>
          <div><span style="white-space:pre">     </span>if
            (is_method("INVITE")) {</div>
          <div><span style="white-space:pre">             </span>setflag(FLT_ACC);
            # do accounting</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span># dispatch requests
            to foreign domains</div>
          <div><span style="white-space:pre">     </span>route(SIPOUT);</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span>### requests for my
            local domains</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span># handle
            registrations</div>
          <div><span style="white-space:pre">     </span>route(REGISTRAR);</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span>if ($rU==$null) {</div>
          <div><span style="white-space:pre">             </span># request with no
            Username in RURI</div>
          <div><span style="white-space:pre">             </span>sl_send_reply("484","Address
            Incomplete");</div>
          <div><span style="white-space:pre">             </span>exit;</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span># user location
            service</div>
          <div><span style="white-space:pre">     </span>route(LOCATION);</div>
          <div>}</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>route[RELAY] {</div>
          <div><span style="white-space:pre">     </span># enable additional
            event routes for forwarded requests</div>
          <div><span style="white-space:pre">     </span># - serial forking,
            RTP relaying handling, a.s.o.</div>
          <div><span style="white-space:pre">     </span>if
            (is_method("INVITE|BYE|SUBSCRIBE|UPDATE")) {</div>
          <div><span style="white-space:pre">             </span>if(!t_is_set("branch_route"))
            t_on_branch("MANAGE_BRANCH");</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div><span style="white-space:pre">     </span>if
            (is_method("INVITE|SUBSCRIBE|UPDATE")) {</div>
          <div><span style="white-space:pre">             </span>if(!t_is_set("onreply_route"))
            t_on_reply("MANAGE_REPLY");</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div><span style="white-space:pre">     </span>if
            (is_method("INVITE")) {</div>
          <div><span style="white-space:pre">             </span>if(!t_is_set("failure_route"))
            t_on_failure("MANAGE_FAILURE");</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span>if (!t_relay()) {</div>
          <div><span style="white-space:pre">             </span>sl_reply_error();</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div><span style="white-space:pre">     </span>exit;</div>
          <div>}</div>
          <div><br>
          </div>
          <div># Per SIP request initial checks</div>
          <div>route[REQINIT] {</div>
          <div>#!ifdef WITH_ANTIFLOOD</div>
          <div><span style="white-space:pre">     </span># flood dection
            from same IP and traffic ban for a while</div>
          <div><span style="white-space:pre">     </span># be sure you
            exclude checking trusted peers, such as pstn gateways</div>
          <div><span style="white-space:pre">     </span># - local host
            excluded (e.g., loop to self)</div>
          <div><span style="white-space:pre">     </span>if(src_ip!=myself)
            {</div>
          <div><span style="white-space:pre">             </span>if($sht(ipban=>$si)!=$null)
            {</div>
          <div><span style="white-space:pre">                     </span># ip is already
            blocked</div>
          <div><span style="white-space:pre">                     </span>xdbg("request
            from blocked IP - $rm from $fu (IP:$si:$sp)\n");</div>
          <div><span style="white-space:pre">                     </span>exit;</div>
          <div><span style="white-space:pre">             </span>}</div>
          <div><span style="white-space:pre">             </span>if
            (!pike_check_req()) {</div>
          <div><span style="white-space:pre">                     </span>xlog("L_ALERT","ALERT:
            pike blocking $rm from $fu (IP:$si:$sp)\n");</div>
          <div><span style="white-space:pre">                     </span>$sht(ipban=>$si)
            = 1;</div>
          <div><span style="white-space:pre">                     </span>exit;</div>
          <div><span style="white-space:pre">             </span>}</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div><span style="white-space:pre">     </span>if($ua =~
            "friendly-scanner") {</div>
          <div><span style="white-space:pre">             </span>sl_send_reply("200",
            "OK");</div>
          <div><span style="white-space:pre">             </span>exit;</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div>#!endif</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span>if
            (!mf_process_maxfwd_header("10")) {</div>
          <div><span style="white-space:pre">             </span>sl_send_reply("483","Too
            Many Hops");</div>
          <div><span style="white-space:pre">             </span>exit;</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span>if(is_method("OPTIONS")
            && uri==myself && $rU==$null) {</div>
          <div><span style="white-space:pre">             </span>sl_send_reply("200","Keepalive");</div>
          <div><span style="white-space:pre">             </span>exit;</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span>if(!sanity_check("1511",
            "7")) {</div>
          <div><span style="white-space:pre">             </span>xlog("Malformed
            SIP message from $si:$sp\n");</div>
          <div><span style="white-space:pre">             </span>exit;</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div>}</div>
          <div><br>
          </div>
          <div># Handle requests within SIP dialogs</div>
          <div>route[WITHINDLG] {</div>
          <div><span style="white-space:pre">     </span>if (!has_totag())
            return;</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span># sequential
            request withing a dialog should</div>
          <div><span style="white-space:pre">     </span># take the path
            determined by record-routing</div>
          <div><span style="white-space:pre">     </span>if (loose_route())
            {</div>
          <div><span style="white-space:pre">             </span>route(DLGURI);</div>
          <div><span style="white-space:pre">             </span>if
            (is_method("BYE")) {</div>
          <div><span style="white-space:pre">                     </span>setflag(FLT_ACC);
            # do accounting ...</div>
          <div><span style="white-space:pre">                     </span>setflag(FLT_ACCFAILED);
            # ... even if the transaction fails</div>
          <div><span style="white-space:pre">             </span>}</div>
          <div><span style="white-space:pre">             </span>else if (
            is_method("ACK") ) {</div>
          <div><span style="white-space:pre">                     </span># ACK is
            forwarded statelessy</div>
          <div><span style="white-space:pre">                     </span>route(NATMANAGE);</div>
          <div><span style="white-space:pre">             </span>}</div>
          <div><span style="white-space:pre">             </span>else if (
            is_method("NOTIFY") ) {</div>
          <div><span style="white-space:pre">                     </span># Add
            Record-Route for in-dialog NOTIFY as per RFC 6665.</div>
          <div><span style="white-space:pre">                     </span>record_route();</div>
          <div><span style="white-space:pre">             </span>}</div>
          <div><span style="white-space:pre">             </span>route(RELAY);</div>
          <div><span style="white-space:pre">             </span>exit;</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div><span style="white-space:pre">     </span>if (
            is_method("ACK") ) {</div>
          <div><span style="white-space:pre">             </span>if (
            t_check_trans() ) {</div>
          <div><span style="white-space:pre">                     </span># no loose-route,
            but stateful ACK;</div>
          <div><span style="white-space:pre">                     </span># must be an ACK
            after a 487</div>
          <div><span style="white-space:pre">                     </span># or e.g. 404
            from upstream server</div>
          <div><span style="white-space:pre">                     </span>route(RELAY);</div>
          <div><span style="white-space:pre">                     </span>exit;</div>
          <div><span style="white-space:pre">             </span>} else {</div>
          <div><span style="white-space:pre">                     </span># ACK without
            matching transaction ... ignore and discard</div>
          <div><span style="white-space:pre">                     </span>exit;</div>
          <div><span style="white-space:pre">             </span>}</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div><span style="white-space:pre">     </span>sl_send_reply("404",
            "Not here");</div>
          <div><span style="white-space:pre">     </span>exit;</div>
          <div>}</div>
          <div><br>
          </div>
          <div># Handle SIP registrations</div>
          <div>route[REGISTRAR] {</div>
          <div><span style="white-space:pre">     </span>if
            (!is_method("REGISTER")) return;</div>
          <div><span style="white-space:pre">     </span>if(isflagset(FLT_NATS))
            {</div>
          <div><span style="white-space:pre">             </span>setbflag(FLB_NATB);</div>
          <div>#!ifdef WITH_NATSIPPING</div>
          <div><span style="white-space:pre">             </span># do SIP NAT
            pinging</div>
          <div><span style="white-space:pre">             </span>setbflag(FLB_NATSIPPING);</div>
          <div>#!endif</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div><span style="white-space:pre">     </span>if
            (!save("location"))</div>
          <div><span style="white-space:pre">             </span>sl_reply_error();</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span>exit;</div>
          <div>}</div>
          <div><br>
          </div>
          <div># User location service</div>
          <div>route[LOCATION] {</div>
          <div><span style="white-space:pre">     </span>if
            (!lookup("location")) {</div>
          <div><span style="white-space:pre">             </span>$var(rc) = $rc;</div>
          <div><span style="white-space:pre">             </span>t_newtran();</div>
          <div><span style="white-space:pre">             </span>switch ($var(rc))
            {</div>
          <div><span style="white-space:pre">                     </span>case -1:</div>
          <div><span style="white-space:pre">                     </span>case -3:</div>
          <div><span style="white-space:pre">                             </span>send_reply("404",
            "Not Found");</div>
          <div><span style="white-space:pre">                             </span>exit;</div>
          <div><span style="white-space:pre">                     </span>case -2:</div>
          <div><span style="white-space:pre">                             </span>send_reply("405",
            "Method Not Allowed");</div>
          <div><span style="white-space:pre">                             </span>exit;</div>
          <div><span style="white-space:pre">             </span>}</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span># when routing via
            usrloc, log the missed calls also</div>
          <div><span style="white-space:pre">     </span>if
            (is_method("INVITE")) {</div>
          <div><span style="white-space:pre">             </span>setflag(FLT_ACCMISSED);</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span>route(RELAY);</div>
          <div><span style="white-space:pre">     </span>exit;</div>
          <div>}</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div># IP authorization and user uthentication</div>
          <div>route[AUTH] {</div>
          <div>#!ifdef WITH_AUTH</div>
          <div><br>
          </div>
          <div>#!ifdef WITH_IPAUTH</div>
          <div><span style="white-space:pre">     </span>if((!is_method("REGISTER"))
            && allow_source_address()) {</div>
          <div><span style="white-space:pre">             </span># source IP
            allowed</div>
          <div><span style="white-space:pre">             </span>return;</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div>#!endif</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span>if
            (is_method("REGISTER") || from_uri==myself) {</div>
          <div><span style="white-space:pre">             </span># authenticate
            requests</div>
          <div><span style="white-space:pre">             </span>if
            (!auth_check("$fd", "subscriber", "1")) {</div>
          <div><span style="white-space:pre">                     </span>auth_challenge("$fd",
            "0");</div>
          <div><span style="white-space:pre">                     </span>exit;</div>
          <div><span style="white-space:pre">             </span>}</div>
          <div><span style="white-space:pre">             </span># user
            authenticated - remove auth header</div>
          <div><span style="white-space:pre">             </span>if(!is_method("REGISTER|PUBLISH"))</div>
          <div><span style="white-space:pre">                     </span>consume_credentials();</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div><span style="white-space:pre">     </span># if caller is not
            local subscriber, then check if it calls</div>
          <div><span style="white-space:pre">     </span># a local
            destination, otherwise deny, not an open relay here</div>
          <div><span style="white-space:pre">     </span>if
            (from_uri!=myself && uri!=myself) {</div>
          <div><span style="white-space:pre">             </span>sl_send_reply("403","Not
            relaying");</div>
          <div><span style="white-space:pre">             </span>exit;</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div><br>
          </div>
          <div>#!endif</div>
          <div><span style="white-space:pre">     </span>return;</div>
          <div>}</div>
          <div><br>
          </div>
          <div># Caller NAT detection</div>
          <div>route[NATDETECT] {</div>
          <div>#!ifdef WITH_NAT</div>
          <div><span style="white-space:pre">     </span>force_rport();</div>
          <div><span style="white-space:pre">     </span>if
            (nat_uac_test("19")) {</div>
          <div><span style="white-space:pre">             </span>if
            (is_method("REGISTER")) {</div>
          <div><span style="white-space:pre">                     </span>fix_nated_register();</div>
          <div><span style="white-space:pre">             </span>} else {</div>
          <div><span style="white-space:pre">                     </span>if(is_first_hop())</div>
          <div><span style="white-space:pre">                             </span>set_contact_alias();</div>
          <div><span style="white-space:pre">             </span>}</div>
          <div><span style="white-space:pre">             </span>setflag(FLT_NATS);</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div>#!endif</div>
          <div><span style="white-space:pre">     </span>return;</div>
          <div>}</div>
          <div><br>
          </div>
          <div># RTPProxy control</div>
          <div>route[NATMANAGE] {</div>
          <div>#!ifdef WITH_NAT</div>
          <div><span style="white-space:pre">     </span>if (is_request()) {</div>
          <div><span style="white-space:pre">             </span>if(has_totag()) {</div>
          <div><span style="white-space:pre">                     </span>if(check_route_param("nat=yes"))
            {</div>
          <div><span style="white-space:pre">                             </span>setbflag(FLB_NATB);</div>
          <div><span style="white-space:pre">                     </span>}</div>
          <div><span style="white-space:pre">             </span>}</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div><span style="white-space:pre">     </span>if
            (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB)))</div>
          <div><span style="white-space:pre">             </span>return;</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span>rtpproxy_manage("co");</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span>if (is_request()) {</div>
          <div><span style="white-space:pre">             </span>if (!has_totag())
            {</div>
          <div><span style="white-space:pre">                     </span>if(t_is_branch_route())
            {</div>
          <div><span style="white-space:pre">                             </span>add_rr_param(";nat=yes");</div>
          <div><span style="white-space:pre">                     </span>}</div>
          <div><span style="white-space:pre">             </span>}</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div><span style="white-space:pre">     </span>if (is_reply()) {</div>
          <div><span style="white-space:pre">             </span>if(isbflagset(FLB_NATB))
            {</div>
          <div><span style="white-space:pre">                     </span>set_contact_alias();</div>
          <div><span style="white-space:pre">             </span>}</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div>#!endif</div>
          <div><span style="white-space:pre">     </span>return;</div>
          <div>}</div>
          <div><br>
          </div>
          <div># URI update for dialog requests</div>
          <div>route[DLGURI] {</div>
          <div>#!ifdef WITH_NAT</div>
          <div><span style="white-space:pre">     </span>if(!isdsturiset())
            {</div>
          <div><span style="white-space:pre">             </span>handle_ruri_alias();</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div>#!endif</div>
          <div><span style="white-space:pre">     </span>return;</div>
          <div>}</div>
          <div><br>
          </div>
          <div># Routing to foreign domains</div>
          <div>route[SIPOUT] {</div>
          <div><span style="white-space:pre">     </span>if (uri==myself)
            return;</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span>append_hf("P-hint:
            outbound\r\n");</div>
          <div><span style="white-space:pre">     </span>route(RELAY);</div>
          <div><span style="white-space:pre">     </span>exit;</div>
          <div>}</div>
          <div><br>
          </div>
          <div># Manage outgoing branches</div>
          <div>branch_route[MANAGE_BRANCH] {</div>
          <div><span style="white-space:pre">     </span>xdbg("new branch
            [$T_branch_idx] to $ru\n");</div>
          <div><span style="white-space:pre">     </span>route(NATMANAGE);</div>
          <div>}</div>
          <div><br>
          </div>
          <div># Manage incoming replies</div>
          <div>onreply_route[MANAGE_REPLY] {</div>
          <div><span style="white-space:pre">     </span>xdbg("incoming
            reply\n");</div>
          <div><span style="white-space:pre">     </span>if(status=~"[12][0-9][0-9]")</div>
          <div><span style="white-space:pre">             </span>route(NATMANAGE);</div>
          <div>}</div>
          <div><br>
          </div>
          <div># Manage failure routing cases</div>
          <div>failure_route[MANAGE_FAILURE] {</div>
          <div><span style="white-space:pre">     </span>route(NATMANAGE);</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">     </span>if
            (t_is_canceled()) {</div>
          <div><span style="white-space:pre">             </span>exit;</div>
          <div><span style="white-space:pre">     </span>}</div>
          <div>}</div>
        </div>
        <div><br>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - March 5-7, 2018, Berlin - <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
Kamailio World Conference - May 14-16, 2018 - <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
  </body>
</html>