Below is my current code and my calls are just getting 100 trying -- your call is important to us even between to locally registered extension. Any guidance as to how to simplify troubleshooting this routing?<br><br><br>####### Routing Logic ########<br>

<br><br># Main SIP request routing logic<br># - processing of any incoming SIP request starts with this route<br>route {<br><br>        # per request initial checks<br>        route(REQINIT);<br><br>        # NAT detection<br>

        route(NAT);<br><br>        # handle requests within SIP dialogs<br>        route(WITHINDLG);<br><br>        ### only initial requests (no To tag)<br><br>        # CANCEL processing<br>        if (is_method(&quot;CANCEL&quot;))<br>

        {<br>                if (t_check_trans())<br>                        t_relay();<br>                exit;<br>        }<br><br>        t_check_trans();<br><br>        # authentication<br>        route(AUTH);<br><br>

        # record routing for dialog forming requests (in case they are routed)<br>        # - remove preloaded route headers<br>        remove_hf(&quot;Route&quot;);<br>        if (is_method(&quot;INVITE|SUBSCRIBE&quot;)<div id=":1y4">
)<br>
                record_route();<br><br>        # account only INVITEs<br>        if (is_method(&quot;INVITE&quot;))<br>        {<br>                setflag(FLT_ACC); # do accounting<br>        }<br><br>        # dispatch requests to foreign domains<br>

        route(SIPOUT);<br><br>        ### requests for my local domains<br><br>        # handle presence related requests<br>        route(PRESENCE);<br><br>        # handle registrations<br>        route(REGISTRAR);<br>
<br>
        if ($rU==$null)<br>        {<br>                # request with no Username in RURI<br>                sl_send_reply(&quot;484&quot;,&quot;Address Incomplete&quot;);<br>                exit;<br>        }<br><br><br>

        #!ifdef WITH_FREESWITCH<br>        # save callee ID<br>        $avp(callee) = $rU;<br>        route(FSDISPATCH);<br>        #!endif<br><br>        # user location service<br>        route(LOCATION);<br><br>        route(RELAY);<br>

}<br><br><br>route[RELAY] {<br>#!ifdef WITH_NAT<br>        if (check_route_param(&quot;nat=yes&quot;)) {<br>                setbflag(FLB_NATB);<br>        }<br>        if (isflagset(FLT_NATS) || isbflagset(FLB_NATB)) {<br>

                route(RTPPROXY);<br>        }<br>#!endif<br><br>#!ifdef WITH_CFGSAMPLES<br>        /* example how to enable some additional event routes */<br>        if (is_method(&quot;INVITE&quot;)) {<br>                #t_on_branch(&quot;BRANCH_ONE&quot;);<br>

                t_on_reply(&quot;REPLY_ONE&quot;);<br>                t_on_failure(&quot;FAIL_ONE&quot;);<br>        }<br>#!endif<br><br>        if (!t_relay()) {<br>                sl_reply_error();<br>        }<br>        exit;<br>

}<br><br># Per SIP request initial checks<br>route[REQINIT] {<br>#!ifdef WITH_ANTIFLOOD<br>        # flood dection from same IP and traffic ban for a while<br>        # be sure you exclude checking trusted peers, such as pstn gateways<br>

        # - local host excluded (e.g., loop to self)<br>        if(src_ip!=myself)<br>        {<br>                if($sht(ipban=&gt;$si)!=$null)<br>                {<br>                        # ip is already blocked<br>

                        xdbg(&quot;request from blocked IP - $rm from $fu (IP:$si:$sp)\n&quot;);<br>                        exit;<br>                }<br>                if (!pike_check_req())<br>                {<br>                        xlog(&quot;L_ALERT&quot;,&quot;ALERT: pike blocking $rm from $fu (IP:$si:$sp)\n&quot;);<br>

                        $sht(ipban=&gt;$si) = 1;<br>                        exit;<br>                }<br>        }<br>#!endif<br><br>        if (!mf_process_maxfwd_header(&quot;10&quot;)) {<br>                sl_send_reply(&quot;483&quot;,&quot;Too Many Hops&quot;);<br>

                exit;<br>        }<br><br>        if(!sanity_check(&quot;1511&quot;, &quot;7&quot;))<br>        {<br>                xlog(&quot;Malformed SIP message from $si:$sp\n&quot;);<br>                exit;<br>        }<br>

}<br><br># Handle requests within SIP dialogs<br>route[WITHINDLG] {<br>        if (has_totag()) {<br>                # sequential request withing a dialog should<br>                # take the path determined by record-routing<br>

                if (loose_route()) {<br>                        if (is_method(&quot;BYE&quot;)) {<br>                                setflag(FLT_ACC); # do accounting ...<br>                                setflag(FLT_ACCFAILED); # ... even if the transaction fails<br>

                        }<br>                        route(RELAY);<br>                } else {<br>                        if (is_method(&quot;SUBSCRIBE&quot;) &amp;&amp; uri == myself) {<br>                                # in-dialog subscribe requests<br>

                                route(PRESENCE);<br>                                exit;<br>                        }<br>                        if ( is_method(&quot;ACK&quot;) ) {<br>                                if ( t_check_trans() ) {<br>

                                        # no loose-route, but stateful ACK;<br>                                        # must be an ACK after a 487<br>                                        # or e.g. 404 from upstream server<br>

                                        t_relay();<br>                                        exit;<br>                                } else {<br>                                        # ACK without matching transaction ... ignore and discard<br>

                                        exit;<br>                                }<br>                        }<br>                        sl_send_reply(&quot;404&quot;,&quot;Not here&quot;);<br>                }<br>                exit;<br>

        }<br>}<br><br># Handle SIP registrations<br>route[REGISTRAR] {<br>        if (is_method(&quot;REGISTER&quot;))<br>        {<br>                if(isflagset(FLT_NATS))<br>                {<br>                        setbflag(FLB_NATB);<br>

                        # uncomment next line to do SIP NAT pinging<br>                        ## setbflag(FLB_NATSIPPING);<br>                }<br>                if (!save(&quot;location&quot;))<br>                        sl_reply_error();<br>

