Hello!!<br> I m new in opensips and i m testing the load balancer cause i need it  to balance calls between  4 asterisk.For the start i make the following scenario  <br><br>      Cisco gateway inbound ------&gt; opensips ------&gt; asterisk  ---------&gt; Cisco gateway outbound<br>
 <br>when the call comes to the opensips, the load_balancer forward the call correctly to my asterisk but the call hangs up after 15 seg approximately.When i did a ngrep for the sip traffic in opensips,  i realized that cisco gateway inbound never sent the ACK for 200 OK to opensips .<br>
In the Cisco&#39;s logs i saw that the reply of 200 ok is sent directly to public ip of asterisk but never to opensips server so asterisk still waiting for the ACK from opensips. <br>In the same way opensips never receive the BYE packet and the load never decrease  when the call is hanging up.<br>
<br>  <br>        Cisco gateway          opensips        asterisk <br>                  ---invite---&gt;       <br>                  &lt;--trying----      ---invite---&gt;       <br>                                     &lt;---trying---<br>
                                     &lt;----200OK---<br>                  &lt;---200 OK---                   <br>                                      &lt;----200OK---<br>                  &lt;---200 OK---                   <br>
                                      &lt;----200OK---<br>                  &lt;---200 OK---                   <br>                                      &lt;----200OK---<br>                  &lt;---200 OK---                   <br>
                  <br>Please can somebady help me to understand  what cause that?<br><br>Best Regards!!          <br>                  <br>Configuration of Cisco AS<br><br>...<br>dial-peer voice 205 voip<br> description VoIP GWs-&gt;OPENSIPS LAB Desarrollo<br>
 preference 1<br> destination-pattern ^91112666[7-9]$<br> session protocol sipv2<br> session target dns:x$s$.$d$.<a href="http://opensips.lab.egtelecom.es">opensips.lab.egtelecom.es</a><br> dtmf-relay sip-notify rtp-nte<br>
 no vad<br>..... <br>                  <br><br>This my opensips.cfg:<br><br>debug=4<br>log_stderror=no<br>log_facility=LOG_LOCAL0<br><br>fork=yes<br>children=4<br><br>disable_dns_blacklist=yes<br>auto_aliases=no<br>port=5060<br>
