Vik Killa
2014-09-15 17:17:18 UTC
I like dispatcher but i need something more custom to my setup so I want to
attempt to emulate some basic behavior of dispatcher.
I have a simple perl script kamailio calls, it does a database query to get
an IP address and port similar to an item listed into the dispatcher list.
my question is how do I forward the SIP packet to the destination using the
database result query?
Here is what i have so far but it doesn't work because it's modifying the
request uri, where i just want to forward it to the FS server:
my $sth = $dbh->prepare("SELECT ip_address FROM host_machine WHERE
is_online = true ORDER BY random() LIMIT 1");
$sth->execute();
my $host_ip_address = $sth->fetchrow();
Kamailio::log(L_ERR, "Random server: " . $host_ip_address);
$m->rewrite_ruri('sip:' . $m->pseudoVar('$rU') . '@' . $host_ip_address .
':5060');
$sth->finish;
Thanks!
/V
attempt to emulate some basic behavior of dispatcher.
I have a simple perl script kamailio calls, it does a database query to get
an IP address and port similar to an item listed into the dispatcher list.
my question is how do I forward the SIP packet to the destination using the
database result query?
Here is what i have so far but it doesn't work because it's modifying the
request uri, where i just want to forward it to the FS server:
my $sth = $dbh->prepare("SELECT ip_address FROM host_machine WHERE
is_online = true ORDER BY random() LIMIT 1");
$sth->execute();
my $host_ip_address = $sth->fetchrow();
Kamailio::log(L_ERR, "Random server: " . $host_ip_address);
$m->rewrite_ruri('sip:' . $m->pseudoVar('$rU') . '@' . $host_ip_address .
':5060');
$sth->finish;
Thanks!
/V