[Serusers] Round-Robin/Random forwarding

Henrik Pfluger ser at bellshare.com
Sat Jul 17 13:50:36 CEST 2004


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");
}






More information about the sr-users mailing list