<div dir="ltr">          In this case ,in case of failure route , its not going inside the "use_next_gw" loop . Dont know whats wrong in my config file . <div>Please help me .</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><b><i>Thanks & Regards</i></b><div><i>Sasmita Panda</i></div><div><i>Network Testing and Software Engineer</i></div><div><i>3CLogic , ph:07827611765</i></div></div></div></div>
<br><div class="gmail_quote">On Wed, Oct 7, 2015 at 6:56 PM, Sasmita Panda <span dir="ltr"><<a href="mailto:spanda@3clogic.com" target="_blank">spanda@3clogic.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">Hi All ,<div><br></div><div>     I am using opensips-1.11 . I have some scenario in which there is two or more gateways corresponding to a single group .</div><div><br></div><div>     for example :</div><div><br></div><div>     grp id : 1 , domain : <a href="http://mongodb1.sasmita.com" target="_blank">mongodb1.sasmita.com</a></div><div>     gate ways : </div><div>      gw:1 , address : <a href="http://162.1.1.1:5090" target="_blank">162.1.1.1:5090</a></div><div>      gw:2 , address : <a href="http://162.10.1.1:5080" target="_blank">162.10.1.1:5080</a></div><div><br></div><div>   So , what I want is that when call get connected to gw1 , if its fail then call get routed to the next gateway . </div><div><br></div><div><br></div><div>   What I have done for this is bellow :</div><div><br></div><div><div>mysql> select * from dr_groups;</div><div>+----+----------+-------------------------------+---------+--------------+</div><div>| id | username | domain                        | groupid | description  |</div><div>+----+----------+-------------------------------+---------+--------------+</div><div>|  1 |          | <a href="http://mongodb1.sasmita.com" target="_blank">mongodb1.sasmita.com</a>          |       9 | out          |</div><div>+----+----------+-------------------------------+---------+--------------+</div><div><br></div><div>mysql> select * from dr_gateways;</div><div>+----+------+------+---------------------+-------+------------+-------+------------+-------+--------+--------------+</div><div>| id | gwid | type | address             | strip | pri_prefix | attrs | probe_mode | state | socket | description  |</div><div>+----+------+------+---------------------+-------+------------+-------+------------+-------+--------+--------------+</div><div>| 10 | 4    |    2 | <a href="http://162.1.1.1:5090" target="_blank">162.1.1.1:5090</a>      |     0 | NULL       | NULL  |          0 |     0 | NULL   | sipp one     |</div><div>|  8 | 2    |    2 | <a href="http://162.10.1.1:5080" target="_blank">162.10.1.1:5080</a>     |     0 | NULL       | NULL  |          0 |     0 | NULL   | asterisk     |</div><div>+----+------+------+---------------------+-------+------------+-------+------------+-------+--------+--------------+</div><div>mysql></div><div>mysql> select * from dr_rules;</div><div>+--------+---------+--------+---------+----------+---------+--------+-------+---------------+</div><div>| ruleid | groupid | prefix | timerec | priority | routeid | gwlist | attrs | description   |</div><div>+--------+---------+--------+---------+----------+---------+--------+-------+---------------+</div><div>|     32 | 9       |        |         |        0 |         | 2      | NULL  | fail route    |</div><div>|     29 | 9       |        |         |        1 |         | 4      | NULL  | out           |</div><div>+--------+---------+--------+---------+----------+---------+--------+-------+---------------+</div></div><div><br></div><div>This is my table of content .</div><div><br></div><div>      In my opensips script I have done the bellow things .</div><div><br></div><div>Starting I have loaded all the modules . then the below things happening .</div><div>   I have loaded drouting and dialplan , inaddition to this all the necessary modules .</div><div>        </div><div><br></div><div><br></div><div><font color="#0b5394">route{</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">        </span>if (!mf_process_maxfwd_header("10")) {</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                </span>sl_send_reply("483","Too Many Hops");</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                </span>exit;</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">        </span>};</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">        </span>if (msg:len >=  2048 ) {</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                </span>sl_send_reply("513", "Message too big");</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                </span>exit;</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">        </span>};</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">        </span>if (method=="SUBSCRIBE") {</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                </span>sl_send_reply("405", "Method not allowed");</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                </span>exit;</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">        </span>}</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">        </span>if (method=="NOTIFY") {</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                </span>sl_send_reply("405", "Method not allowed");</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                </span>exit;</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">        </span>}</font></div><div><font color="#0b5394">        if (method=="OPTIONS") {</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                </span>sl_send_reply("200", "OK");</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                </span>exit;</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">        </span>}</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">        </span>if (!method=="REGISTER")</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                </span>record_route();</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">        </span>if (loose_route()) {</font></div><div><font color="#0b5394">                setflag(2);</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                </span>route(1);</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">        </span>};</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">        </span>if (!uri==myself) {</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                </span># drop packets, look at orig file for original config</font></div><div><font color="#0b5394">                        route(1);</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                        </span>exit; </font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">        </span>}</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">        </span>if (uri==myself) {</font></div><div><font color="#0b5394">              <span style="white-space:pre-wrap">        </span>force_rport();</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394">                if ( is_method("REGISTER")) {</font></div><div><font color="#0b5394">                     </font></div><div><font color="#0b5394">                  if(($hdr(User-Agent)!~"scanner")||($hdr(User-Agent)!~"SJphone"))   # to stop scanners</font></div><div><font color="#0b5394">                       { </font></div><div><span style="white-space:pre-wrap"><font color="#0b5394">                </font></span></div><div><font color="#0b5394">                      if(is_present_hf("X-Info"))</font></div><div><font color="#0b5394">                       {</font></div><div><font color="#0b5394">                        $var(x)=$hdr(X-Info);</font></div><div><font color="#0b5394">                        $var(y)=$(var(x){s.select,0,;});</font></div><div><font color="#0b5394">                        $var(z)=$(var(x){s.select,1,;});</font></div><div><font color="#0b5394">                        $var(y)=$(var(y){s.select,1,=});</font></div><div><font color="#0b5394">                        $var(z)=$(var(z){s.select,1,=});</font></div><div><font color="#0b5394">                        if($(var(y){<a href="http://s.int" target="_blank">s.int</a>})!=0)</font></div><div><font color="#0b5394">                          {</font></div><div><font color="#0b5394">                              save("location","p1n$var(z)");</font></div><div><font color="#0b5394">                              exit;</font></div><div><font color="#0b5394">                         }else{</font></div><div><font color="#0b5394">                              save("location","rp1");</font></div><div><font color="#0b5394">                              append_to_reply("Contact: $ct \r\n");</font></div><div><font color="#0b5394">                              xlog( "L_NOTICE", "Contact & $ct \n" );</font></div><div><font color="#0b5394">                              sl_send_reply("200","OK");</font></div><div><font color="#0b5394">                              exit;</font></div><div><font color="#0b5394">                         }</font></div><div><font color="#0b5394">                       }else{</font></div><div><font color="#0b5394">                        save("location","p1n5");</font></div><div><font color="#0b5394">                        exit;</font></div><div><font color="#0b5394">                       }</font></div><div><font color="#0b5394">                       ; save("location","fc10p1");</font></div><div><font color="#0b5394">                        m_dump("$fu");</font></div><div><font color="#0b5394">                       }</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                        </span>exit;</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                </span>}</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394">    <span style="white-space:pre-wrap">        </span>    if ( is_method("CANCEL") )</font></div><div><font color="#0b5394">              {</font></div><div><font color="#0b5394">                if ( t_check_trans() ){</font></div><div><font color="#0b5394">                       t_relay();</font></div><div><font color="#0b5394">                   }</font></div><div><font color="#0b5394">                else { </font></div><div><font color="#0b5394">                       t_reply("200","OK"); </font></div><div><font color="#0b5394">                   }    </font></div><div><font color="#0b5394">                 exit;</font></div><div><font color="#0b5394">               }</font></div><div><font color="#0b5394">   </font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394">                if (is_method("BYE")) {</font></div><div><font color="#0b5394">                    setflag(2);</font></div><div><font color="#0b5394">                    setflag(TRACE_FLAG);</font></div><div><font color="#0b5394">                    t_relay();</font></div><div><font color="#0b5394">                  exit;  </font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394">                }</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394">                if (is_method("INVITE")) {</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394">            setflag(4);</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                        </span>setflag(2);</font></div><div><font color="#0b5394">                xlog( "L_NOTICE", "CallCenter_Info & $ci,$var(c) \n" );</font></div><div><font color="#0b5394">                if(is_from_gw() ||  (to_uri=~"@<a href="http://190.168.1.1" target="_blank">190.168.1.1</a>"))</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                        </span>         {</font></div><div><font color="#0b5394">                    </font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">        </span>            xlog( "L_WARN", "Source IP sas : $Ri To Uri : $tu From : $fU Request URI: $oU Call ID:$ci" );</font></div><div><font color="#0b5394">               </font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                        </span>    if ( !lookup("location")){</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                                </span>sl_send_reply("404","NO Match Found");</font></div><div><font color="#0b5394">                            exit;</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                </span>            }</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                        </span>    #do lcr</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                        </span>    if ( !serialize_branches(1)){</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                                </span>sl_send_reply("500","Internal Server Error");</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                                </span>exit;</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                        </span>    }</font></div><div><font color="#0b5394">                           else{</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                                </span>next_branches();</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                                </span>t_on_failure("3");</font></div><div><font color="#0b5394">                                route(1);</font></div><div><font color="#0b5394">                         <span style="white-space:pre-wrap">        </span>exit;<span style="white-space:pre-wrap">        </span></font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                        </span>     } </font></div><div><font color="#0b5394">                         }<span style="white-space:pre-wrap">        </span></font></div><div><font color="#0b5394">                       #}</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                        </span>else{</font></div><div><font color="#0b5394">                }</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                </span>}</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                </span>route(10);</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">        </span>};</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394">route[1] {</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">        </span>if (nat_uac_test("7")) {</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                </span>fix_nated_contact();</font></div><div><font color="#0b5394">        };</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">        </span>t_on_reply("1");</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">        </span>if (!t_relay()) {</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">                </span>sl_reply_error();</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">        </span>};</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">        </span>exit;</font></div><div><font color="#0b5394">}</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394">route[10] {</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394">$avp(src) = $rd;</font></div><div><font color="#0b5394">xlog("request domain,$avp(trl)");</font></div><div><font color="#0b5394">dp_translate("5", "$avp(src)/$avp(trl)");</font></div><div><font color="#0b5394">$avp(grp)=$(avp(trl){<a href="http://s.int" target="_blank">s.int</a>});</font></div><div><font color="#0b5394">xlog("translated to  $avp(grp) \n");</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394">    if (!do_routing("$avp(grp)","F")) {</font></div><div><font color="#0b5394">        xlog("do_routing: No rules matching the URI\n");</font></div><div><font color="#0b5394">        send_reply("503","No rules matching the URI");</font></div><div><font color="#0b5394">        exit;</font></div><div><font color="#0b5394">    }</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394">    if (is_method("INVITE")) {</font></div><div><font color="#0b5394">        t_on_failure("10");</font></div><div><font color="#0b5394">    }</font></div><div><font color="#0b5394">    route(1);</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394">}</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394">onreply_route[1] {</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394">        if( status =~ "18[0-9]" ) {</font></div><div><font color="#0b5394">                t_on_failure("4");</font></div><div><font color="#0b5394">            }</font></div><div><font color="#0b5394"><span style="white-space:pre-wrap">        </span>if (nat_uac_test("1")) {</font></div><div><font color="#0b5394">                fix_nated_contact();</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394">          };</font></div><div><font color="#0b5394">}</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394">failure_route[10] {</font></div><div><font color="#0b5394">    xlog("DEBUG: DROUTING failure route active\n");</font></div><div><font color="#0b5394">     if (t_check_status("408|402|50[234]")) {</font></div><div><font color="#0b5394">                # route to the next gateway</font></div><div><font color="#0b5394">               xlog("DEBUG: DROUTING use next gateway \n"); </font></div><div><font color="#0b5394">               if (use_next_gw()) {</font></div><div><font color="#0b5394">                        # prepare for lcr failover</font></div><div><font color="#0b5394">                        xlog( "L_NOTICE", "[$Tf] ACC: $ci Next gateway $fU -> $tU via $rd\n" );</font></div><div><font color="#0b5394">                        t_on_reply("1");</font></div><div><font color="#0b5394">                        t_on_failure("10");</font></div><div><font color="#0b5394">                        # send from 5060 for primus gateways</font></div><div><font color="#0b5394">                        if (!t_relay()){</font></div><div><font color="#0b5394">                                exit;</font></div><div><font color="#0b5394">                        }</font></div><div><font color="#0b5394">                } else {</font></div><div><font color="#0b5394">                        xlog( "L_WARN", "[$Tf] FR: $ci No more buscuits in the biscuit tin -> 503.\n" );</font></div><div><font color="#0b5394">                        t_reply("503", "Service unavailable -- no more gateways");</font></div><div><font color="#0b5394">                        exit;</font></div><div><font color="#0b5394">                };</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394">        };</font></div><div><font color="#0b5394">        exit;</font></div><div><font color="#0b5394">}</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394">failure_route[4] {</font></div><div><font color="#0b5394">     xlog("L_NOTICE","could not complete");</font></div><div><font color="#0b5394">}</font></div><div><br></div><div><br></div><div>           I want to switch to the next gateway in the status codes defined in the failure route . But , now its not switching the gateway . Its just coming to the else loop and giving   503 error .  I think there is something missing in my script or in my dynamic routing table .     </div><div>     </div><div>    Please let me know if I need to change something . I am trying this from very long time but not getting any result . Any kind of help is appreciated .</div><div><br clear="all"><div><div><div dir="ltr"><b><i>Thanks & Regards</i></b><span class="HOEnZb"><font color="#888888"><div><i>Sasmita Panda</i></div><div><i>Network Testing and Software Engineer</i></div><div><i>3CLogic , ph:07827611765</i></div></font></span></div></div></div>
</div></div>
</blockquote></div><br></div>