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
This commit is contained in:
parent
36878ed1d1
commit
98af8fb715
15
main/pbx.c
15
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);
|
||||
|
|
Loading…
Reference in New Issue