From 5816ddcd39ae3f467caa43681db11b5e54c4a8e7 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Tue, 28 Apr 2015 14:38:38 -0400 Subject: [PATCH] FS-7490 #resolve #comment mod_rayo, srgs to regex transform: latest PCRE doesn't like regex generated by mod_rayo. It requires the group name not to start with a digit. --- src/mod/event_handlers/mod_rayo/srgs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mod/event_handlers/mod_rayo/srgs.c b/src/mod/event_handlers/mod_rayo/srgs.c index 5eff43f0a4..eaa32a9992 100644 --- a/src/mod/event_handlers/mod_rayo/srgs.c +++ b/src/mod/event_handlers/mod_rayo/srgs.c @@ -1,6 +1,6 @@ /* * mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2013-2014, Grasshopper + * Copyright (C) 2013-2015, Grasshopper * * Version: MPL 1.1 * @@ -1005,7 +1005,7 @@ static int create_regexes(struct srgs_grammar *grammar, struct srgs_node *node, struct srgs_node *item = node->child; if (node->value.item.repeat_min != 1 || node->value.item.repeat_max != 1 || node->value.item.tag) { if (node->value.item.tag) { - stream->write_function(stream, "(?P<%d>", node->value.item.tag); + stream->write_function(stream, "(?P", node->value.item.tag); } else { stream->write_function(stream, "%s", "(?:"); } @@ -1310,7 +1310,7 @@ enum srgs_match_type srgs_grammar_match(struct srgs_grammar *grammar, const char for (i = 1; i <= grammar->tag_count; i++) { char substring_name[16] = { 0 }; buffer[0] = '\0'; - snprintf(substring_name, 16, "%d", i); + snprintf(substring_name, 16, "tag%d", i); if (pcre_copy_named_substring(compiled_regex, input, ovector, result, substring_name, buffer, MAX_INPUT_SIZE) != PCRE_ERROR_NOSUBSTRING && !zstr_buf(buffer)) { *interpretation = grammar->tags[i]; break;