Hello all,
I have a small problem with avp_db_query() and avp_pushto() that I could
use some help with.
The manual select statement returns the expected values:
mysql> select username,attribute,value from usr_preferences where
username='55555';
+----------+-----------+------------+
| username | attribute | value |
+----------+-----------+------------+
| 55555 | 1 | 2035552222 |
| 55555 | 2 | 2035551111 |
+----------+-----------+------------+
2 rows in set (0.00 sec)
The problem I have is that, when I run the configuration segment below only
the first instance of avp_pushto in the loop produces the correct value.
avp_delete("*");
$var(idx) = 0;
if (avp_db_query("SELECT attribute, value
FROM usr_preferences
WHERE username='$rU'
ORDER BY attribute")) {
while($var(idx) < 5) {
if ($(avp(i:1)[$var(idx)]) != NULL) {
xlog("L_NOTICE", "avp(i:1)[$var(idx)]=$(avp(i:1)[$var(idx)])
avp(i:2)[$var(idx)]=$(avp(i:2)[$var(idx)])\n");
avp_pushto("$ru/username", "$(avp(i:2)[$var(idx)])");
rewritehostport("10.10.10.10:5060");
xlog("L_NOTICE", "$ru\n");
} else {
xlog("L_NOTICE", "avp(i:1)[$var(idx)] == NULL\n");
}
$var(idx) = $var(idx) + 1;
}
} else {
xlog("L_NOTICE", "avp_db_query() returned no records\n");
};
So, the avp_db_query() works exactly as expected. The problem is that
the second avp_pushto() doesn't change the value in the ruri username.
avp(i:1)[0]=1 avp(i:2)[0]=2035552222
sip:2035552222@10.10.10.10:5060;user=phone
avp(i:1)[1]=2 avp(i:2)[1]=2035551111 <-- This is the mismatch
sip:2035552222@10.10.10.10:5060;user=phone <-- This is the mismatch
avp(i:1)[2] == NULL
avp(i:1)[3] == NULL
avp(i:1)[4] == NULL
As always, thanks for any help.
- Jeremy