<br>                exit;<br>        }<br>}<br><br># USER location service<br>route[LOCATION] {<br><br>#!ifdef WITH_ALIASDB<br>        # search in DB-based aliases<br>        alias_db_lookup(&quot;dbaliases&quot;);<br>#!endif<br>

<br>        if (!lookup(&quot;location&quot;)) {<br>                switch ($rc) {<br>                        case -1:<br>                        case -3:<br>                                t_newtran();<br>                                t_reply(&quot;404&quot;, &quot;Not Found&quot;);<br>

                                exit;<br>                        case -2:<br>                                sl_send_reply(&quot;405&quot;, &quot;Method Not Allowed&quot;);<br>                                exit;<br>                }<br>

        }<br><br>        # when routing via usrloc, log the missed calls also<br>        if (is_method(&quot;INVITE&quot;))<br>        {<br>                setflag(FLT_ACCMISSED);<br>        }<br>}<br><br># Presence server route<br>

route[PRESENCE] {<br>        if(!is_method(&quot;PUBLISH|SUBSCRIBE&quot;))<br>                return;<br><br>#!ifdef WITH_PRESENCE<br>        if (!t_newtran())<br>        {<br>                sl_reply_error();<br>                exit;<br>

        };<br><br>        if(is_method(&quot;PUBLISH&quot;))<br>        {<br>                handle_publish();<br>                t_release();<br>        }<br>        else<br>        if( is_method(&quot;SUBSCRIBE&quot;))<br>

        {<br>                handle_subscribe();<br>                t_release();<br>        }<br>        exit;<br>#!endif<br><br>        # if presence enabled, this part will not be executed<br>        if (is_method(&quot;PUBLISH&quot;) || $rU==$null)<br>

        {<br>                sl_send_reply(&quot;404&quot;, &quot;Not here&quot;);<br>                exit;<br>        }<br>        return;<br>}<br><br># Authentication route<br>route[AUTH] {<br>#!ifdef WITH_AUTH<br>        if (is_method(&quot;REGISTER&quot;))<br>

        {<br>                # authenticate the REGISTER requests (uncomment to enable auth)<br>                if (!www_authorize(&quot;$td&quot;, &quot;subscriber&quot;))<br>                {<br>                        www_challenge(&quot;$td&quot;, &quot;0&quot;);<br>

                        exit;<br>                }<br><br>                if ($au!=$tU)<br>                {<br>                        sl_send_reply(&quot;403&quot;,&quot;Forbidden auth ID&quot;);<br>                        exit;<br>

                }<br>        } else {<br><br>#!ifdef WITH_FREESWITCH<br>        if(route(FSINBOUND))<br>                return;<br>#!endif<br><br>#!ifdef WITH_IPAUTH<br>                if(allow_source_address())<br>                {<br>

                        # source IP allowed<br>                        return;<br>                }<br>#!endif<br><br>                # authenticate if from local subscriber<br>                if (from_uri==myself)<br>                {<br>

                        if (!proxy_authorize(&quot;$fd&quot;, &quot;subscriber&quot;)) {<br>                                proxy_challenge(&quot;$fd&quot;, &quot;0&quot;);<br>                                exit;<br>                        }<br>

                        if (is_method(&quot;PUBLISH&quot;))<br>                        {<br>                                if ($au!=$tU) {<br>                                        sl_send_reply(&quot;403&quot;,&quot;Forbidden auth ID&quot;);<br>

                                        exit;<br>                                }<br>                        } else {<br>                                if ($au!=$fU) {<br>                                        sl_send_reply(&quot;403&quot;,&quot;Forbidden auth ID&quot;);<br>

                                        exit;<br>                                }<br>                        }<br><br>                        consume_credentials();<br>                        # caller authenticated<br>                } else {<br>

                        # caller is not local subscriber, then check if it calls<br>                        # a local destination, otherwise deny, not an open relay here<br>                        if (!uri==myself)<br>                        {<br>

                                sl_send_reply(&quot;403&quot;,&quot;Not relaying&quot;);<br>                                exit;<br>                        }<br>                }<br>        }<br>#!endif<br>        return;<br>

}<br><br># Caller NAT detection route<br>route[NAT] {<br>#!ifdef WITH_NAT<br>        force_rport();<br>        if (nat_uac_test(&quot;19&quot;)) {<br>                if (method==&quot;REGISTER&quot;) {<br>                        fix_nated_register();<br>

                } else {<br>                        fix_nated_contact();<br>                }<br>                setflag(FLT_NATS);<br>        }<br>#!endif<br>        return;<br>}<br><br># RTPProxy control<br>route[RTPPROXY] {<br>

