[SR-Users] mimic ds_select_dst with app_perl

Vik Killa vipkilla at gmail.com
Mon Sep 15 19:17:18 CEST 2014


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20140915/5fc83eab/attachment.html>


More information about the sr-users mailing list