[sr-dev] trouble with testing $var

Juha Heinanen jh at tutpro.com
Sun Nov 8 11:55:22 CET 2009


i wrote alias_contact() function and seems to work fine.  i have not
yet written handle_alias(), but tried to first use scripting means for
that.  that led into trouble with testing is $var has value.

i have this piece of code:

   xlog("L_INFO", "R-URI is <$ru>\n");
   $var(tmp) = $(ru{uri.param,alias});
   xlog("L_INFO", "Alias param is <$var(tmp)>\n");
   if ($var(tmp)) {
	    xlog("L_INFO", "Alias param is <$var(tmp)>\n");
	    $du = $var(tmp);
	    xlog("L_INFO", "Routing in-dialog $rm from <$fu> to <$du>\n");
    } else {
	    xlog("L_INFO", "Routing in-dialog $rm from <$fu> to <$ru>\n");
    }

and i get to syslog:

Nov  8 12:51:10 localhost /usr/sbin/sip-proxy[4506]: INFO: R-URI is <sip:jh_test_fi at 192.98.101.10:5074;transport=tcp;alias="192.98.101.10:55375;transport=tcp">
Nov  8 12:51:10 localhost /usr/sbin/sip-proxy[4506]: INFO: Alias param is <192.98.101.10:55375;transport=tcp>
Nov  8 12:51:10 localhost /usr/sbin/sip-proxy[4506]: INFO: Routing in-dialog BYE from <sip:test at as.test.fi> to <sip:jh_test_fi at 192.98.101.10:5074;transport=tcp;alias="192.98.101.10:55375;transport=tcp">

why does the test

   if ($var(tmp)) {

fail to figure out that $var(tmp) has value?

-- juha



More information about the sr-dev mailing list