<div dir="ltr"><div>Hi All,<br><br></div>I am using kamailio 3.1.5. I am trying to send the PRACK message but it sends back 404 Not Here. I am new to using this. I am adding details in the configuration file below: I guess route[WITHINDLG]<br><br>####### Defined Values #########<br><br># *** Value defines - IDs used later in config<br>#!ifdef WITH_MYSQL<br># - database URL - used to connect to database server by modules such<br>#       as: auth_db, acc, usrloc, a.s.o.<br>#!define DBURL "mysql://openser:openserrw@localhost/openser"<br>#!endif<br>#!ifdef WITH_MULTIDOMAIN<br># - the value for 'use_domain' parameters<br>#!define MULTIDOMAIN 1<br>#!else<br>#!define MULTIDOMAIN 0<br>#!endif<br><br># - flags<br>#   FLT_ - per transaction (message) flags<br>#    FLB_ - per branch flags<br>#!define FLT_ACC 1<br>#!define FLT_ACCMISSED 2<br>#!define FLT_ACCFAILED 3<br>#!define FLT_NATS 5<br><br>#!define FLB_NATB 6<br>#!define FLB_NATSIPPING 7<br><br>####### Global Parameters #########<br><br>#!ifdef WITH_DEBUG<br>debug=4<br>log_stderror=yes<br>#!else<br>debug=2<br>log_stderror=no<br>#!endif<br><br>memdbg=5<br>memlog=5<br><br>log_facility=LOG_LOCAL0<br><br>fork=yes<br>children=4<br><br>/* uncomment the next line to disable TCP (default on) */<br>#disable_tcp=yes<br><br>/* uncomment the next line to disable the auto discovery of local aliases<br>   based on reverse DNS on IPs (default on) */<br>#auto_aliases=no<br><br>/* add local domain aliases */<br>#alias="<a href="http://sip.mydomain.com">sip.mydomain.com</a>"<br><br>/* uncomment and configure the following line if you want Kamailio to <br>   bind on a specific interface/port/proto (default bind on all available) */<br>#listen=udp:<a href="http://10.0.0.10:5060">10.0.0.10:5060</a><br><br>/* port to listen to<br> * - can be specified more than once if needed to listen on many ports */<br>port=5060<br><br>#!ifdef WITH_TLS<br>enable_tls=yes<br>#!endif<br><br>####### Custom Parameters #########<br><br># These parameters can be modified runtime via RPC interface<br># - see the documentation of 'cfg_rpc' module.<br>#<br># Format: <a href="http://group.id">group.id</a> = value 'desc' description<br># Access: $sel(<a href="http://cfg_get.group.id">cfg_get.group.id</a>) or @<a href="http://cfg_get.group.id">cfg_get.group.id</a><br>#<br><br>#!ifdef WITH_PSTN<br># PSTN GW Routing<br>#<br># - pstn.gw_ip: valid IP or hostname as string value, example:<br># pstn.gw_ip = "10.0.0.101" desc "My PSTN GW Address"<br>#<br># - by default is empty to avoid misrouting<br>pstn.gw_ip = "" desc "PSTN GW Address"<br>#!endif<br><br><br>####### Modules Section ########<br><br># set paths to location of modules<br>#!ifdef LOCAL_TEST_RUN<br>mpath="modules_k:modules"<br>#!else<br>mpath="/usr/lib/kamailio/modules_k/:/usr/lib/kamailio/modules/"<br>#!endif<br><br>#!ifdef WITH_MYSQL<br>loadmodule "db_mysql.so"<br>#!endif<br><br>loadmodule "mi_fifo.so"<br>loadmodule "kex.so"<br>loadmodule "tm.so"<br>loadmodule "tmx.so"<br>loadmodule "sl.so"<br>loadmodule "rr.so"<br>loadmodule "pv.so"<br>loadmodule "maxfwd.so"<br>loadmodule "usrloc.so"<br>loadmodule "registrar.so"<br>loadmodule "textops.so"<br>loadmodule "siputils.so"<br>loadmodule "xlog.so"<br>loadmodule "sanity.so"<br>loadmodule "ctl.so"<br>loadmodule "mi_rpc.so"<br>loadmodule "acc.so"<br><br>#!ifdef WITH_AUTH<br>loadmodule "auth.so"<br>loadmodule "auth_db.so"<br>#!ifdef WITH_IPAUTH<br>loadmodule "permissions.so"<br>#!endif<br>#!endif<br><br>#!ifdef WITH_ALIASDB<br>loadmodule "alias_db.so"<br>#!endif<br><br>#!ifdef WITH_MULTIDOMAIN<br>loadmodule "domain.so"<br>#!endif<br><br>#!ifdef WITH_PRESENCE<br>loadmodule "presence.so"<br>loadmodule "presence_xml.so"<br>#!endif<br><br>#!ifdef WITH_NAT<br>loadmodule "nathelper.so"<br>loadmodule "rtpproxy.so"<br>#!endif<br><br>#!ifdef WITH_TLS<br>loadmodule "tls.so"<br>#!endif<br><br>#!ifdef WITH_ANTIFLOOD<br>loadmodule "htable.so"<br>loadmodule "pike.so"<br>#!endif<br><br>#!ifdef WITH_XMLRPC<br>loadmodule "xmlrpc.so"<br>#!endif<br><br># ----------------- setting module-specific parameters ---------------<br><br><br># ----- mi_fifo params -----<br>modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")<br><br><br># ----- tm params -----<br># auto-discard branches from previous serial forking leg<br>modparam("tm", "failure_reply_mode", 3)<br># default retransmission timeout: 30sec<br>modparam("tm", "fr_timer", 30000)<br># default invite retransmission timeout after 1xx: 120sec<br>modparam("tm", "fr_inv_timer", 120000)<br><br><br># ----- rr params -----<br># add value to ;lr param to cope with most of the UAs<br>modparam("rr", "enable_full_lr", 1)<br># do not append from tag to the RR (no need for this script)<br>modparam("rr", "append_fromtag", 0)<br><br><br># ----- registrar params -----<br>modparam("registrar", "method_filtering", 1)<br>/* uncomment the next line to disable parallel forking via location */<br># modparam("registrar", "append_branches", 0)<br>/* uncomment the next line not to allow more than 10 contacts per AOR */<br>#modparam("registrar", "max_contacts", 10)<br><br><br># ----- acc params -----<br>/* what special events should be accounted ? */<br>modparam("acc", "early_media", 0)<br>modparam("acc", "report_ack", 0)<br>modparam("acc", "report_cancels", 0)<br>/* by default ww do not adjust the direct of the sequential requests.<br>   if you enable this parameter, be sure the enable "append_fromtag"<br>   in "rr" module */<br>modparam("acc", "detect_direction", 0)<br>/* account triggers (flags) */<br>modparam("acc", "log_flag", FLT_ACC)<br>modparam("acc", "log_missed_flag", FLT_ACCMISSED)<br>modparam("acc", "log_extra", <br>    "src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")<br>modparam("acc", "failed_transaction_flag", FLT_ACCFAILED)<br>/* enhanced DB accounting */<br>#!ifdef WITH_ACCDB<br>modparam("acc", "db_flag", FLT_ACC)<br>modparam("acc", "db_missed_flag", FLT_ACCMISSED)<br>modparam("acc", "db_url", DBURL)<br>modparam("acc", "db_extra",<br>    "src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")<br>#!endif<br><br><br># ----- usrloc params -----<br>/* enable DB persistency for location entries */<br>#!ifdef WITH_USRLOCDB<br>modparam("usrloc", "db_url", DBURL)<br>modparam("usrloc", "db_mode", 2)<br>modparam("usrloc", "use_domain", MULTIDOMAIN)<br>#!endif<br><br><br># ----- auth_db params -----<br>#!ifdef WITH_AUTH<br>modparam("auth_db", "db_url", DBURL)<br>modparam("auth_db", "calculate_ha1", yes)<br>modparam("auth_db", "password_column", "password")<br>modparam("auth_db", "load_credentials", "")<br>modparam("auth_db", "use_domain", MULTIDOMAIN)<br><br># ----- permissions params -----<br>#!ifdef WITH_IPAUTH<br>modparam("permissions", "db_url", DBURL)<br>modparam("permissions", "db_mode", 1)<br>#!endif<br><br>#!endif<br><br><br># ----- alias_db params -----<br>#!ifdef WITH_ALIASDB<br>modparam("alias_db", "db_url", DBURL)<br>modparam("alias_db", "use_domain", MULTIDOMAIN)<br>#!endif<br><br><br># ----- domain params -----<br>#!ifdef WITH_MULTIDOMAIN<br>modparam("domain", "db_url", DBURL)<br># use caching<br>modparam("domain", "db_mode", 1)<br># register callback to match myself condition with domains list<br>modparam("domain", "register_myself", 1)<br>#!endif<br><br><br>#!ifdef WITH_PRESENCE<br># ----- presence params -----<br>modparam("presence", "db_url", DBURL)<br><br># ----- presence_xml params -----<br>modparam("presence_xml", "db_url", DBURL)<br>modparam("presence_xml", "force_active", 1)<br>#!endif<br><br><br>#!ifdef WITH_NAT<br># ----- rtpproxy params -----<br>modparam("rtpproxy", "rtpproxy_sock", "udp:<a href="http://127.0.0.1:7722">127.0.0.1:7722</a>")<br><br># ----- nathelper params -----<br>modparam("nathelper", "natping_interval", 30)<br>modparam("nathelper", "ping_nated_only", 1)<br>modparam("nathelper", "sipping_bflag", FLB_NATSIPPING)<br>modparam("nathelper", "sipping_from", "<a href="mailto:sip%3Apinger@kamailio.org">sip:pinger@kamailio.org</a>")<br><br># params needed for NAT traversal in other modules<br>modparam("nathelper|registrar", "received_avp", "$avp(RECEIVED)")<br>modparam("usrloc", "nat_bflag", FLB_NATB)<br>#!endif<br><br><br>#!ifdef WITH_TLS<br># ----- tls params -----<br>modparam("tls", "config", "/etc/kamailio/tls.cfg")<br>#!endif<br><br>#!ifdef WITH_ANTIFLOOD<br># ----- pike params -----<br>modparam("pike", "sampling_time_unit", 2)<br>modparam("pike", "reqs_density_per_unit", 16)<br>modparam("pike", "remove_latency", 4)<br><br># ----- htable params -----<br># ip ban htable with autoexpire after 5 minutes<br>modparam("htable", "htable", "ipban=>size=8;autoexpire=300;")<br>#!endif<br><br>#!ifdef WITH_XMLRPC<br># ----- xmlrpc params -----<br>modparam("xmlrpc", "route", "XMLRPC");<br>modparam("xmlrpc", "url_match", "^/RPC")<br>#!endif<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("CANCEL"))<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("Route");<br>    if (is_method("INVITE|SUBSCRIBE"))<br>        record_route();<br><br>    # account only INVITEs<br>    if (is_method("INVITE"))<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("484","Address Incomplete");<br>        exit;<br>    }<br><br>    # dispatch destinations to PSTN<br>    route(PSTN);<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("nat=yes")) {<br>        setbflag(FLB_NATB);<br>    }<br>    if (isflagset(FLT_NATS) || isbflagset(FLB_NATB)) {<br>        route(RTPPROXY);<br>    }<br>#!endif<br><br>    /* example how to enable some additional event routes */<br>    if (is_method("INVITE")) {<br>        #t_on_branch("BRANCH_ONE");<br>        t_on_reply("REPLY_ONE");<br>        t_on_failure("FAIL_ONE");<br>    }<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=>$si)!=$null)<br>        {<br>            # ip is already blocked<br>            xdbg("request from blocked IP - $rm from $fu (IP:$si:$sp)\n");<br>            exit;<br>        }<br>        if (!pike_check_req())<br>        {<br>            xlog("L_ALERT","ALERT: pike blocking $rm from $fu (IP:$si:$sp)\n");<br>            $sht(ipban=>$si) = 1;<br>            exit;<br>        }<br>    }<br>#!endif<br><br>    if (!mf_process_maxfwd_header("10")) {<br>        sl_send_reply("483","Too Many Hops");<br>        exit;<br>    }<br><br>    if(!sanity_check("1511", "7"))<br>    {<br>        xlog("Malformed SIP message from $si:$sp\n");<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("BYE")) {<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("SUBSCRIBE") && uri == myself) {<br>                # in-dialog subscribe requests<br>                route(PRESENCE);<br>                exit;<br>            }<br>            if ( is_method("ACK") ) {<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("404","Not here");<br>        }<br>        exit;<br>    }<br>}<br><br># Handle SIP registrations<br>route[REGISTRAR] {<br>    if (is_method("REGISTER"))<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("location"))<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("dbaliases");<br>#!endif<br><br>    if (!lookup("location")) {<br>        switch ($rc) {<br>            case -1:<br>            case -3:<br>                t_newtran();<br>                t_reply("404", "Not Found");<br>                exit;<br>            case -2:<br>                sl_send_reply("405", "Method Not Allowed");<br>                exit;<br>        }<br>    }<br><br>    # when routing via usrloc, log the missed calls also<br>    if (is_method("INVITE"))<br>    {<br>        setflag(FLT_ACCMISSED);<br>    }<br>}<br><br># Presence server route<br>route[PRESENCE] {<br>    if(!is_method("PUBLISH|SUBSCRIBE"))<br>        return;<br><br>#!ifdef WITH_PRESENCE<br>    if (!t_newtran())<br>    {<br>        sl_reply_error();<br>        exit;<br>    };<br><br>    if(is_method("PUBLISH"))<br>    {<br>        handle_publish();<br>        t_release();<br>    }<br>    else<br>    if( is_method("SUBSCRIBE"))<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("PUBLISH") || $rU==$null)<br>    {<br>        sl_send_reply("404", "Not here");<br>        exit;<br>    }<br>    return;<br>}<br><br># Authentication route<br>route[AUTH] {<br>#!ifdef WITH_AUTH<br>    if (is_method("REGISTER"))<br>    {<br>        # authenticate the REGISTER requests (uncomment to enable auth)<br>        if (!www_authorize("$td", "subscriber"))<br>        {<br>            www_challenge("$td", "0");<br>            exit;<br>        }<br><br>        if ($au!=$tU)<br>        {<br>            sl_send_reply("403","Forbidden auth ID");<br>            exit;<br>        }<br>    } else {<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("$fd", "subscriber")) {<br>                proxy_challenge("$fd", "0");<br>                exit;<br>            }<br>            if (is_method("PUBLISH"))<br>            {<br>                if ($au!=$tU) {<br>                    sl_send_reply("403","Forbidden auth ID");<br>                    exit;<br>                }<br>            } else {<br>                if ($au!=$fU) {<br>                    sl_send_reply("403","Forbidden auth ID");<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("403","Not relaying");<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("19")) {<br>        if (method=="REGISTER") {<br>            fix_nated_register();<br>        }<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("BYE")) {<br>        unforce_rtp_proxy();<br>    } else if (is_method("INVITE")){<br>        force_rtp_proxy();<br>    }<br>    if (!has_totag()) add_rr_param(";nat=yes");<br>#!endif<br>    return;<br>}<br><br># Routing to foreign domains<br>route[SIPOUT] {<br>    if (!uri==myself)<br>    {<br>        append_hf("P-hint: outbound\r\n");<br>        route(RELAY);<br>    }<br>}<br><br><br><br><br>}<br></div>