[Serusers] PSTN gateway failover

Andreas Granig a.granig at inode.at
Wed Oct 20 14:33:46 CEST 2004


Hi all,

Since SER does not provide DNS SRV failover capability, how do you 
perform failover for your PSTN gateways?

I currently think about some sort of load balancing with exec_dset() 
which looks up a gateway in a mysql db and give it 10 tries to find a 
gateway (SER is running on my.domain:5060)

route
{
   if (!mf_process_maxfwd_header("10"))
   {
     sl_send_reply("483", "Too many hops");
     break;
   }
<snip>
   exec_dset("/my/sipgw-balancing-script"); # returns a random GW
   t_on_failure("1");
   t_relay();
<snip>
}

failure_route[1]
{
   if(t_check_status("503")
   {
     rewritehostport("my.domain:5060"); # peform loop
     append_branch();
     t_relay();
   }
}

Is this good practice? Any other ideas/optimizations?


Cheers,
Andy




More information about the sr-users mailing list