Kamailio behind NAT

Martin Nyström via sr-users <[email protected]>
Newsgroups gmane.comp.voip.ser
Message-ID <AS8PR02MB7801E8B92B45FBB090113B04F601A@AS8PR02MB7801.eurprd02.prod.outlook.com>
Hello,

I am not successful in my attempts to configure my Kamailio to work behind NAT.

The flow of an incoming call is Provider (Internet) -> AWS LoadBalancer -> Kamailio -> Asterisk

Both the Kamailio and Asterisk is on the internal network. The issue I am having is that I need to add Record-Route to the traffic sent back towards the provider, but not to the Asterisk. Currently when I add the record_route() the header is sent to Asterisk which makes it reply to the Kamailio advertised external address for ACKs, BYEs etc.

I have dumbed down my Kamailio config as much as possible for this, to show what I am currently doing.


debug=2
log_stderror=yes
fork=yes
tcp_accept_no_cl=yes
onsend_route_reply=yes
pv_buffer_size=2048
enable_tls=1

listen=udp:<LOCAL_IP>:5060 advertise <EXTERNAL_DOMAIN>:5060
listen=tcp:<LOCAL_IP>:5060 advertise <EXTERNAL_DOMAIN>:5060
listen=tls:<LOCAL_IP>:5061 advertise <EXTERNAL_DOMAIN>:5061

local_rport=on

mpath="/usr/local/lib/kamailio/modules_k/:/usr/lib/x86_64-linux-gnu/kamailio/modules/"

# MODULES
loadmodule "..."

route {

                route(FROM_PROVIDER);

}


route[RELAY] {

                if(!t_relay()) {

                                sl_reply_error();

                }

                exit;

}

route[FROM_PROVIDER] {

               # The Asterisk that should not receive the external dns in the record route header
                ds_select_dst(100, 4);

                # INFO: This adds the Record-Route in all directions
                if(!has_totag()) {
                                record_route();
                }

                route(RELAY);
                exit;

}





/M

__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the sender!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.