<br><br>####### Modules Section ########<br><br>mpath=&quot;//lib/opensips/modules/&quot;<br><br>loadmodule &quot;db_mysql.so&quot;<br>loadmodule &quot;signaling.so&quot;<br>loadmodule &quot;auth.so&quot;<br>loadmodule &quot;auth_db.so&quot;<br>
loadmodule &quot;sl.so&quot;<br>loadmodule &quot;tm.so&quot;<br>loadmodule &quot;rr.so&quot;<br>loadmodule &quot;maxfwd.so&quot;<br>loadmodule &quot;usrloc.so&quot;<br>loadmodule &quot;registrar.so&quot;<br>loadmodule &quot;textops.so&quot;<br>
loadmodule &quot;mi_fifo.so&quot;<br>loadmodule &quot;uri.so&quot;<br>loadmodule &quot;acc.so&quot;<br>loadmodule &quot;dialog.so&quot;<br>loadmodule &quot;load_balancer.so&quot;<br>loadmodule &quot;presence.so&quot;<br>loadmodule &quot;presence_xml.so&quot;<br>
<br><br># ----------------- setting module-specific parameters ---------------<br><br><br># ----- mi_fifo params -----<br>modparam(&quot;mi_fifo&quot;, &quot;fifo_name&quot;, &quot;/tmp/opensips_fifo&quot;)<br><br><br># ----- rr params -----<br>
# add value to ;lr param to cope with most of the UAs<br>modparam(&quot;rr&quot;, &quot;enable_full_lr&quot;, 1)<br># do not append from tag to the RR (no need for this script)<br>modparam(&quot;rr&quot;, &quot;append_fromtag&quot;, 1)<br>
<br><br># ----- registrar params -----<br>/* uncomment the next line not to allow more than 10 contacts per AOR */<br>modparam(&quot;registrar&quot;, &quot;max_contacts&quot;, 10)<br><br><br># ----- usrloc params -----<br>
modparam(&quot;usrloc&quot;, &quot;db_mode&quot;,   0)<br>/* uncomment the following lines if you want to enable DB persistency<br>   for location entries */<br>modparam(&quot;usrloc&quot;, &quot;db_mode&quot;,   2)<br>modparam(&quot;usrloc&quot;, &quot;db_url&quot;,&quot;mysql://opensips:opensipsrw@localhost/opensips&quot;)<br>
<br><br># ----- uri params -----<br>modparam(&quot;uri&quot;, &quot;use_uri_table&quot;, 0)<br><br><br># ----- acc params -----<br>/* what sepcial events should be accounted ? */<br>modparam(&quot;acc&quot;, &quot;early_media&quot;, 1)<br>
modparam(&quot;acc&quot;, &quot;report_ack&quot;, 1)<br>modparam(&quot;acc&quot;, &quot;report_cancels&quot;, 1)<br>/* by default ww do not adjust the direct of the sequential requests.<br>   if you enable this parameter, be sure the enable &quot;append_fromtag&quot;<br>
   in &quot;rr&quot; module */<br>modparam(&quot;acc&quot;, &quot;detect_direction&quot;, 0)<br>/* account triggers (flags) */<br>modparam(&quot;acc&quot;, &quot;failed_transaction_flag&quot;, 3)<br>modparam(&quot;acc&quot;, &quot;log_flag&quot;, 1)<br>
modparam(&quot;acc&quot;, &quot;log_missed_flag&quot;, 2)<br>/* uncomment the following lines to enable DB accounting also */<br>modparam(&quot;acc&quot;, &quot;db_flag&quot;, 1)<br>modparam(&quot;acc&quot;, &quot;db_missed_flag&quot;, 2)<br>
<br><br># ----- auth_db params -----<br>/* uncomment the following lines if you want to enable the DB based<br>   authentication */<br>modparam(&quot;auth_db&quot;, &quot;calculate_ha1&quot;, yes)<br>modparam(&quot;auth_db&quot;, &quot;password_column&quot;, &quot;password&quot;)<br>
modparam(&quot;auth_db&quot;, &quot;db_url&quot;,&quot;mysql://opensips:opensipsrw@localhost/opensips&quot;)<br>#modparam(&quot;auth_db&quot;, &quot;load_credentials&quot;, &quot;&quot;)<br><br># ----- dialog  params -----<br>
modparam(&quot;dialog&quot;, &quot;dlg_flag&quot;, 13)<br>modparam(&quot;dialog&quot;, &quot;db_mode&quot;, 1)<br>modparam(&quot;dialog&quot;, &quot;db_url&quot;, &quot;mysql://opensips:opensipsrw@localhost/opensips&quot;)<br>
<br><br># ----- presence params -----<br>/* uncomment the following lines if you want to enable presence */<br>modparam(&quot;presence|presence_xml&quot;, &quot;db_url&quot;,&quot;mysql://opensips:opensipsrw@localhost/opensips&quot;)<br>
modparam(&quot;presence_xml&quot;, &quot;force_active&quot;, 1)<br>modparam(&quot;presence&quot;, &quot;server_address&quot;, &quot;sip:<a href="http://10.234.227.199:5060">10.234.227.199:5060</a>&quot;)<br><br># ----- load_balancer params -----<br>
modparam(&quot;load_balancer&quot;, &quot;db_url&quot;,&quot;mysql://opensips:opensipsrw@localhost/opensips&quot;)<br><br><br><br>####### Routing Logic ########<br><br><br># main request routing logic<br><br>route{<br><br>
  if (!mf_process_maxfwd_header(&quot;10&quot;)) {<br>                sl_send_reply(&quot;483&quot;,&quot;looping&quot;);<br>                exit;<br>        }<br> <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>        #####################################<br><br>        if (!has_totag()) {<br>                # initial request<br>
                record_route();<br>        } else {<br>                # sequential request -&gt; obey Route indication<br>                loose_route();<br>                t_relay();<br>                exit;<br>        }<br>
      ##******************************************************************************************## <br>       if (has_totag()) {<br><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>                       t_relay();<br>                }<br>               route(1);<br>            } else {<br>
<br>                    if ( is_method(&quot;ACK&quot;) ) {<br>                        if ( t_check_trans() ) {<br>                              # non loose-route, but stateful ACK; must be an ACK after a 487 or e.g. 404 from upstream server<br>
                              xlog(&quot;ACK !!!!!!!!!!!!!!!!!!\n&quot;);<br><br>                              t_relay();<br>                              exit;<br>                        } else {<br>                              # ACK without matching transaction ... ignore and discard.\n&quot;);<br>
                             xlog(&quot;ACK ACK ACK ACK ACK&quot;);<br><br>                               exit;<br>                               }<br>                    }<br><br>                sl_send_reply(&quot;404&quot;,&quot;Not here&quot;);<br>
                }<br>              exit;<br>    }<br><br>      ##******************************************************************************************##   <br>        # handle cancel and re-transmissions<br>        if ( is_method(&quot;CANCEL&quot;) ) {<br>
                if ( t_check_trans() )<br>                        t_relay();<br>                exit;<br>        }<br><br><br>        # from now on we have only the initial requests<br>        if (!is_method(&quot;INVITE&quot;)) {<br>
                send_reply(&quot;405&quot;,&quot;Method Not Allowed&quot;);<br>                exit;<br>        }<br><br>        # detect resources and do balancing<br>        if (method==&quot;INVITE&quot;) {<br>              load_balance(&quot;1&quot;,&quot;calls&quot;);  <br>
        }<br><br>        # LB function returns negative if no suitable destination (for requested resources) is found,<br>        # or if all destinations are full<br>        if ($retcode&lt;0) {<br>             sl_send_reply(&quot;500&quot;,&quot;Service full&quot;);<br>
             exit;<br>        }<br><br>        xlog(&quot;Selected destination is: $du\n&quot;);<br><br>        # send it out<br>        if (!t_relay()) {<br>                sl_reply_error();<br>        }<br>}<br><br>route[1] {<br>
            if (!t_relay()) {<br>                sl_reply_error();<br>            };<br>            exit;<br>            }<br><br><br>  # Presence route<br>  /* uncomment the whole following route for enabling presence<br>
  NOTE: do not forget to enable the call of this route from the main route */<br><br>   route[2] {<br>           if (!t_newtran())<br>           {<br>              sl_reply_error();<br>              exit;<br>           };<br>
<br>           if(is_method(&quot;PUBLISH&quot;))<br>           {<br>              handle_publish();<br>           }<br>           else<br>           if( is_method(&quot;SUBSCRIBE&quot;))<br>           {<br>              handle_subscribe();<br>
           }<br><br>           exit;<br>        }<br><br><br>   branch_route[2] {<br>          xlog(&quot;new branch at $ru\n&quot;);<br>        }<br><br><br>   onreply_route[2] {<br>            xlog(&quot;incoming reply\n&quot;);<br>
        }<br><br><br>   failure_route[1] {<br>          if (t_was_cancelled()) {<br>                  exit;<br>                  }<br>        }                  <br clear="all"><br>-- <br><span style="font-size: 13px; font-family: arial,sans-serif; border-collapse: collapse;">
