[OpenSIPS-Users] Using dispatcher and t_replicate()

Jody Rudolph jrudolph at qx.net
Sat Oct 2 03:35:04 CEST 2010


Just in case anyone might need a workaround here like I did I thought I would share what I did to get it to work.

Since the servers I am load balancing registrations across share a database backend for registrations I am trying to spread the registrations across single servers using dispatcher.

Lets say we have the following 3 IPs:

192.168.1.2
192.168.1.3
192.168.1.4


Since we cant use (that I can figure out anyway)
ds_select_dst("1", "4");
t_replicate($du);

I used:

	ds_select_dst("1", "4");
	switch($du)
        {
            case "sip:192.168.1.2":
                xlog("reg destination address is $du\n");
                t_replicate("sip:192.168.1.2");
            break;
            case "sip:192.168.1.3":
                xlog("reg destination address is $du\n");
                t_replicate("sip:192.168.1.3");
            break;
            case "sip:192.168.1.4":
                xlog("reg destination address is $du\n");
                t_replicate("sip:192.168.1.4");
            break;
            default:
                xlog("Dispatching Reg failed: $du\n");
                sl_reply_error();
            break;
       }
	exit;

Not the cleanest way of doing it, but it works.



Thanks,
Jody Rudolph
> 
> 




More information about the Users mailing list