<div dir="ltr"><div>Dear Kamailio'ns,<br><br>I am working on Kamailio server (V 4.1.2) with RTPproxy (1.2.1) 
integrated, in a standalone intranet infrastructure (no any connection 
with internet).<br></div><div>I dont have any NAT settings in my network set-up. even though i will not get Audio/video calls through some times. So in that concern I have installed RTPproxy, now all the audio/Video calls are fine (with some Pixelled). I have the Following Kamailio configuration script, in which it suppose to invoke RTPproxy service when the SIP clients behind NAT. But every time when i do Audio/Video calls, they are proxying through RTPproxy server only.<br>
</div><div>I analysed SIP captures of Audio/video call, i didnt found any IP/port changes in the whole SIP session and with this i assumed that there is no NAT issue in my Network.<br></div><div>But why all the Audio/Video calls are proxying through RTPproxy everytime ?<br>
</div><div><br></div><div>Is there any Wrong placement of function call in Kamailio configuration script (below) ?<br>#-----------------------------------------------------------------<br>#!ifdef WITH_NAT<br># ----- rtpproxy params -----<br>
modparam("rtpproxy", "rtpproxy_sock", "udp:<a href="http://127.0.0.1:7722">127.0.0.1:7722</a>")<br><br># ----- nathelper params -----<br>modparam("nathelper", "natping_interval", 30)<br>
modparam("nathelper", "ping_nated_only", 1)<br>modparam("nathelper", "sipping_bflag", 7)<br>modparam("nathelper", "sipping_from", "<a href="mailto:sip%3Apinger@192.168.2.52">sip:pinger@192.168.2.52</a>")<br>
modparam("nathelper", "sipping_method", "INFO")<br><br># ----- NAT_traversal -----<br>modparam("nat_traversal", "keepalive_interval", 60)<br>modparam("nat_traversal", "keepalive_method", "NOTIFY")<br>
modparam("nat_traversal", "keepalive_state_file", "/var/run/kamailio/keepalive_state")<br><br># ----- params needed for NAT traversal in other modules -----<br>modparam("nathelper|registrar", "received_avp", "$avp(RECEIVED)")<br>
modparam("usrloc", "nat_bflag", 6)<br>#!endif<br><br>#Routing Script<br># -----------------------------------------------------------------<br># Sanity Check Section<br># -----------------------------------------------------------------<br>
route {<br>        if (!mf_process_maxfwd_header("10")) {<br>                sl_send_reply("483","Too Many Hops");<br>                break;<br>        };<br>    #if (msg:len > max_len) {<br>
        if (msg:len >=  8192 ) {<br>                sl_send_reply("513", "Message too big");<br>                break;<br>        };<br><br><br># -----------------------------------------------------------------<br>
# Record Route Section<br># -----------------------------------------------------------------<br>    #if (method!="REGISTER") {<br>    if (!method=="REGISTER") {    <br>    record_route();<br>    };<br>
    if (method=="BYE" || method=="CANCEL") {<br>#    unforce_rtp_proxy();<br>    rtpproxy_answer();<br>    }<br><br># -----------------------------------------------------------------<br># Loose Route Section<br>
# -----------------------------------------------------------------<br>    if (loose_route()) {<br><br>    if ((method=="INVITE" || method=="REFER") && !has_totag()) {<br>    sl_send_reply("403", "Forbidden");<br>
    break;<br>    };<br><br>    if (method=="INVITE") {<br>    if (!proxy_authorize("192.168.2.52","subscriber")) {<br>#    proxy_challenge("","0");<br>    proxy_challenge("192.168.2.52", "0");<br>
#    break;<br>    } <br><br>    else if (!check_from()) {<br>    sl_send_reply("403", "Use From=ID");<br>    break;<br>    };<br><br>    consume_credentials();<br>    if (nat_uac_test("19")) {<br>
    setflag(6);<br>    force_rport();<br>    fix_nated_contact();<br>    };<br>    rtpproxy_offer("l");<br>    };<br>    route(1);<br>    break;<br>    };<br><br># -----------------------------------------------------------------<br>
# Call Type Processing Section<br># -----------------------------------------------------------------<br>#    if (uri!=myself) {    <br>    if (!uri==myself) {<br>    route(4);<br><br>    route(1);<br>    break;<br>    };<br>
<br>    if (method=="ACK") {<br>    route(1);<br>    break;<br>    }<br><br>    if (method=="CANCEL") {<br>    route(1);<br>    break;<br>    } <br><br>    else if (method=="INVITE") {<br>    route(3);<br>
    break;<br>    } <br>    else if (method=="REGISTER") {<br>    route(2);<br>    break;<br>    };<br><br>    lookup("aliases");<br>    if (uri!=myself) {<br>    route(4);<br><br>    route(1);<br>    break;<br>
    };<br><br>    if (!lookup("location")) {<br>    sl_send_reply("404", "User Not Found");<br>    break;<br>    };<br>    route(1);<br>    }<br><br># -----------------------------------------------------------------<br>
