[Asterisk-cvs] asterisk/res res_features.c,1.66,1.67
kpfleming
kpfleming
Tue Aug 23 10:38:02 CDT 2005
Update of /usr/cvsroot/asterisk/res
In directory mongoose.digium.com:/tmp/cvs-serv15521/res
Modified Files:
res_features.c
Log Message:
ensure that features are not duplicated during reload (issue #3764, take two)
Index: res_features.c
===================================================================
RCS file: /usr/cvsroot/asterisk/res/res_features.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- res_features.c 23 Aug 2005 02:22:33 -0000 1.66
+++ res_features.c 23 Aug 2005 14:40:03 -0000 1.67
@@ -882,6 +882,15 @@
free(feature);
}
+static void ast_unregister_features(void)
+{
+ struct ast_call_feature *feature;
+
+ AST_LIST_LOCK(&feature_list);
+ while ((feature = AST_LIST_REMOVE_HEAD(&feature_list,feature_entry)))
+ free(feature);
+ AST_LIST_UNLOCK(&feature_list);
+}
/* find a feature by name */
static struct ast_call_feature *find_feature(char *name)
@@ -1766,11 +1775,16 @@
ast_cli(fd, "\n");
ast_cli(fd, format, "Dynamic Feature", "Default", "Current");
ast_cli(fd, format, "---------------", "-------", "-------");
- AST_LIST_LOCK(&feature_list);
- AST_LIST_TRAVERSE(&feature_list, feature, feature_entry) {
- ast_cli(fd, format, feature->sname, "no def", feature->exten);
+ if (AST_LIST_EMPTY(&feature_list)) {
+ ast_cli(fd, "(none)\n");
+ }
+ else {
+ AST_LIST_LOCK(&feature_list);
+ AST_LIST_TRAVERSE(&feature_list, feature, feature_entry) {
+ ast_cli(fd, format, feature->sname, "no def", feature->exten);
+ }
+ AST_LIST_UNLOCK(&feature_list);
}
- AST_LIST_UNLOCK(&feature_list);
return RESULT_SUCCESS;
}
@@ -1968,6 +1982,7 @@
}
/* Map a key combination to an application*/
+ ast_unregister_features();
var = ast_variable_browse(cfg, "applicationmap");
while(var) {
char *tmp_val=strdup(var->value);
@@ -1986,7 +2001,7 @@
if (app) app_args=strsep(&tmp_val,",");
if (!(app && strlen(app)) || !(exten && strlen(exten)) || !(party && strlen(party)) || !(var->name && strlen(var->name))) {
- ast_log(LOG_NOTICE, "Please check the feature Mapping Syntax, either extension, name or app aren't provided %s %s %s %s\n",app,exten,party,var->name);
+ ast_log(LOG_NOTICE, "Please check the feature Mapping Syntax, either extension, name, or app aren't provided %s %s %s %s\n",app,exten,party,var->name);
free(tmp_val);
var = var->next;
continue;
More information about the svn-commits
mailing list