[SR-Users] mimic ds_select_dst with app_perl
Daniel-Constantin Mierla
miconda at gmail.com
Tue Sep 16 17:49:22 CEST 2014
Hello,
I don't know if perl embedded api has the option to set the dst_uri (the
equivalent of $du config variable).
If not, set the new uri in an avp and in kamailio.cfg, after executing
your perl script, do:
$du = $avp(urifromperl);
Cheers,
Daniel
On 15/09/14 19:17, Vik Killa wrote:
> 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
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Next Kamailio Advanced Trainings 2014 - http://www.asipto.com
Sep 22-25, Berlin, Germany
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20140916/90046d13/attachment.html>
More information about the sr-users
mailing list