[Serusers] Round-Robin/Random forwarding

Jan Janak jan at iptel.org
Wed Jul 21 12:40:57 CEST 2004


You can use functions from exec module to execute an external script
that would return a randomly chosen URI from a set of URIs.

  Jan.

On 17-07 13:50, Henrik Pfluger wrote:
> Hi,
> We have several gateways all with the same routes. Anyone knows how to
> distribute calls from SER in a round-robin or some random fashion to them.
> The rewriteuri and forward functions only allow one static route.
> 
> It would be nice to have something like
> rewriteuri_randomselect("sip:gateway1.pfluger.de:5060",
> 	"sip:gateway2.pfluger.de:5060",
> 	"sip:gateway3.pfluger.de:5060",
> 	"sip:gateway4.pfluger.de:5060");
> 
> Any solution to this?
> 
> Thanks,
> 
> Henrik
> 
> 
> This is what we currently do to send calls to a single gateway:
> 
> # PSTN resolution		
> if (uri=~"^sip:[0-9]+@") { 
> 			
> 	# request digest authorization
> 	if ((method=="INVITE") && !www_authorize("pfluger.de", "customer"))
> {		www_challenge("pfluger.de", "0");
> 		break;
> 	}
> 		
> 	# make sure from user matches authenticated user
> 	if (method=="INVITE") {
> 		if (!check_from()) {
> 			sl_send_reply("403", "From user does not match
> authenticated user");
> 			break;
> 		}
> 	}
> 	
> 	# Forward PSTN call
> 	xlog("L_CRIT","[%Tf]: %rm %ru: Forwarding to PSTN gateway\n");
> 	rewriteuri("sip:gateway.pfluger.de:5060");
> }
> 
> 
> 
> _______________________________________________
> Serusers mailing list
> serusers at lists.iptel.org
> http://lists.iptel.org/mailman/listinfo/serusers




More information about the sr-users mailing list