#!ifdef WITH_NAT<br>        if (is_method(&quot;BYE&quot;)) {<br>                unforce_rtp_proxy();<br>        } else if (is_method(&quot;INVITE&quot;)){<br>                force_rtp_proxy();<br>        }<br>        if (!has_totag()) add_rr_param(&quot;;nat=yes&quot;);<br>

#!endif<br>        return;<br>}<br><br># Routing to foreign domains<br>route[SIPOUT] {<br>        if (!uri==myself)<br>        {<br>                append_hf(&quot;P-hint: outbound\r\n&quot;);<br>                route(RELAY);<br>

        }<br>}<br><br><br>#!ifdef WITH_FREESWITCH<br># FreeSWITCH routing blocks<br>route[FSINBOUND] {<br>        if($si== $sel(cfg_get.freeswitch.bindip)<br>                        &amp;&amp; $sp==$sel(cfg_get.freeswitch.bindport))<br>

                return 1;<br>        return -1;<br>}<br><br>route[FSDISPATCH] {<br>        if(!is_method(&quot;INVITE&quot;))<br>                return;<br>        if(route(FSINBOUND))<br>                return;<br><br>        # dial number selection<br>

        switch($rU) {<br>                case /&quot;^41$&quot;:<br>                        # 41 - voicebox menu<br>                        # allow only authenticated users<br>                        if($au==$null)<br>                        {<br>

                                sl_send_reply(&quot;403&quot;, &quot;Not allowed&quot;);<br>                                exit;<br>                        }<br>                        $rU = &quot;vm-&quot; + $au;<br>                break;<br>

                case /&quot;^441[0-9][0-9]$&quot;:<br>                        # starting with 44 folowed by 1XY - direct call to voice box<br>                        strip(2);<br>                        route(FSVBOX);<br>

                break;<br>                case /&quot;^433[01][0-9][0-9]$&quot;:<br>                        # starting with 433 folowed by (0|1)XY - conference<br>                        strip(2);<br>                break;<br>

                case /&quot;^45[0-9]+$&quot;:<br>                        strip(2);<br>                break;<br>                default:<br>                        # offline - send to voicebox<br>                        if (!registered(&quot;location&quot;))<br>

                        {<br>                                route(FSVBOX);<br>                                exit;<br>                        }<br>                        # online - do bridging<br>                        prefix(&quot;kb-&quot;);<br>

                        if(is_method(&quot;INVITE&quot;))<br>                        {<br>                                # in case of failure - re-route to FreeSWITCH VoiceMail<br>                                t_on_failure(&quot;FAIL_FSVBOX&quot;);<br>

                        }<br>        }<br>        route(FSRELAY);<br>        exit;<br>}<br><br>route[FSVBOX] {<br>        if(!($rU=~&quot;^1[0-9][0-9]+$&quot;))<br>                return;<br>        prefix(&quot;vb-&quot;);<br>

        route(FSRELAY);<br>}<br><br># Send to FreeSWITCH<br>route[FSRELAY] {<br>        $du = &quot;sip:&quot; + $sel(cfg_get.freeswitch.bindip) + &quot;:&quot;<br>                        + $sel(cfg_get.freeswitch.bindport);<br>

        if($var(newbranch)==1)<br>        {<br>                append_branch();<br>                $var(newbranch) = 0;<br>        }<br>        route(RELAY);<br>        exit;<br>}<br><br>#!endif<br><br><br>#!ifdef WITH_FREESWITCH<br>

