Finally it's working:
#!define ASTERISK_LAN1 2.2.2.0/24 # End second LAN for PBXs - tunneling with LAN1 over OpenVPN: #!define ASTERISK_LAN2 3.3.3.0.0/24
rtpproxy in bridge mode.
And route[NATMANAGE] from Asipto tutorial ( http://kb.asipto.com/asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb) changed for my needs :
# RTPProxy control route[NATMANAGE] { #!ifdef WITH_NAT if (is_request()) { if(has_totag()) { if(check_route_param("nat=yes")) { setbflag(FLB_NATB); } } } if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB))) return;
if((src_ip==ASTERISK_LAN1) || (src_ip==ASTERISK_LAN2)) { rtpproxy_manage("cwei"); } else { rtpproxy_manage("cwie"); }
if (is_request()) { if (!has_totag()) { add_rr_param(";nat=yes"); } } if (is_reply()) { if(isbflagset(FLB_NATB)) { fix_nated_contact(); } } #!endif return; }
Tested and worked on both tested Asterisk (LAN1 and LAN2). Kamailio just one - in the LAN1.