On Dec 13, 2022, at 10:09 PM, Jawaid Bazyar <bazyar@gmail.com> wrote:

That is working, however, on subsequent messages in the dialog (e.g., ACK, INFO, BYE) the proxy tries the failed destination for each message. Eventually it gets to the right place, but, is there a way to delete the failed destination from the XAVP so this doesn't happen? Or just to force subsequent messages in the transaction to use the same (working) destination?

Sorry for all the questions, I'm a newbie!

Not at all!

Forcing subsequent in-dialog messages to go to the same destination is inherent to correct proxy behaviour; it just requires some additional logic that is part of typical Kamailio boilerplate. (You can only get away with having a 'minimalistic' config for so long. :)

Check this out:

https://github.com/kamailio/kamailio/blob/master/etc/kamailio.cfg#L658-L698

You'll want to put that near the top of your config, well before you handle any initial INVITEs. 

A simplified version that will work for your purposes:

    if(has_totag()) {
        if(loose_route()) {
            if(!t_relay()) 
                sl_reply_error();

            exit;
        } else if(is_method("ACK")) {
            if(t_check_trans()) {
                if(!t_relay())
                    sl_reply_error();
                
                exit;
            }

            exit;
        }

        sl_send_reply("404", "Not here");
    }
        

-- Alex

-- 
Alex Balashov | Principal | Evariste Systems LLC

Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/