[SR-Users] Calling t_relay([host, port]) with variables

Nick J nick at nickvsnetworking.com
Wed Jan 5 09:21:22 CET 2022

Hi all,
I've been banging my head on the table with this one and hoping someone has
some insight here.
I'm trying to use a variable as the host & port input in t_relay()
- t_relay(host, port)

This works fine if statically set:

t_relay("", "5060");

But if I change the host or the port to a variable like this:

$avp(destip) = "";
$avp(dstport) = "5060";
t_relay($avp(destip), $avp(dstport));

Then Kamailio fails to start, calling out the t_relay line:
kamailio: CRITICAL: <core> [core/cfg.y:3686]: yyerror_at(): parse error in
config file /etc/kamailio/kamailio-routelogic.cfg, line 62, column 35: bad

I get the same behavior with pseudovariables and vars as well:

$var(destip) = "";
$var(dstport) = "5060";
t_relay($var(destip), $var(dstport))

Any tips or pointers would be much appreciated.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20220105/f8f06c60/attachment.htm>

More information about the sr-users mailing list