From 1bd596000d946a76ba30401c00f2efd98841d356 Mon Sep 17 00:00:00 2001 From: Aron Podrigal Date: Wed, 15 Jan 2025 14:37:18 -0600 Subject: [PATCH] [mod_dptools] Fix handling of "exec" and "api" parsing of flags. Without this, flags have no effect on api. --- .../applications/mod_dptools/mod_dptools.c | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index d134576fb9..580c316aaf 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -185,28 +185,32 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match) switch_channel_get_name(channel), act->string, act->value); if (!strncasecmp(string, "exec", 4)) { - char *e; - + exec = 1; string += 4; if (*string == ':') { string++; - exec = 1; - } else if (*string == '[') { - flags = string; - if ((e = switch_find_end_paren(flags, '[', ']'))) { - if (*++e == ':') { - flags++; - *e++ = '\0'; - string = e; - exec = strchr(flags, 'i') ? 2 : 1; - } - } } } else if (!strncasecmp(string, "api:", 4)) { string += 4; api = 1; } + if (*string == '[') { + char *e; + + flags = string; + if ((e = switch_find_end_paren(flags, '[', ']'))) { + if (e && *++e == ':') { + flags++; + *e++ = '\0'; + string = e; + if (exec) { + exec = strchr(flags, 'i') ? 2 : 1; + } + } + } + } + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, string, act->value); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "digits", match->match_digits);