channels: Allow updating variable value

When modifying an already defined variable in some channel drivers they
add a new variable with the same name to the list, but that value is
never used, only the first one found.

Introduce ast_variable_list_replace() and use it where appropriate.

ASTERISK-23756 #close
Patches:
  setvar-multiplie.patch submitted by Michael Goryainov

Change-Id: Ie1897a96c82b8945e752733612ee963686f32839
This commit is contained in:
Sean Bright
2019-09-11 16:58:29 -04:00
parent 02dfc89007
commit 32ce6e9a06
6 changed files with 55 additions and 11 deletions

View File

@@ -1044,7 +1044,9 @@ static int set_var_handler(const struct aco_option *opt,
return -1;
}
ast_variable_list_append(&endpoint->channel_vars, new_var);
if (ast_variable_list_replace(&endpoint->channel_vars, new_var)) {
ast_variable_list_append(&endpoint->channel_vars, new_var);
}
return 0;
}