summaryrefslogtreecommitdiff
path: root/main/pbx.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2014-08-07 14:17:54 +0000
committerMatthew Jordan <mjordan@digium.com>2014-08-07 14:17:54 +0000
commit98af8fb7159e37d4a84950af75873da20bfda439 (patch)
treef175d481628979071a4dbfb037049bb3dbb5d718 /main/pbx.c
parent36878ed1d1675eceab1c27f3ec74af052c8be4fb (diff)
pbx: Filter out pattern matching hints in responses sent to ExtensionStateList
Hints that are a pattern match are technically stored in the hint container in the same fashion as concrete implementations of hints. The pattern matching hints, however, are not "real" in the sense that things can subscribe to them: rather, they are stored in the hints container so that when a subscription is made a "real" hint can be generated for the subscription if one does not yet exist. The extension state core takes care of this correctly by matching against non-pattern matching extensions prior to pattern matching extensions. Because of this, however, the ExtensionStateList AMI action was returning pattern matching hints when executed. These hints are meaningless from the perspective of AMI clients: their state will never change, they cannot be subscribed to, and events would never normally be generated from them. As such, we now filter these out of the response. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420309 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/pbx.c')
-rw-r--r--main/pbx.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/main/pbx.c b/main/pbx.c
index 2dda2003d..785175fc4 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -11980,6 +11980,7 @@ static int action_extensionstatelist(struct mansession *s, const struct message
const char *action_id = astman_get_header(m, "ActionID");
struct ast_hint *hint;
struct ao2_iterator it_hints;
+ int hint_count = 0;
if (!hints) {
astman_send_error(s, m, "No dialplan hints are available");
@@ -11993,6 +11994,18 @@ static int action_extensionstatelist(struct mansession *s, const struct message
for (; (hint = ao2_iterator_next(&it_hints)); ao2_ref(hint, -1)) {
ao2_lock(hint);
+
+ /* Ignore pattern matching hints; they are stored in the
+ * hints container but aren't real from the perspective of
+ * an AMI user
+ */
+ if (hint->exten->exten[0] == '_') {
+ ao2_unlock(hint);
+ continue;
+ }
+
+ ++hint_count;
+
astman_append(s, "Event: ExtensionStatus\r\n");
if (!ast_strlen_zero(action_id)) {
astman_append(s, "ActionID: %s\r\n", action_id);
@@ -12015,7 +12028,7 @@ static int action_extensionstatelist(struct mansession *s, const struct message
astman_append(s, "ActionID: %s\r\n", action_id);
}
astman_append(s, "EventList: Complete\r\n"
- "ListItems: %d\r\n\r\n", ao2_container_count(hints));
+ "ListItems: %d\r\n\r\n", hint_count);
ao2_iterator_destroy(&it_hints);
ao2_unlock(hints);