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