diff --git a/src/mod/event_handlers/mod_rayo/srgs.c b/src/mod/event_handlers/mod_rayo/srgs.c index b86704828f..0f387c1e69 100644 --- a/src/mod/event_handlers/mod_rayo/srgs.c +++ b/src/mod/event_handlers/mod_rayo/srgs.c @@ -1241,12 +1241,16 @@ static int is_match_end(pcre *compiled_regex, const char *input) search = search_set; } search_input[input_size] = *search++; - result = pcre_exec(compiled_regex, NULL, search_input, input_size + 1, 0, 0, + result = pcre_exec(compiled_regex, NULL, search_input, input_size + 1, 0, PCRE_PARTIAL, ovector, sizeof(ovector) / sizeof(ovector[0])); if (result > 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "not match end\n"); return 0; } + if (result == PCRE_ERROR_PARTIAL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "partial match possible - not match end\n"); + return 0; + } } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "is match end\n"); return 1; diff --git a/src/mod/event_handlers/mod_rayo/test_srgs/main.c b/src/mod/event_handlers/mod_rayo/test_srgs/main.c index 2a102e8939..237e9edad3 100644 --- a/src/mod/event_handlers/mod_rayo/test_srgs/main.c +++ b/src/mod/event_handlers/mod_rayo/test_srgs/main.c @@ -11,8 +11,9 @@ static const char *adhearsion_menu_grammar = " \n" " 01\n" " 15\n" - " 27\n" + " 77\n" " 39\n" + " 4715\n" " \n" " \n" "\n"; @@ -43,8 +44,10 @@ static void test_match_adhearsion_menu_grammar(void) ASSERT_STRING_EQUALS("1", interpretation); ASSERT_EQUALS(SMT_NO_MATCH, srgs_grammar_match(grammar, "6", &interpretation)); ASSERT_NULL(interpretation); - ASSERT_EQUALS(SMT_MATCH_END, srgs_grammar_match(grammar, "7", &interpretation)); - ASSERT_STRING_EQUALS("2", interpretation); + ASSERT_EQUALS(SMT_MATCH, srgs_grammar_match(grammar, "7", &interpretation)); + ASSERT_STRING_EQUALS("7", interpretation); + ASSERT_EQUALS(SMT_MATCH_END, srgs_grammar_match(grammar, "715", &interpretation)); + ASSERT_STRING_EQUALS("4", interpretation); ASSERT_EQUALS(SMT_NO_MATCH, srgs_grammar_match(grammar, "8", &interpretation)); ASSERT_NULL(interpretation); ASSERT_EQUALS(SMT_MATCH_END, srgs_grammar_match(grammar, "9", &interpretation));