<div>Hi,</div>
<div> </div>
<div>I&#39;ve configured OpenSIPs with FreeRadius, the version for OpenSIPs I&#39;m using is 1.6.1 and FreeRadius verison is update 2 date. When I register 2 sofphone, they got authenticated and authorized by radius and got registered sucessfully. Even I made calls between two softphone sucessfully(Can hear one another). The UAS configured on different network means hosted with public IP and my softphones are registered other and NATed network. I mapped a DID on UAS and mapped it on my one of my softphone. The problem I&#39;m facing is when call coming from DID and ring my phone the caller can hear me but I can&#39;t hear the caller(one way calling issue). But not facing the problem on when calling between to sip clients and also calling from OpenSIPs to Asterisk. The configuration and cases for OpenSIPs is listed down below;</div>

<div> </div>
<div> </div>
<div>UAC--------------&gt; UAS(OpenSIPs) ---------------------&gt; UAC                                        two way voice is establised</div>
<div>
<div>UAC--------------&gt; UAS(OpenSIPs) ---------------------&gt; Asterisk --------------------&gt; UAC    two way voice is establised</div>
<div>PSTN--------------&gt; UAS(OpenSIPs) ---------------------&gt; UAC                                      one way voice is establised</div></div>
<div>(hears the dest voice)                                (can&#39;t hear caller voice)</div>
<div> </div>
<div> </div>
<div>#loadmodule &quot;auth_diameter.so&quot;<br>loadmodule &quot;aaa_radius.so&quot; <br>loadmodule &quot;auth_aaa.so&quot;<br>loadmodule &quot;permissions.so&quot;<br>loadmodule &quot;nathelper.so&quot;<br>#--------------------------------Settings For Radius-------------------------------------<br>
#modparam(&quot;auth_diameter&quot;, &quot;diameter_client_host&quot;, &quot;localhost&quot;)<br>modparam(&quot;aaa_radius&quot;, &quot;radius_config&quot;,&quot;/usr/etc/radiusclient-ng/radiusclient.conf&quot;)<br>modparam(&quot;acc&quot;, &quot;aaa_url&quot;, &quot;radius:/usr/etc/radiusclient-ng/radiusclient.conf&quot;)<br>
modparam(&quot;acc&quot;, &quot;aaa_flag&quot;, 2)<br>modparam(&quot;acc&quot;, &quot;aaa_missed_flag&quot;, 3)<br>modparam(&quot;acc&quot;, &quot;aaa_extra&quot;, &quot;User-Name=$Au; \<br>    Calling-Station-Id=$from; \<br>
    Called-Station-Id=$to; \<br>    Sip-Translated-Request-URI=$ruri; \<br>    Sip-RPid=$avp(s:rpid); \<br>    Source-IP=$si; \<br>    Source-Port=$sp; \<br>    Canonical-URI=$avp(s:can_uri); \<br>    Billing-Party=$avp(s:billing_party); \<br>
    Divert-Reason=$avp(s:divert_reason); \<br>    X-RTP-Stat=$hdr(X-RTP-Stat); \<br>    Contact=$hdr(contact); \<br>    Event=$hdr(event); \<br>    SIP-Proxy-IP=$avp(s:sip_proxy_ip); \<br>    ENUM-TLD=$avp(s:enum_tld)&quot;)<br>
modparam(&quot;auth_aaa&quot;,&quot;aaa_url&quot;,&quot;radius:/usr/etc/radiusclient-ng/radiusclient.conf&quot;)<br>modparam(&quot;auth&quot;, &quot;rpid_prefix&quot;, &quot;&lt;sip:&quot;) <br>modparam(&quot;auth&quot;, &quot;rpid_suffix&quot;, &quot;@<a href="http://11.22.33.44">11.22.33.44</a>&gt;;screen=yes;privacy=off&quot;)<br>
modparam(&quot;auth&quot;, &quot;rpid_avp&quot;, &quot;$avp(s:rpid)&quot;)<br>#modparam(&quot;uri&quot;,&quot;service_type&quot;,10)<br># ----------------- setting module-specific parameters ---------------<br>modparam(&quot;dispatcher&quot;, &quot;db_url&quot;, &quot;mysql://opensips:opensipsrw@localhost/opensips&quot;)<br>
modparam(&quot;permissions&quot;, &quot;db_url&quot;, &quot;mysql://opensips:opensipsrw@localhost/opensips&quot;)<br>#----------------- setting NAT module parameters ---------------------<br>modparam(&quot;nathelper&quot;,&quot;ping_nated_only&quot;,1)<br>
modparam(&quot;nathelper&quot;, &quot;natping_interval&quot;, 30)<br>modparam(&quot;nathelper&quot;,&quot;natping_processes&quot;,1)<br>#modparam(&quot;nathelper&quot;,&quot;rtpproxy_sock&quot;,&quot;udp:<a href="http://127.0.0.1:7890">127.0.0.1:7890</a>&quot;)<br>
modparam(&quot;nathelper&quot;,&quot;rtpproxy_sock&quot;,&quot; &quot;)<br>modparam(&quot;nathelper&quot;,&quot;received_avp&quot;,&quot;$avp(i:42)&quot;)<br>#modparam(&quot;nathelper&quot;, &quot;sipping_bflag&quot;, 7)<br>
modparam(&quot;usrloc&quot;, &quot;nat_bflag&quot;, 6)<br>####### Routing Logic ########</div>
<div># main request routing logic<br>route{<br> if (!mf_process_maxfwd_header(&quot;10&quot;)) {<br>  sl_send_reply(&quot;483&quot;,&quot;Too Many Hops&quot;);<br>  exit;<br> }<br> <br> #NAT detection<br> log(&quot;######################################### Go to Route 3 for NAT Detection #####################################&quot;); <br>
 route(3);<br> if (has_totag()) {<br>  # sequential request withing a dialog should<br>  # take the path determined by record-routing<br>  if (loose_route()) {<br>   if (is_method(&quot;BYE&quot;)) {<br>    setflag(1); # do accounting ...<br>
    setflag(3); # ... even if the transaction fails<br>   } else if (is_method(&quot;INVITE&quot;)) {<br>    # even if in most of the cases is useless, do RR for<br>    # re-INVITEs alos, as some buggy clients do change route set<br>
    # during the dialog.<br>    record_route();<br>   }<br>   # route it out to whatever destination was set by loose_route()<br>   # in $du (destination URI).<br>   route(1);<br>  } else {<br>   if ( is_method(&quot;ACK&quot;) ) {<br>
    if ( t_check_trans() ) {<br>     # non loose-route, but stateful ACK; must be an ACK after <br>     # a 487 or e.g. 404 from upstream server<br>     t_relay();<br>     exit;<br>    } else {<br>     # ACK without matching transaction -&gt;<br>
     # ignore and discard<br>     exit;<br>    }<br>   }<br>   sl_send_reply(&quot;404&quot;,&quot;Not here&quot;);<br>  }<br>  exit;<br> }<br> #initial requests<br> # CANCEL processing<br> if (is_method(&quot;CANCEL&quot;))<br>
 {<br>  if (t_check_trans())<br>   t_relay();<br>  exit;<br> }<br> t_check_trans();<br></div>
<div> if (loose_route()) {<br>  xlog(&quot;L_ERR&quot;,<br>  &quot;Attempt to route with preloaded Route&#39;s [$fu/$tu/$ru/$ci]&quot;);<br>  if (!is_method(&quot;ACK&quot;))<br>   sl_send_reply(&quot;403&quot;,&quot;Preload Route denied&quot;);<br>
  exit;<br> }<br> # record routing<br> if (!is_method(&quot;REGISTER|MESSAGE&quot;))<br>  record_route();</div>
<div> </div>
<div> #$avp(i:27)=check_source_address(&quot;0&quot;);<br> #xlog(&quot;Check Source Address from Address TABLE : $(avp(i:27))\n&quot;);<br> $avp(s:checksrc) = check_source_address(&quot;0&quot;);<br> log(&quot;###########################################################################################\n&quot;);<br>
 xlog(&quot;Check Source Address from Address TABLE Where Value 1 is Equal to True: $(avp(s:checksrc))\n&quot;);<br> log(&quot;###########################################################################################\n&quot;);<br>
        # account only INVITEs<br>        #if (is_method(&quot;INVITE&quot;)){<br> # log(&quot;############################### INVITE FUNCTION 1 ###################################&quot;);<br> # setflag(1); # do accounting<br>
 #}</div>
<div><br> xlog(&quot;incoming from $si : $sp \n&quot;);<br> if (check_source_address(&quot;0&quot;)) {<br>         if (is_method(&quot;INVITE&quot;)){</div>
<div>             if(uri=~&quot;^sip:1234567@&quot;){</div>
<div>                </div>
<div>                  rewriteuser(&quot;4004&quot;); # my phone DN<br>                 log(&quot;#################### INVITE FUNCTION 1 ####################&quot;);<br>                 setflag(1); # do accounting</div>
<div>           }<br>         }<br> }<br> <br> <br> if (!uri==myself)<br> ## replace with following line if multi-domain support is used<br> ##if (!is_uri_host_local())<br> {<br>  append_hf(&quot;P-hint: outbound\r\n&quot;); <br>
  # if you have some interdomain connections via TLS<br>  ##if($rd==&quot;<a href="http://tls_domain1.net">tls_domain1.net</a>&quot;) {<br>  ## t_relay(&quot;tls:<a href="http://domain1.net">domain1.net</a>&quot;);<br>  ## exit;<br>
  ##} else if($rd==&quot;<a href="http://tls_domain2.net">tls_domain2.net</a>&quot;) {<br>  ## t_relay(&quot;tls:<a href="http://domain2.net">domain2.net</a>&quot;);<br>  ## exit;<br>  ##}<br>  route(1);<br> }<br> if(uri==myself)<br>
 {<br>  log(&quot;########################################### URI == MYSELF  ########################################&quot;);<br>  if(method==&quot;REGISTER&quot;)<br>  {<br>   route(2);<br>  }<br>  <br>  append_hf(&quot;P-hint: usrloc applied\r\n&quot;); <br>
 }<br> # requests for my domain<br> ## uncomment this if you want to enable presence server <br> ##   and comment the next &#39;if&#39; block<br> ##   NOTE: uncomment also the definition of route[2] from  below<br> ##if( is_method(&quot;PUBLISH|SUBSCRIBE&quot;))<br>
 ##  route(2);<br> if (is_method(&quot;PUBLISH&quot;))<br> {<br>  sl_send_reply(&quot;503&quot;, &quot;Service Unavailable&quot;);<br>  exit;<br> }<br> <br> if (is_method(&quot;REGISTER&quot;))<br> {<br>  route(2);<br> }<br>
 if ($rU==NULL) {<br>  # request with no Username in RURI<br>  sl_send_reply(&quot;484&quot;,&quot;Address Incomplete&quot;);<br>  exit;<br> }<br> # apply DB based aliases (uncomment to enable)<br> ##alias_db_lookup(&quot;dbaliases&quot;);<br>
 # do lookup with method filtering<br> if (!lookup(&quot;location&quot;,&quot;m&quot;)) {<br>  switch ($retcode) {<br>   case -1:<br>    log(&quot;############################# LOOKUP LOCATION FLAG -1 PASS #################################&quot;);<br>
    #ds_select_dst(&quot;1&quot;,&quot;4&quot;);<br>    log(&quot;############################# DO ACCOUNTING ON RADIUS ######################################&quot;); <br>    setflag(2);<br>    log(&quot;############################# SEND CALL TO ASTERISK  #######################################&quot;);<br>
    rewritehostport(&quot;<a href="http://11.22.33.45:5060">11.22.33.45:5060</a>&quot;);<br>    #forward();<br>    log(&quot;############################# CALL IS GOING IN STATEFULL MANNER ############################&quot;);<br>
    t_relay();<br>    log(&quot;############################# CALL ROUTING TO ROUTE 1 ######################################&quot;); <br>    route(1);<br>    exit;<br>   case -3:<br>    log(&quot;############################ LOOKUP LOCATION FLAG -3 PASS #################################&quot;);<br>
    t_newtran();<br>    t_reply(&quot;404&quot;, &quot;Not Found&quot;);<br>    exit;<br>   case -2:<br>    log(&quot;############################ LOOKUP LOCATION FLAG -2 PASS #################################&quot;);<br>
    sl_send_reply(&quot;405&quot;, &quot;Method Not Allowed&quot;);<br>    exit;<br>  }<br> }<br> # when routing via usrloc, log the missed calls also<br> setflag(2);<br> <br> log(&quot;############################# LOOKUP LOCATION FLAG 1 PASS ########################################&quot;);<br>
 route(1);<br>}</div>
<div>route[1] {<br> # for INVITEs enable some additional helper routes<br> #if (is_method(&quot;INVITE&quot;) &amp;&amp; check_source_address(&quot;0&quot;)) {<br> if (is_method(&quot;INVITE&quot;)) {<br>  log(&quot;################################ INVITE ROUTE 1 Function ##################################&quot;);<br>
  t_on_branch(&quot;2&quot;);<br>  t_on_reply(&quot;2&quot;);<br>  t_on_failure(&quot;1&quot;);<br>  #ds_select_dst(&quot;1&quot;,&quot;4&quot;);<br>  #forward();<br> }<br> if (subst_uri(&#39;/(sip:.*);nat=yes/\1/&#39;)){<br>
  log(&quot;################################  IF SUBSTR CONTAINS NAT=YES ################################&quot;);<br>  setbflag(6);<br> };<br> if (isflagset(5)||isbflagset(6)) {<br>                log(&quot;################################  CHECK FLAGSET AND ROUTE TO 4 ###############################&quot;);<br>
  route(4);<br> }<br> if (!t_relay()) {<br>  sl_reply_error();<br> };<br> exit;<br>}</div>
<div> </div>
<div>route[2]<br>{<br></div>
<div> log(&quot;######################################## AAA-REGISTRATION #######################################&quot;);<br> if (!aaa_www_authorize(&quot;11.22.33.44&quot;))<br>        {<br>  www_challenge(&quot;11.22.33.44&quot;, &quot;1&quot;);<br>
                 return;<br>                #    #exit;<br>        }<br> #else<br> #{<br> # t_reply(&quot;405&quot;,&quot;UnAuhorized&quot;);<br> # exit();<br>  #}<br>        if(isflagset(5))<br>        {<br>                log(&quot;###################################  IF FLAG SET IS 5 ##################################&quot;);<br>
                # set branch flag -- when someone will call this user<br>                # the INVITE will have branch flag 6 set after lookup(&quot;location&quot;)<br>                setbflag(6);<br>                # if you want OPTIONS natpings uncomment next<br>
                # setbflag(7);<br>        }</div>
<div> if (!save(&quot;location&quot;))<br>  sl_reply_error();<br>                <br>        exit;<br>}<br>route[3]<br>{<br>        log(&quot;################################ FUNCTION ROUTE 3 NAT DETECTION  ################################&quot;);<br>
 force_rport();<br> if (nat_uac_test(&quot;19&quot;)) {<br>  if (method==&quot;REGISTER&quot;) {<br>   fix_nated_register();<br>  } else {<br>   fix_nated_contact();<br>  };<br> setflag(5);<br> };<br>}<br>route[4] <br>{<br>
        log(&quot;################################ FUNCTION ROUTE 4 RTP PROXY  ################################&quot;);<br> if (is_method(&quot;BYE&quot;)) {<br>  unforce_rtp_proxy();<br> } else if (is_method(&quot;INVITE&quot;)){<br>
  force_rtp_proxy();<br>  #t_on_failure(&quot;2&quot;);<br>  t_on_failure(&quot;3&quot;);<br> };<br> if (isflagset(5))<br>  search_append(&#39;Contact:.*sip:[^&gt;[:cntrl:]]*&#39;, &#39;;nat=yes&#39;);<br> #t_on_reply(&quot;1&quot;);<br>
 t_on_reply(&quot;3&quot;);<br>}</div>
<div> </div>
<div>branch_route[2] {<br> xlog(&quot;new branch at $ru\n&quot;);<br>}</div>
<div>onreply_route[2] {<br> xlog(&quot;incoming reply\n&quot;);<br>}</div>
<div>failure_route[1] {<br> if (t_was_cancelled()) {<br>  exit;<br> }<br> # uncomment the following lines if you want to block client <br> # redirect based on 3xx replies.<br> ##if (t_check_status(&quot;3[0-9][0-9]&quot;)) {<br>
 ##t_reply(&quot;404&quot;,&quot;Not found&quot;);<br> ## exit;<br> ##}<br> # uncomment the following lines if you want to redirect the failed <br> # calls to a different new destination<br> ##if (t_check_status(&quot;486|408&quot;)) {<br>
 ## sethostport(&quot;<a href="http://192.168.2.100:5060">192.168.2.100:5060</a>&quot;);<br> ## # do not set the missed call flag again<br> ## t_relay();<br> ##}<br>}<br>failure_route[3] {<br>        log(&quot;################################ FAILURE ROUTE 3 FUNCTION  ################################&quot;);<br>
 if (isbflagset(6) || isflagset(5)) {<br>  unforce_rtp_proxy();<br> }<br>}<br>onreply_route[3] {<br>        log(&quot;################################ ONREPLY ROUTE 3 FUNCTION  ################################&quot;);<br>
 <br> if ((isflagset(5) || isbflagset(6)) &amp;&amp; status=~&quot;(183)|(2[0-9][0-9])&quot;) {<br>  force_rtp_proxy();<br> }<br> search_append(&#39;Contact:.*sip:[^&gt;[:cntrl:]]*&#39;, &#39;;nat=yes&#39;);<br> if (isbflagset(6)) {<br>
  fix_nated_contact();<br> }<br> exit;<br>}  <br clear="all"></div>
<div> </div>
<div> </div>
<div>Kindly help me out with this problem, in which other section Natting is required?(or am I missing something in the configuration?)  Please assist me on it.<br></div>
<div>-- <br>Regards,<br><br>Ahmed Munir<br><br><br></div>