Hello,
I need assistance with my kamailio, RTPEngine and Freeswitch implementation
with WEBRTC. I am using a cloud instance with a private IP and a 1:1 NAT
Public IP. I have setup the internal and external RTPEngine config
interface = internal/192.168.xx.xx;external/ 192.168.xx.xx!8X.XXX.XXX.XXX
For my normal SIP to SIP implementation, my SIP signaling and RTP traffic
goes fine and I get to have two way audio. but for Webrtc in the SDP reply
to my public webrtc client, I get to see the private IP in the client
response if I force ICE, thus causing no audio negotiation since the public
IP can't reach the private IP.
I have been troubleshooting this, I am beginning to think I am doing it
wrong. Please has anyone implemented this or something similar. I need to
make this work and I have limited time.
Could I also get the best method for detecting WebRTC reply and response in
order to set the right RTPmanage flags as this is also a major issue. Below
is a snippet of my config.

route[SET_DIRECTION_FLAG] {

    if (is_in_subnet("$si", "192.168.0.0/16")) {

        if ($proto == "WS" || $proto == "WSS" || $ru =~
"transport=(ws|wss)") {
            xlog("L_INFO", "[DIR] CORE → WEBRTC | src=$si proto=$proto
ru=$ru\n");
            setflag(FLB_FROM_CORE_TO_WEBRTC);
            return;
        }

        xlog("L_INFO", "[DIR] CORE → SIP | src=$si proto=$proto ru=$ru\n");
        setflag(FLB_FROM_CORE_TO_SIP);
        return;
    }

    else {

        # Public → WebRTC
        if ($proto == "WS" || $proto == "WSS") {
            xlog("L_INFO", "[DIR] PUBLIC → WEBRTC | src=$si proto=$proto
ru=$ru\n");
            setflag(FLB_FROM_PUBLIC_FROM_WEBRTC);
            return;
        }

        # Public → SIP
        xlog("L_INFO", "[DIR] PUBLIC → SIP | src=$si proto=$proto
ru=$ru\n");
        setflag(FLB_FROM_PUBLIC_FROM_SIP);
        return;
    }
}

route[SET_RTP_REQUEST] {
        if (!is_method("UPDATE|INVITE"))   {
                return 0;
        }

        if (sdp_content()) {
                $avp(originalSDP) = $rb;
                if(isflagset(FLB_FROM_PUBLIC_FROM_WEBRTC)) {
                        xlog("L_INFO", "SET_RTP_REQUEST | FROM PUBLIC FROM
WEBRTC");
                        rtpengine_manage("replace-origin
replace-session-connection RTP/AVP ICE=remove direction=external
direction=internal");
                }
                if(isflagset(FLB_FROM_PUBLIC_FROM_SIP)) {
                        xlog("L_INFO", "SET_RTP_REQUEST | FROM PUBLIC FROM
SIP");
                        rtpengine_manage("replace-origin
replace-session-connection RTP/AVP ICE=remove direction=external
direction=internal");
                }
                if(isflagset(FLB_FROM_CORE_TO_WEBRTC)) {
                        xlog("L_INFO", "SET_RTP_REQUEST | FROM CORE TO
WEBRTC");
                        rtpengine_manage("replace-origin
replace-session-connection RTP/SAVPF ICE=force direction=internal
direction=external");
                }
                if(isflagset(FLB_FROM_CORE_TO_SIP)) {
                        xlog("L_INFO", "SET_RTP_REQUEST | FROM CORE TO
SIP");
                        rtpengine_manage("replace-origin
replace-session-connection RTP/AVP ICE=remove direction=internal
direction=external");
                }
                set_body("$avp(modifiedSDP)","application/sdp");
        }
}

route[SET_RTP_REPLY] {
        xlog("L_INFO", "SET_RTP_REPLY | ENTERING THE ROUTE BLOCK");

        if (sdp_content()) {
                $avp(originalSDP) = $rb;
                if(isflagset(FLB_FROM_PUBLIC_FROM_WEBRTC)) {
                        xlog("L_INFO", "SET_RTP_REPLY | FROM PUBLIC FROM
WEBRTC");
                        rtpengine_manage("replace-origin
replace-session-connection RTP/AVP ICE=remove direction=external
direction=internal");
                }
                if(isflagset(FLB_FROM_PUBLIC_FROM_SIP)) {
                        xlog("L_INFO", "SET_RTP_REPLY | FROM PUBLIC FROM
SIP");
                        rtpengine_manage("replace-origin
replace-session-connection RTP/AVP ICE=remove direction=external
direction=internal");
                }
                if(isflagset(FLB_FROM_CORE_TO_WEBRTC)) {
                        xlog("L_INFO", "SET_RTP_REPLY | FROM CORE TO
WEBRTC");
                        rtpengine_manage("replace-origin
replace-session-connection RTP/SAVPF ICE=remove direction=internal
direction=external");
                }
                if(isflagset(FLB_FROM_CORE_TO_SIP)) {
                        xlog("L_INFO", "SET_RTP_REPLY | FROM CORE TO SIP");
                        rtpengine_manage("replace-origin
replace-session-connection RTP/AVP direction=internal direction=external");
                }
                set_body("$avp(modifiedSDP)","application/sdp");
        }

        if ($rs=~"[3-6][0-9][0-9]") {
                rtpengine_manage();
        }
}
__________________________________________________________
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!

Reply via email to