failure_route[FAIL_FSVBOX] {<br>#!ifdef WITH_NAT<br>        if (is_method(&quot;INVITE&quot;)<br>                        &amp;&amp; (isbflagset(FLB_NATB) || isflagset(FLT_NATS))) {<br>                unforce_rtp_proxy();<br>

        }<br>#!endif<br><br>        if (t_is_canceled()) {<br>                exit;<br>        }<br><br>        if (t_check_status(&quot;486|408&quot;)) {<br>                # re-route to FreeSWITCH VoiceMail<br>                $rU = $avp(callee);<br>

                $var(newbranch) = 1;<br>                route(FSVBOX);<br>        }<br>}<br>#!endif<br><br># sample config file for dispatcher module<br><br>#!ifdef WITH_DISPATCHER<br><br>modparam(&quot;dispatcher&quot;, &quot;db_url&quot;, &quot;mysql://openser:password@localhost/openser&quot;)<br>

<br>route{<br>        if ( !mf_process_maxfwd_header(&quot;10&quot;) )<br>        {<br>                sl_send_reply(&quot;483&quot;,&quot;To Many Hops&quot;);<br>                drop();<br>        };<br><br>        ds_select_dst(&quot;1&quot;, &quot;0&quot;);<br>

<br>        forward();<br>        # t_relay();<br>}<br>#!endif</div>