If a user has an outbound CID defined and does a text search from Call Monitor in ARI, the result will be incorrect. In addition to matching CDR records with the specified text and the user's src/dst/channel/dstchannel, the search will also match all records containing that user's outbound CID even if they don't contain the search text.
The problem is in the getSearchText() function in callmonitor.module. The resulting SQL query looks something like this:
WHERE (a bunch of text tests) AND (extension tests) OR (outboundCID tests)
Since AND takes precedence over OR, the outboundCID test will match regardless of the text match. To solve this problem I enclosed the extension/CID tests in an outer set of parentheses like this:
WHERE (a bunch of text tests) AND ( (extension tests) OR (outboundCID tests) )
which seems to have solved the problem. Here is the patch I used:
--- callmonitor.module (original)
+++ callmonitor.module (modified)
@@ -631,6 +631,8 @@
$searchText .= "AND ";
}
+ $searchText .= "( ";
+
// allow entries to be viewed with users extension
$searchText .= "(src = '" . $_SESSION['ari_user']['extension'] . "'
OR dst = '" . $_SESSION['ari_user']['extension'] . "'
@@ -646,6 +648,8 @@
$searchText .= "OR (src = '" . $_SESSION['ari_user']['outboundCID'] . "'
OR dst = '" . $_SESSION['ari_user']['outboundCID'] . "')";
}
+
+ $searchText .= ") ";
}
return $searchText;
Thanks,
Lee