<div>
<table style="border-width: 0px; padding: 0px;">
<tbody>
<tr>
<td style="border-width: 0px; padding: 0px 15px 0px 0px; margin: 0px; font-family: arial,sans-serif;"><img src="http://egt-lab-design.s3.amazonaws.com/FirmasMail/logotipo-100x100.png"></td>
<td style="border-width: 0px; padding: 0px; margin: 0px; vertical-align: top; font-family: arial,sans-serif;">
<div style="padding: 0px; margin-bottom: 10px;">
<div style="font-weight: bold; font-size: 15px; color: rgb(15, 120, 180); font-family: Arial;">Nawfel Oujdi</div>
<div style="font-size: 12px; color: rgb(100, 101, 103); font-family: Arial;"><b>Ingeniero VoIP</b></div>
<div style="font-size: 12px; color: rgb(100, 101, 103); font-family: Arial;"><a style="color: rgb(15, 120, 180);" href="mailto:noujdi@egtelecom.es" target="_blank">noujdi@egtelecom.es</a></div></div>
<div>
<div style="font-size: 12px; color: rgb(100, 101, 103); font-family: Arial;">EG telecom S.A | <a style="color: rgb(15, 120, 180);" href="http://www.egtelecom.es/" target="_blank">www.egtelecom.es</a></div>
<div style="font-size: 12px; color: rgb(100, 101, 103); font-family: Arial;">Oficina: <b>902 050 080</b></div>
<div style="font-size: 12px; color: rgb(100, 101, 103); font-family: Arial;">Agustín de Foxá, 25 - 9B | 28036 Madrid</div></div></td></tr></tbody></table>
<hr>

<p style="margin-top: 10px; font-size: 10px; color: rgb(163, 162, 167); font-family: Arial;">Aviso
 legal: Este mensaje electrónico está dirigido únicamente a la(s) 
dirección(es) indicadas anteriormente; el carácter confidencial, 
personal e intransferible del mismo está protegido legalmente. Cualquier
 revelación, uso o reenvío no autorizado, completo o en parte, está 
prohibido. Si ha recibido este mensaje por equivocación, notifíquelo 
inmediatamente a la persona que lo ha enviado y borre el mensaje 
original junto con sus ficheros anexos sin leerlo ni grabarlo, total o 
parcialmente.</p></div></span><br>