Turns out this is caused by passing
ds_select_dst a string instead of an int.
$var(test) = 30; works
$var(test) = “30”; doesn’t
work
The attrs field in dialplan is a string. Converting
it to an int with {s.int} worked for me.
From:
users-bounces@lists.kamailio.org [mailto:users-bounces@lists.kamailio.org] On Behalf Of Robert McGilvray
Sent: Wednesday, June 24, 2009
3:14 PM
To: users@lists.kamailio.org
Subject: [Kamailio-Users] script
var or avp in ds_select_dst (dispatcher)?
Can someone please confirm that I cannot use a script var or
avp in the set field when calling ds_select_dst from the dispatcher module?
I’m trying to use dialplan to return a gateway group via attr, then call
ds_select_dst with that but get the following error in my logs. If this is my
problem are there any workarounds? The goal is to call ds_select_dst with
a dynamic value. Example - ds_select_dst("$var(dpattr)",
"0")
Jun 24 14:50:49 [1125] ERROR:core:fixup_get_ivalue: no valid PV
value found (error in scripts)
Jun 24 14:50:49 [1125] ERROR:dispatcher:w_ds_select_dst: no dst set
value
If I hardcode the value which in this case is 30 it works as expected.
I’ve verified that the correct value is in $var(dpattr) with an xlog
right before the call to ds_select_dst.
if ($ruri.user =~
"[0-9]{4}") {
xlog("L_NOTICE", "KAM_HOST: ($ci) $pr $mi route[$rm][0] $fu
-> $ru - Internal 4 digit call\n");
if (dp_translate("2", "$ruri.user/$var(dpuser)")) {
xlog("L_NOTICE", "KAM_HOST: ($ci) -> DP
result='$var(dpuser)', attr='$var(dpattr)'\n");
setflag(FLAG_DIALPLAN);
} else {
xlog("L_NOTICE", "KAM_HOST: ($ci) -> No matching dialplan for
$ru\n");
}
} some other if statements here
with other pattern matches…
if
(isflagset(FLAG_DIALPLAN)) {
xlog("L_NOTICE", "KAM_HOST: ($ci) -> DP Attr is
$var(dpattr)\n");
if (ds_select_dst("$var(dpattr)", "0")) {
xlog("L_NOTICE", "KAM_HOST: ($ci) $pr $mi route[$rm][0] $fu
-> DST='$avp(s:dispatcher-dst)', \
GRP='$avp(s:dispatcher-grp)',
CNT='$avp(s:dispatcher-cnt)'\n");
} else {
xlog("L_NOTICE", "KAM_HOST: ($ci) $pr $mi route[$rm][0] $fu
-> $ru - No dst gateways found\n");
sl_send_reply("404", "No destination gateways found\n");
}
}
Thanks
This email with all information contained herein or
attached hereto may contain confidential and/or privileged information intended
for the addressee(s) only. If you have received this email in error, please
contact the sender and immediately delete this email in its entirety and any
attachments thereto.