# Default Message Handler<br># -----------------------------------------------------------------<br>route[1] {<br>    t_on_reply("1");<br><br>    if (!t_relay()) {<br><br>    if (method=="INVITE" && isflagset(6)) {<br>
    rtpproxy_answer();;<br>    };<br><br>    sl_reply_error();<br>    };<br>    }<br><br># -----------------------------------------------------------------<br># REGISTER Message Handler<br># -----------------------------------------------------------------<br>
route[2] {<br>    if (!search("^Contact:[ ]*\*") && nat_uac_test("19")) {<br>    setflag(6);<br>    fix_nated_register();<br>    force_rport();<br>    };<br>    sl_send_reply("100", "Trying");<br>
<br>    if (!www_authorize("192.168.2.52","subscriber")) {<br>    www_challenge("192.168.2.52","0");<br>    break;<br>    };<br><br>    if (!check_to()) {<br>    sl_send_reply("401", "Unauthorized");<br>
    break;<br>    };<br><br>    consume_credentials();<br>    if (!save("location")) {<br>    sl_reply_error();<br>    };<br>    }<br><br># -----------------------------------------------------------------<br># INVITE Message Handler<br>
# -----------------------------------------------------------------<br>route[3] {<br>    if (!proxy_authorize("192.168.2.52","subscriber")) {<br>    proxy_challenge("192.168.2.52","0");<br>
    break;<br>    } <br>    else if (!check_from()) {<br>    sl_send_reply("403", "Use From=ID");<br>    break;<br>    };<br>    consume_credentials();<br>    if (nat_uac_test("19")) {<br>    setflag(6);<br>
    }<br><br>    lookup("aliases");<br>    if (uri!=myself) {<br>    route(4);<br><br>    route(1);<br>    break;<br>    };<br><br>    if (!lookup("location")) {<br>    sl_send_reply("404", "User Not Found");<br>
    break;<br>    };<br><br>    route(4);<br>    route(1);<br>    }<br><br># -----------------------------------------------------------------<br># NAT Traversal Section<br># -----------------------------------------------------------------<br>
route[4] {<br>    if (isflagset(6)) {<br>    force_rport();<br>    fix_nated_contact();<br>#    force_rtp_proxy();<br>    rtpproxy_offer();<br>    }<br>    }<br><br>onreply_route[1] {<br>    if (isflagset(6) && status=~"(180)|(183)|2[0-9][0-9]") {<br>
    if (!search("^Content-Length:[ ]*0")) {<br>#    force_rtp_proxy();<br>    rtpproxy_offer();<br>    };<br>    };<br><br>    if (nat_uac_test("1")) {<br>    fix_nated_contact();<br>    };<br>  }<br><br>
Please find the Attachment for Tcpdump based Video call Sip capture for your better Understanding.<br><br></div><div>PS: Both Kamailio and RTPproxy are running on same IP (host), i.e 192.168.2.52.<br></div><div><br></div>
<div>Please anybody help me in resolving this issue.<br><br></div><div>Any help will greatly appreciate.<br><br></div><div>Regards,<br></div><div>Ravi.<br></div></div>