Hi!
Kamailio 4.1.4. When using avp_check with fnmatch and AVP the result is
always TRUE if it is true for 1 time. It only happens with $avp(), but
not with $var().
Is this a bug or some special behavior of AVPs?
xlog("L_ERR", "======= with $$avp(...)================");
$avp(rpid) = "+499539110";
$avp(pattern) = "+499539[2-5]"; # NO MATCH
if (avp_check("$avp(rpid)", "fm/$avp(pattern)/g")) {
xlog("L_ERR", "$avp(rpid) matches $avp(pattern): YES");
} else {
xlog("L_ERR", "$avp(rpid) matches $avp(pattern): NO");
}
$avp(pattern) = "+499539*"; # MATCH
if (avp_check("$avp(rpid)", "fm/$avp(pattern)/g")) {
xlog("L_ERR", "$avp(rpid) matches $avp(pattern): YES");
} else {
xlog("L_ERR", "$avp(rpid) matches $avp(pattern): NO");
}
$avp(pattern) = "+499539[2-5]"; # NO MATCH
if (avp_check("$avp(rpid)", "fm/$avp(pattern)/g")) {
xlog("L_ERR", "$avp(rpid) matches $avp(pattern): YES");
} else {
xlog("L_ERR", "$avp(rpid) matches $avp(pattern): NO");
}
xlog("L_ERR", "======= with $$var(...)================");
$var(rpid) = "+499539110";
$var(pattern) = "+499539[2-5]"; # NO MATCH
if (avp_check("$var(rpid)", "fm/$var(pattern)/g")) {
xlog("L_ERR", "$var(rpid) matches $var(pattern): YES");
} else {
xlog("L_ERR", "$var(rpid) matches $var(pattern): NO");
}
$var(pattern) = "+499539*"; # MATCH
if (avp_check("$var(rpid)", "fm/$var(pattern)/g")) {
xlog("L_ERR", "$var(rpid) matches $var(pattern): YES");
} else {
xlog("L_ERR", "$var(rpid) matches $var(pattern): NO");
}
$var(pattern) = "+499539[2-5]"; # NO MATCH
if (avp_check("$var(rpid)", "fm/$var(pattern)/g")) {
xlog("L_ERR", "$var(rpid) matches $var(pattern): YES");
} else {
xlog("L_ERR", "$var(rpid) matches $var(pattern): NO");
}
--> The result is:
<script>: ======= with $avp(...)================
<script>: +499539110 matches +499539[2-5]: NO
<script>: +499539110 matches +499539*: YES
<script>: +499539110 matches +499539[2-5]: YES
<script>: ======= with $var(...)================
<script>: +499539110 matches +499539[2-5]: NO
<script>: +499539110 matches +499539*: YES
<script>: +499539110 matches +499539[2-5]: NO
Thanks
Klaus