<div dir="ltr">Oki, I will modify my old failure_route :<div><br></div><div><br></div><div><span style="font-family:monospace"><span style="color:rgb(0,0,0)">failure_route</span><span style="font-weight:bold;color:rgb(84,255,84)">[GW_FAILOVER]</span><span style="color:rgb(0,0,0)"> {
</span><br>
<br>        if (t_was_cancelled()) {
<br>                exit<span style="font-weight:bold;color:rgb(84,255,255)">;</span><span style="color:rgb(0,0,0)">
</span><br>        }
<br>
<br>        <span style="font-weight:bold;color:rgb(84,255,255)"># detect failure and redirect to next available GW</span><span style="color:rgb(0,0,0)">
</span><br>        if (t_check_status("(408)|488|(<span style="font-weight:bold;color:rgb(84,255,84)">[56][0-9][0-9]</span><span style="color:rgb(0,0,0)">)")) {
</span><br>                #xlog("Failed GW $rd detected \n")<span style="font-weight:bold;color:rgb(84,255,255)">;</span><span style="color:rgb(0,0,0)">
</span><br>
<br>                if ( use_next_gw() ) {
<br>                        t_on_failure("GW_FAILOVER")<span style="font-weight:bold;color:rgb(84,255,255)">;</span><span style="color:rgb(0,0,0)">
</span><br>                        t_relay()<span style="font-weight:bold;color:rgb(84,255,255)">;</span><span style="color:rgb(0,0,0)">
</span><br>                        exit<span style="font-weight:bold;color:rgb(84,255,255)">;</span><span style="color:rgb(0,0,0)">
</span><br>                }
<br>
<br>                send_reply("500","All GW are down")<span style="font-weight:bold;color:rgb(84,255,255)">;</span><span style="color:rgb(0,0,0)">
</span><br>        }
<br>}<br>
<br></span></div><div><span style="font-family:monospace"><br></span></div><div><span style="font-family:monospace">to :</span></div><div><span style="font-family:monospace"><br></span></div><div><span style="font-family:monospace"><br></span></div><div><span style="font-family:monospace"><span style="color:rgb(0,0,0)">failure_route</span><span style="font-weight:bold;color:rgb(84,255,84)">[GW_FAILOVER]</span><span style="color:rgb(0,0,0)"> {
</span><br>
<br>        if (t_was_cancelled()) {
<br>                exit<span style="font-weight:bold;color:rgb(84,255,255)">;</span><span style="color:rgb(0,0,0)">
</span><br>        }
<br>
<br>        <span style="font-weight:bold;color:rgb(84,255,255)"># detect failure and redirect to next available GW</span><span style="color:rgb(0,0,0)">
</span><br>        if (t_check_status("(408)|488|(<span style="font-weight:bold;color:rgb(84,255,84)">[56][0-9][0-9]</span><span style="color:rgb(0,0,0)">)")) {
</span><br>                xlog("Failed GW $rd detected \n")<span style="font-weight:bold;color:rgb(84,255,255)">;</span><span style="color:rgb(0,0,0)">
</span><br>
<br>                if ( use_next_gw() ) {
<br>                        t_on_failure("GW_FAILOVER")<span style="font-weight:bold;color:rgb(84,255,255)">;</span><span style="color:rgb(0,0,0)"> </span></span></div><div><span style="font-family:monospace"><font color="#000000">                      </font><font color="#ff0000"> </font></span><font color="#ff0000"><b><span style="font-family:monospace;font-size:10.4px">do_accounting("db|log","</span><wbr style="font-family:monospace;font-size:10.4px"><span style="font-family:monospace;font-size:10.4px">failed|missed",)</span><span style="font-family:monospace;font-size:10.4px">;</span></b></font><span style="font-family:monospace"><font color="#000000"><br></font>                        t_relay()<span style="font-weight:bold;color:rgb(84,255,255)">;</span><span style="color:rgb(0,0,0)">
</span><br>                        exit<span style="font-weight:bold;color:rgb(84,255,255)">;</span><span style="color:rgb(0,0,0)">
</span><br>                }
<br>
<br>                send_reply("500","All GW are down")<span style="font-weight:bold;color:rgb(84,255,255)">;</span><span style="color:rgb(0,0,0)">
</span><br>        }
<br>}<br>
<br></span></div><div><br></div><div><font face="monospace">right ?</font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 16, 2017 at 11:07 AM, Răzvan Crainea <span dir="ltr"><<a href="mailto:razvan@opensips.org" target="_blank">razvan@opensips.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <tt>I was asking you to call do_accounting() in failure route, for
      each leg.<br>
      <br>
      Best regards,<br>
    </tt><span class="">
    <pre class="m_-6428306416065768007moz-signature" cols="72">Răzvan Crainea
