From: Marc Olivier Chouinard Date: Fri, 10 Sep 2010 02:43:27 +0000 (-0400) Subject: mod_directory: Add variable directory_search_order to allow to search by first name... X-Git-Tag: v1.2-rc1~353 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=163ca31f2c0e7bb4f3e71806fac8147f3c426fc4;p=thirdparty%2Ffreeswitch.git mod_directory: Add variable directory_search_order to allow to search by first name by default is set to "first_name" --- diff --git a/src/mod/applications/mod_directory/mod_directory.c b/src/mod/applications/mod_directory/mod_directory.c index d3389ab3b1..bfad1a68f6 100644 --- a/src/mod/applications/mod_directory/mod_directory.c +++ b/src/mod/applications/mod_directory/mod_directory.c @@ -884,6 +884,18 @@ SWITCH_STANDARD_APP(directory_function) if (strcasecmp(profile->search_order, "last_name")) { s_param.search_by_last_name = 0; } + + { + const char *var_search_order = switch_channel_get_variable(channel, "directory_search_order"); + if (var_search_order) { + if (!strcasecmp(var_search_order, "first_name")) { + s_param.search_by_last_name = 0; + } else { + s_param.search_by_last_name = 1; + } + } + } + attempts = profile->max_menu_attempt; s_param.try_again = 1; while (switch_channel_ready(channel) && (s_param.try_again && attempts-- > 0)) {