modules_s/domain domain_lookup() function can be used to assign domain attributes to avps.
for example, lookup_domain("$fd", "foo.bar"), assigns attributes of domain foo.bar to avps $fd.x, where x is name of attribute.
my question is, how can i index these avps if there is more than one with the same name?
statement
$var(attr) = $fd.attr[];
does not give syntax errors, but
$var(attr) = $fd.attr[$var(i)];
produces
0(7368) : <core> [cfg.y:3379]: parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 3174, column 24-30: syntax error 0(7368) : <core> [cfg.y:3379]: parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 3174, column 24-30: bad command 0(7368) : <core> [cfg.y:3382]: parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 3174, column 31: bad command 0(7368) : <core> [cfg.y:3382]: parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 3174, column 31: bad command
-- juha
On 3/29/10 3:22 PM, Juha Heinanen wrote:
modules_s/domain domain_lookup() function can be used to assign domain attributes to avps.
for example, lookup_domain("$fd", "foo.bar"), assigns attributes of domain foo.bar to avps $fd.x, where x is name of attribute.
my question is, how can i index these avps if there is more than one with the same name?
statement
$var(attr) = $fd.attr[];
does not give syntax errors, but
$var(attr) = $fd.attr[$var(i)];
using PV style should work:
$var(attr) = $(avp(fd.attr[$var(i)]);
Cheers, Daniel
produces
0(7368) :<core> [cfg.y:3379]: parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 3174, column 24-30: syntax error 0(7368) :<core> [cfg.y:3379]: parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 3174, column 24-30: bad command 0(7368) :<core> [cfg.y:3382]: parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 3174, column 31: bad command 0(7368) :<core> [cfg.y:3382]: parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 3174, column 31: bad command
-- juha
sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Daniel-Constantin Mierla writes:
using PV style should work:
$var(attr) = $(avp(fd.attr[$var(i)]);
daniel,
thanks for trying to help. however,
if (defined($(avp(fd.attr[$var(i)])))) {
produces
0(7761) ERROR: <core> [usr_avp.c:994]: Invalid AVP index '$var(i)' 0(7761) ERROR: pv [pv_core.c:2112]: bad avp name [attr[$var(i)]] 0(7761) ERROR: <core> [pvapi.c:553]: pvar "avp" has an invalid name param [attr[$var(i)]] 0(7761) ERROR: <core> [pvapi.c:708]: wrong char [)/41] in [$(avp(fd.attr[$var(i)]))] at [22 (2)] 0(7761) : <core> [cfg.y:3379]: parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 3174, column 17-40: unknown script pseudo variable $(avp(fd.attr[$var(i)]))
-- juha
Perhaps $(avp(fd.attr)[$var(i)])
?
On 03/29/2010 09:31 AM, Juha Heinanen wrote:
Daniel-Constantin Mierla writes:
using PV style should work:
$var(attr) = $(avp(fd.attr[$var(i)]);
daniel,
thanks for trying to help. however,
if (defined($(avp(fd.attr[$var(i)])))) {
produces
0(7761) ERROR:<core> [usr_avp.c:994]: Invalid AVP index '$var(i)' 0(7761) ERROR: pv [pv_core.c:2112]: bad avp name [attr[$var(i)]] 0(7761) ERROR:<core> [pvapi.c:553]: pvar "avp" has an invalid name param [attr[$var(i)]] 0(7761) ERROR:<core> [pvapi.c:708]: wrong char [)/41] in [$(avp(fd.attr[$var(i)]))] at [22 (2)] 0(7761) :<core> [cfg.y:3379]: parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 3174, column 17-40: unknown script pseudo variable $(avp(fd.attr[$var(i)]))
-- juha
sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
On 3/29/10 3:31 PM, Juha Heinanen wrote:
Daniel-Constantin Mierla writes:
using PV style should work:
$var(attr) = $(avp(fd.attr[$var(i)]);
daniel,
thanks for trying to help. however,
if (defined($(avp(fd.attr[$var(i)])))) {
indeed, the right syntax is:
if ( defined( $(avp(fd.attr)[$var(i)]) ) ) {
I messed up position of parenthesis.
Cheers, Daniel
produces
0(7761) ERROR:<core> [usr_avp.c:994]: Invalid AVP index '$var(i)' 0(7761) ERROR: pv [pv_core.c:2112]: bad avp name [attr[$var(i)]] 0(7761) ERROR:<core> [pvapi.c:553]: pvar "avp" has an invalid name param [attr[$var(i)]] 0(7761) ERROR:<core> [pvapi.c:708]: wrong char [)/41] in [$(avp(fd.attr[$var(i)]))] at [22 (2)] 0(7761) :<core> [cfg.y:3379]: parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 3174, column 17-40: unknown script pseudo variable $(avp(fd.attr[$var(i)]))
-- juha
Daniel-Constantin Mierla writes:
indeed, the right syntax is:
if ( defined( $(avp(fd.attr)[$var(i)]) ) ) {
i added one statement:
$(avp(id)[0]) can be written in shorter form as $avp(id) and $avp(s:name) as $name.
to http://sip-router.org/wiki/cookbooks/pseudo-variables/devel#avps.
hope it clarifies the situation a bit.
-- juha