Review Board 1.7.16


[18801] - features reload does not clear old configuration and always include 700 on parkedcalls : patch

Review Request #1161 - Created April 6, 2011 and submitted

Jonathan Rose
18801
Reviewers
asterisk-dev
dvossel, rbyrant
Asterisk
This fix follows a completely different approach from the other one, so I created a new review request.
This fix involves wiping all the parking lots in the parkinglots ao2_container while purging their extensions so that they have to be rebuilt when features reload is performed.

I have a bit more confidence in this one.  It's much more additive and much less destructive than the last one.
Tested with multiple parking lots, changing multiple parking lots, with and without [general], with general and then without general and then with general again (which showed a need for an additional change), and mixes of all the above.

Changes between revision 1 and 2

1 2
1 2

  1. /trunk/main/features.c: Loading...
/trunk/main/features.c
Diff Revision 1 Diff Revision 2
[20] 4860 lines
[+20] [+] static int load_config(void)
4861
	{
4861
	{
4862
		struct ast_parkinglot *p;
4862
		struct ast_parkinglot *p;
4863
		struct ao2_iterator iter = ao2_iterator_init(parkinglots, 0);
4863
		struct ao2_iterator iter = ao2_iterator_init(parkinglots, 0);
4864

    
   
4864

   
4865
		while ((p = ao2_iterator_next(&iter))) {
4865
		while ((p = ao2_iterator_next(&iter))) {
4866
			if ((con = ast_context_find(p->parking_con))) {

   
4867
				ast_context_destroy(con, registrar);
Moved to 4925

   
4868
			}
Moved to 4926

   
4869
			if ((con = ast_context_find(p->parking_con_dial))) {

   
4870
				ast_context_destroy(con, registrar);

   
4871
			}

   
4872
			ao2_unlink(parkinglots, p);
4866
			ao2_unlink(parkinglots, p);
4873
			parkinglot_destroy(p);
4867
			ao2_ref(p,-1);
4874
		}
4868
		}
4875
	}
4869
	}
4876
	
4870
	
4877
	default_parkinglot = build_parkinglot(DEFAULT_PARKINGLOT, NULL);
4871
	default_parkinglot = build_parkinglot(DEFAULT_PARKINGLOT, NULL);
4878
	if (default_parkinglot) {
4872
	if (default_parkinglot) {
[+20] [20] 43 lines
[+20] static int load_config(void)
4922
	if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID) {
4916
	if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID) {
4923
		ast_log(LOG_WARNING,"Could not load features.conf\n");
4917
		ast_log(LOG_WARNING,"Could not load features.conf\n");
4924
		return 0;
4918
		return 0;
4925
	}
4919
	}
4926

    
   
4920

   
4927
	if ((var = ast_variable_browse(cfg, "general"))) {
4921
	if (var = ast_variable_browse(cfg, "general")) {
4928
		/* if we find a general context in features.conf, we need to clear our existing default context */
4922
		/* Find a general context in features.conf, we need to clear our existing default context */
4929
		if ((con = ast_context_find("parkedcalls"))) {
4923
		/* Can't outright destroy the parking lot because it's needed in a little while. */
4930
			ast_context_destroy(con, NULL);
4924
		if ((con = ast_context_find(default_parkinglot->parking_con))) {
Moved from 4867

    
   
4925
			ast_context_destroy(con, registrar);
Moved from 4868

    
   
4926
		}

    
   
4927
		if ((con = ast_context_find(default_parkinglot->parking_con_dial))) {

    
   
4928
			ast_context_destroy(con, registrar);
4931
		}
4929
		}
4932
	} 
4930
	} 
4933

    
   
4931

   
4934
	for (; var; var = var->next) {
4932
	for (; var; var = var->next) {
4935
		if (!strcasecmp(var->name, "parkext")) {
4933
		if (!strcasecmp(var->name, "parkext")) {
[+20] [20] 1172 lines
  1. /trunk/main/features.c: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.