You are nesting one problem description into another and it all does not makes any sense to me.

Anyways, what i understand is that you are trying to engage two RTP proxies in series from WAN to LAN to WAN again. So you need to create media bridge at each kamailio instance that routes RTP traffic from WAN to LAN and vice versa. This can NOT be achieved with rtp_manage(), you have to call rtp_offer() and rtp_answer() for INVITE and its replies appropriately.

Additionally, read the RTP proxy module documentation, i think there is an option to allow creation of RTP Proxy chains which will remove rtp proxy markers and allow two proxies to coexist.

Hope this helps.

On Wed, 26 Feb 2020, 22:37 Voip support, <voipexpert0@gmail.com> wrote:
Dear Community,

I have a problem with rtpproxy not changing the SDP IP in connection information in following scenario:


SIP1 -> kamailio1 + rtpproxy1 -> kamailio2 + rtpproxy2 -> SIP2

The first kamailio put SDP IP correctly (from rtpproxy) then the second kamailio does not change SDP connection information.

I think its related to SDP body which has: 

a=nortpproxy:yes 

line added by kamailio1.

So i tried to remove the a=nortpproxy:yes line from SDP before calling rtpproxy_manage.
But it looks like no difference in working - i think the SDP sent to rtpproxy is still having the line even when i removed it.

The issue is not happening when i remove kamailio1 + rtpproxy1. In that case my IP is put correctly in SDP in INVITE and in 200 OK.

In case of two kamailio with rtpproxy (kamailio1 and kamailio2) in signalling path i am getting:

rtpproxy [rtpproxy.c:2586]: force_rtp_proxy(): incorrect port 0 in reply from rtp proxy

for replies (SIP2 IP address in 200OK SDP is present instead of kamailio2 IP address).
For request INVITE i am not getting the error but the IP in SDP doesn't change.

kamailio2 config is now like below (but the attempt to remove a=nortpproxy:yes, did not work for me)

# RTPProxy control and signaling updates for NAT traversal
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; -- commented this out because sometimes rtpproxy was not used and i wanted to use it always

# added below code to remove a=nortpproxy:yes from SDP before rtpproxy_manage but its still not working 

        if( has_body("application/sdp") && (1 == sdp_get_line_startswith("$avp(nortpproxy)", "a=nortpproxy" )) ){
                sdp_remove_line_by_prefix("a=nortpproxy:yes");
                xlog("removed nortpproxy:yes from SDP");
        }

        if(nat_uac_test("8")) {
                xlog("rtpproxy CO");
                rtpproxy_manage("co","MY_PUBLIC_IP_HERE");
        } else {
                xlog("rtpproxy COR");
                rtpproxy_manage("cor"," MY_PUBLIC_IP_HERE ");
        }

        if (is_request()) {
                if (!has_totag()) {
                        if(t_is_branch_route()) {
                                add_rr_param(";nat=yes");
                        }
                }
        }
        if (is_reply()) {
                if(isbflagset(FLB_NATB)) {
                        if(is_first_hop())
                                set_contact_alias();
                }
        }

        if(isbflagset(FLB_NATB)) {
                # no connect message in a dialog involving NAT traversal
                if (is_request()) {
                        if(has_totag()) {
                                set_forward_no_connect();
                        }
                }
        }
#!endif
        return;
}

Best regards,
Tom

PS. thanks for any hints to resolve the issue.
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users