diff options
author | kmoore <kmoore@f38db490-d61c-443f-a65b-d21fe96a405b> | 2011-06-13 20:44:59 +0000 |
---|---|---|
committer | kmoore <kmoore@f38db490-d61c-443f-a65b-d21fe96a405b> | 2011-06-13 20:44:59 +0000 |
commit | 4192b213260af837c245e38e9eae338a9b6feb94 (patch) | |
tree | 7bf832e1108872ee606a275924fea3e50604b1dd /apps | |
parent | d183507c94ac639535415139106da6d5aa311bd9 (diff) |
Config inheritance doesn't work with ConfBridge() menu definitions
Current behavior in ConfBridge menu definitions is that first definition takes
precedence, even in templated situations. This change allows inheritance and
overriding to work as expected so that the last definition takes precedence.
(closes ASTERISK-17986)
Review: https://reviewboard.asterisk.org/r/1267/
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@323272 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r-- | apps/confbridge/conf_config_parser.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/apps/confbridge/conf_config_parser.c b/apps/confbridge/conf_config_parser.c index dbec32bba..3d1f31326 100644 --- a/apps/confbridge/conf_config_parser.c +++ b/apps/confbridge/conf_config_parser.c @@ -582,7 +582,7 @@ static int add_action_to_menu_entry(struct conf_menu_entry *menu_entry, enum con static int add_menu_entry(struct conf_menu *menu, const char *dtmf, const char *action_names) { - struct conf_menu_entry *menu_entry = NULL; + struct conf_menu_entry *menu_entry = NULL, *cur = NULL; int res = 0; char *tmp_action_names = ast_strdupa(action_names); char *action = NULL; @@ -691,6 +691,16 @@ static int add_menu_entry(struct conf_menu *menu, const char *dtmf, const char * return -1; } + /* remove any list entry with an identical DTMF sequence for overrides */ + AST_LIST_TRAVERSE_SAFE_BEGIN(&menu->entries, cur, entry) { + if (!strcasecmp(cur->dtmf, menu_entry->dtmf)) { + AST_LIST_REMOVE_CURRENT(entry); + ast_free(cur); + break; + } + } + AST_LIST_TRAVERSE_SAFE_END; + AST_LIST_INSERT_TAIL(&menu->entries, menu_entry, entry); return 0; |