OpenSIPS Solutions
<a class="m_-6428306416065768007moz-txt-link-abbreviated" href="http://www.opensips-solutions.com" target="_blank">www.opensips-solutions.com</a></pre>
    </span><div><div class="h5"><div class="m_-6428306416065768007moz-cite-prefix">On 01/16/2017 12:02 PM, Khalil
      Khamlichi wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">sorry mistype, I am calling do_accounting() twice.</div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Mon, Jan 16, 2017 at 9:47 AM, Khalil
          Khamlichi <span dir="ltr"><<a href="mailto:khamlichi.khalil@gmail.com" target="_blank">khamlichi.khalil@gmail.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">thanks for your much appreciated help, 
              <div>I am calling do_routing twice.</div>
              <div><br>
                <div>Here is my actual opensips.cfg : </div>
                <div><br>
                </div>
                <div>route {</div>
                <div>
                  <div><span style="font-family:monospace">...</span></div>
                  <div><span style="font-family:monospace">...</span></div>
                  <div><span style="font-family:monospace"><br>
                    </span></div>
                  <div><span style="font-family:monospace">...</span></div>
                  <div><span style="font-family:monospace">...</span></div>
                </div>
                <div><span style="font-family:monospace"><span style="color:rgb(0,0,0)">        if (has_totag())
                      {
                    </span><br>
                                   <span style="font-weight:bold;color:rgb(84,255,255)">#
                      sequential request withing a dialog should</span><span style="color:rgb(0,0,0)">
                    </span><br>
                                   <span style="font-weight:bold;color:rgb(84,255,255)">#
                      take the path determined by record-routing</span><span style="color:rgb(0,0,0)">
                    </span><br>
                                   if (loose_route()) {
                    <br>
                    <br>
                                           <span style="font-weight:bold;color:rgb(84,255,255)">#
                      validate the sequential request against dialog</span><span style="color:rgb(0,0,0)">
                    </span><br>
                                           if ( $DLG_status!=<span style="font-weight:bold;color:rgb(255,84,255)">NULL
                      && !validate_dialog() ) {</span><span style="color:rgb(0,0,0)">
                    </span><br>
                                                  <wbr> xlog("In-Dialog
                    $rm from $si (callid=<span style="font-weight:bold;color:rgb(255,84,255)">$ci)
                      is not valid according to dialog\n")</span><span style="font-weight:bold;color:rgb(84,255,255)">;</span><span style="color:rgb(0,0,0)">
                    </span><br>
                                           }
                    <br>
                    <br>
                                           if (is_method("BYE")) {
                    <br>
                                                  <wbr> <span style="font-weight:bold;color:rgb(84,255,255)">#
                      do accounting even if the transaction fails</span><span style="color:rgb(0,0,0)">
                    </span><br>
                                                  <wbr> do_accounting("db|log","faile<wbr>d|missed",)<span style="font-weight:bold;color:rgb(84,255,255)">;</span><span style="color:rgb(0,0,0)">
                    </span><br>
                                           } else if
                    (is_method("INVITE")) {
                    <br>
                                                  <wbr> <span style="font-weight:bold;color:rgb(84,255,255)">#
                      even if in most of the cases is useless, do RR for</span><span style="color:rgb(0,0,0)">
                    </span><br>
                                                  <wbr> <span style="font-weight:bold;color:rgb(84,255,255)">#
                      re-INVITEs alos, as some buggy clients do change
                      route set</span><span style="color:rgb(0,0,0)">
                    </span><br>
                                                  <wbr> <span style="font-weight:bold;color:rgb(84,255,255)">#
                      during the dialog.</span><span style="color:rgb(0,0,0)">
                    </span><br>
                                                  <wbr> record_route()<span style="font-weight:bold;color:rgb(84,255,255)">;</span><span style="color:rgb(0,0,0)">
                    </span><br>
                                           }<br>
                    ...</span></div>
                <div><span style="font-family:monospace">...</span></div>
                <div><span style="font-family:monospace"><br>
                  </span></div>
                <div><span style="font-family:monospace">...</span></div>
                <div><span style="font-family:monospace">...</span></div>
                <div><span style="font-family:monospace"><span style="color:rgb(0,0,0)">        $acc_extra(gwid)=</span><span style="font-weight:bold;color:rgb(255,84,255)">$avp(gw_id)</span><span style="font-weight:bold;color:rgb(84,255,255)">;</span><span style="color:rgb(0,0,0)">
                    </span><br>
                    <br>
                           t_on_failure("GW_FAILOV<wbr>ER")<span style="font-weight:bold;color:rgb(84,255,255)">;</span><span style="color:rgb(0,0,0)">
                    </span><br>
                    <br>
                           do_accounting("db|log",<wbr>"cdr|missed",)<span style="font-weight:bold;color:rgb(84,255,255)">;</span><span style="color:rgb(0,0,0)">
                    </span><br>
                    <span style="font-weight:bold;color:rgb(84,255,255)">#NAT
                    </span><span style="color:rgb(0,0,0)"> </span><br>
                           if (isbflagset(NAT)) setflag(NAT)<span style="font-weight:bold;color:rgb(84,255,255)">;</span><span style="color:rgb(0,0,0)">
                    </span><br>
                    <span style="font-weight:bold;color:rgb(84,255,255)">#NAT</span><span style="color:rgb(0,0,0)">
                    </span><br>
                           route(RELAY)<span style="font-weight:bold;color:rgb(84,255,255)">;</span><span style="color:rgb(0,0,0)">
                    </span><br>
                    }<br>
                    <br>
                  </span></div>
                <div># END OF MAIN ROUTE</div>
                <div>
                  <div class="m_-6428306416065768007h5">
                    <div><br>
                    </div>
                    <div class="gmail_extra"><br>
                      <div class="gmail_quote">On Mon, Jan 16, 2017 at
                        8:51 AM, Răzvan Crainea <span dir="ltr"><<a href="mailto:razvan@opensips.org" target="_blank">razvan@opensips.org</a>></span>
                        wrote:<br>
                        <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                          <div bgcolor="#FFFFFF"> <tt>Hi, Khalil!<br>
                              <br>
                              Did you try to call the do_accounting()
                              function for each leg going to the next
                              gateway?<br>
                              <br>
                              Best regards,<br>
                            </tt>
                            <pre class="m_-6428306416065768007m_5885067735228918325gmail-m_4018356164897762301m_1440895108582141234moz-signature" cols="72">Răzvan Crainea
OpenSIPS Solutions
<a class="m_-6428306416065768007m_5885067735228918325gmail-m_4018356164897762301m_1440895108582141234moz-txt-link-abbreviated" href="http://www.opensips-solutions.com" target="_blank">www.opensips-solutions.com</a></pre>
                            <div>
                              <div class="m_-6428306416065768007m_5885067735228918325gmail-m_4018356164897762301h5">
                                <div class="m_-6428306416065768007m_5885067735228918325gmail-m_4018356164897762301m_1440895108582141234moz-cite-prefix">On
                                  01/15/2017 12:24 AM, Khalil Khamlichi
                                  wrote:<br>
                                </div>
                              </div>
                            </div>
                            <blockquote type="cite">
                              <div>
                                <div class="m_-6428306416065768007m_5885067735228918325gmail-m_4018356164897762301h5">
                                  <div dir="ltr">Hi,
                                    <div>I am testing opensips 2.2, 2.3
                                      I have tried to configure acc
                                      module to save to db failed calls
                                      on drouting configuration, I have
                                      found that it does save only the
                                      first failed call (that is the
                                      first gateway) it does not save to
                                      database any other failures on
                                      second and third gateways that are
                                      tried for the call.</div>
                                    <div>is this the expected behavioure
                                      ?</div>
                                    <div>Thanks for your help.</div>
                                    <div><br>
                                    </div>
                                    <div>regards,</div>
                                    <div>kh</div>
                                  </div>
                                  <br>
                                  <fieldset class="m_-6428306416065768007m_5885067735228918325gmail-m_4018356164897762301m_1440895108582141234mimeAttachmentHeader"></fieldset>
                                  <br>
                                </div>
                              </div>
                              <pre>______________________________<wbr>_________________
Users mailing list
<a class="m_-6428306416065768007m_5885067735228918325gmail-m_4018356164897762301m_1440895108582141234moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a class="m_-6428306416065768007m_5885067735228918325gmail-m_4018356164897762301m_1440895108582141234moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    

  </div>


______________________________<wbr>_________________

Users mailing list

<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>

<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a>


</blockquote></div>
</div></div></div></div></div>
</blockquote></div>
</div>


<fieldset class="m_-6428306416065768007mimeAttachmentHeader"></fieldset>
<pre>______________________________<wbr>_________________
Users mailing list
<a class="m_-6428306416065768007moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a class="m_-6428306416065768007moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a>
</pre>

</blockquote>
</div></div></div><br>______________________________<wbr>_________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a><br>
<br></blockquote></div><br></div>