Review Board 1.7.16


Add aliases for Directory

Review Request #2244 - Created Dec. 12, 2012 and submitted

Tilghman Lesher
Reviewers
asterisk-dev
Asterisk
This patch adds extra strings for comparison in the Directory application.  The purpose of this is to enable nicknames that otherwise would not be compared.  For example, Bob "Bongo Boy" Berman might have an alias of "Bongo", for which he would be searchable, even though his name would not normally include it.
Deployed and working on a production machine.

Changes between revision 1 and 2

1 2 3
1 2 3

  1. /trunk/apps/app_directory.c: Loading...
  2. /trunk/configs/voicemail.conf.sample: Loading...
  3. /trunk/contrib/realtime/mysql/voicemail.sql: Loading...
/trunk/apps/app_directory.c
Diff Revision 1 Diff Revision 2
[20] 487 lines
[+20] [+] static struct ast_config *realtime_directory(char *context)
488
			continue;
488
			continue;
489
		}
489
		}
490
		ast_str_set(&tmp, 0, "no-password,%s", S_OR(fullname, ""));
490
		ast_str_set(&tmp, 0, "no-password,%s", S_OR(fullname, ""));
491
		if (ast_variable_retrieve(rtdata, mailbox, "alias")) {
491
		if (ast_variable_retrieve(rtdata, mailbox, "alias")) {
492
			for (alias = ast_variable_browse(rtdata, mailbox); alias; alias = alias->next) {
492
			for (alias = ast_variable_browse(rtdata, mailbox); alias; alias = alias->next) {
493
				if (!strcmp(alias->name, "alias")) {
493
				if (!strcasecmp(alias->name, "alias")) {
494
					ast_str_append(&tmp, 0, "|alias=%s", alias->value);
494
					ast_str_append(&tmp, 0, "|alias=%s", alias->value);
495
				}
495
				}
496
			}
496
			}
497
		}
497
		}
498

    
   
498

   
[+20] [20] 110 lines
[+20] [+] static int search_directory_sub(const char *context, struct ast_config *vmcfg, struct ast_config *ucfg, const char *ext, struct ast_flags flags, itemlist *alist)
609
		}
609
		}
610
		if (!res && (alias = strcasestr(bufptr, "alias="))) {
610
		if (!res && (alias = strcasestr(bufptr, "alias="))) {
611
			char *a;
611
			char *a;
612
			ast_debug(1, "Found alias: %s\n", alias);
612
			ast_debug(1, "Found alias: %s\n", alias);
613
			while ((a = strsep(&alias, "|"))) {
613
			while ((a = strsep(&alias, "|"))) {
614
				if (!strncmp(a, "alias=", 6)) {
614
				if (!strncasecmp(a, "alias=", 6)) {
615
					if ((res = check_match(&item, context, a + 6, v->name, ext, 1))) {
615
					if ((res = check_match(&item, context, a + 6, v->name, ext, 1))) {
616
						break;
616
						break;
617
					}
617
					}
618
				}
618
				}
619
			}
619
			}
[+20] [20] 318 lines
/trunk/configs/voicemail.conf.sample
Diff Revision 1 Diff Revision 2
 
/trunk/contrib/realtime/mysql/voicemail.sql
Diff Revision 1 Diff Revision 2
 
  1. /trunk/apps/app_directory.c: Loading...
  2. /trunk/configs/voicemail.conf.sample: Loading...
  3. /trunk/contrib/realtime/mysql/voicemail.sql: 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.