From 74dfd3fcead7e80fb97f0c2bd26f3c213415c67f Mon Sep 17 00:00:00 2001 From: Tilghman Lesher Date: Tue, 26 Aug 2008 18:05:58 +0000 Subject: [PATCH] Standardize the option names for consistency (but continue to work with the existing names for backwards compatibility). (closes issue #13370) Reported by: jsturtevant git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@140167 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_followme.c | 53 ++++++++++++++++++++++-------------- configs/followme.conf.sample | 24 ++++++++-------- 2 files changed, 45 insertions(+), 32 deletions(-) diff --git a/apps/app_followme.c b/apps/app_followme.c index 84fe26c082..7e9cd56578 100644 --- a/apps/app_followme.c +++ b/apps/app_followme.c @@ -313,37 +313,50 @@ static int reload_followme(int reload) featuredigittimeout = 5000; } - takecallstr = ast_variable_retrieve(cfg, "general", "takecall"); - if (!ast_strlen_zero(takecallstr)) + if ((takecallstr = ast_variable_retrieve(cfg, "general", "takecall")) && !ast_strlen_zero(takecallstr)) { ast_copy_string(takecall, takecallstr, sizeof(takecall)); + } - declinecallstr = ast_variable_retrieve(cfg, "general", "declinecall"); - if (!ast_strlen_zero(declinecallstr)) + if ((declinecallstr = ast_variable_retrieve(cfg, "general", "declinecall")) && !ast_strlen_zero(declinecallstr)) { ast_copy_string(nextindp, declinecallstr, sizeof(nextindp)); + } - tmpstr = ast_variable_retrieve(cfg, "general", "call-from-prompt"); - if (!ast_strlen_zero(tmpstr)) + if ((tmpstr = ast_variable_retrieve(cfg, "general", "call-from-prompt")) && !ast_strlen_zero(tmpstr)) { ast_copy_string(callfromprompt, tmpstr, sizeof(callfromprompt)); + } else if ((tmpstr = ast_variable_retrieve(cfg, "general", "call_from_prompt")) && !ast_strlen_zero(tmpstr)) { + ast_copy_string(callfromprompt, tmpstr, sizeof(callfromprompt)); + } - tmpstr = ast_variable_retrieve(cfg, "general", "norecording-prompt"); - if (!ast_strlen_zero(tmpstr)) + if ((tmpstr = ast_variable_retrieve(cfg, "general", "norecording-prompt")) && !ast_strlen_zero(tmpstr)) { ast_copy_string(norecordingprompt, tmpstr, sizeof(norecordingprompt)); + } else if ((tmpstr = ast_variable_retrieve(cfg, "general", "norecording_prompt")) && !ast_strlen_zero(tmpstr)) { + ast_copy_string(callfromprompt, tmpstr, sizeof(callfromprompt)); + } - tmpstr = ast_variable_retrieve(cfg, "general", "options-prompt"); - if (!ast_strlen_zero(tmpstr)) + + if ((tmpstr = ast_variable_retrieve(cfg, "general", "options-prompt")) && !ast_strlen_zero(tmpstr)) { ast_copy_string(optionsprompt, tmpstr, sizeof(optionsprompt)); + } else if ((tmpstr = ast_variable_retrieve(cfg, "general", "options_prompt")) && !ast_strlen_zero(tmpstr)) { + ast_copy_string(optionsprompt, tmpstr, sizeof(optionsprompt)); + } - tmpstr = ast_variable_retrieve(cfg, "general", "pls-hold-prompt"); - if (!ast_strlen_zero(tmpstr)) - ast_copy_string(plsholdprompt, tmpstr, sizeof(plsholdprompt)); + if ((tmpstr = ast_variable_retrieve(cfg, "general", "pls-hold-prompt")) && !ast_strlen_zero(tmpstr)) { + ast_copy_string(optionsprompt, tmpstr, sizeof(optionsprompt)); + } else if ((tmpstr = ast_variable_retrieve(cfg, "general", "pls_hold_prompt")) && !ast_strlen_zero(tmpstr)) { + ast_copy_string(optionsprompt, tmpstr, sizeof(optionsprompt)); + } - tmpstr = ast_variable_retrieve(cfg, "general", "status-prompt"); - if (!ast_strlen_zero(tmpstr)) - ast_copy_string(statusprompt, tmpstr, sizeof(statusprompt)); + if ((tmpstr = ast_variable_retrieve(cfg, "general", "status-prompt")) && !ast_strlen_zero(tmpstr)) { + ast_copy_string(optionsprompt, tmpstr, sizeof(optionsprompt)); + } else if ((tmpstr = ast_variable_retrieve(cfg, "general", "status_prompt")) && !ast_strlen_zero(tmpstr)) { + ast_copy_string(optionsprompt, tmpstr, sizeof(optionsprompt)); + } - tmpstr = ast_variable_retrieve(cfg, "general", "sorry-prompt"); - if (!ast_strlen_zero(tmpstr)) - ast_copy_string(sorryprompt, tmpstr, sizeof(sorryprompt)); + if ((tmpstr = ast_variable_retrieve(cfg, "general", "sorry-prompt")) && !ast_strlen_zero(tmpstr)) { + ast_copy_string(optionsprompt, tmpstr, sizeof(optionsprompt)); + } else if ((tmpstr = ast_variable_retrieve(cfg, "general", "sorry_prompt")) && !ast_strlen_zero(tmpstr)) { + ast_copy_string(optionsprompt, tmpstr, sizeof(optionsprompt)); + } /* Chug through config file */ while ((cat = ast_category_browse(cfg, cat))) { @@ -376,7 +389,7 @@ static int reload_followme(int reload) init_profile(f); free_numbers(f); var = ast_variable_browse(cfg, cat); - while(var) { + while (var) { if (!strcasecmp(var->name, "number")) { int idx = 0; diff --git a/configs/followme.conf.sample b/configs/followme.conf.sample index 697e5a69c2..a8a9955bbb 100644 --- a/configs/followme.conf.sample +++ b/configs/followme.conf.sample @@ -13,23 +13,23 @@ declinecall=>2 ; The global default keypress for the callee to decline taking the current call. This can ; be a single digit or multiple digits. Default is "2". ; -call-from-prompt=>followme/call-from +call_from_prompt=>followme/call-from ; The global default for the 'Incoming call from' message. ; -norecording-prompt=>followme/no-recording +norecording_prompt=>followme/no-recording ; The global default for the 'You have an incoming call' message when the caller elects ; not to leave their name or the option isn't set for them to do so. ; -options-prompt=>followme/options +options_prompt=>followme/options ; The global default for the 'Press 1 to accept this call or press 2 to decline it' message. ; -pls-hold-prompt=>followme/pls-hold-while-try +pls_hold_prompt=>followme/pls-hold-while-try ; The global default for 'Please hold while we try and connect your call' message. ; -status-prompt=>followme/status +status_prompt=>followme/status ; The global default for 'The party you're calling isn't at their desk' message. ; -sorry-prompt=>followme/sorry +sorry_prompt=>followme/sorry ; The global default for 'I'm sorry, but we were unable to locate your party' message. ; ; @@ -59,27 +59,27 @@ declinecall=>2 ; The keypress for the callee to decline taking the current call. This can ; be a single digit or multiple digits. Default is the global default. ; -call-from-prompt=>followme/call-from +call_from_prompt=>followme/call-from ; The 'Incoming call from' message prompt. Default is the global default. ; -followme-norecording-prompt=>followme/no-recording +norecording_prompt=>followme/no-recording ; The 'You have an incoming call' message prompt when the caller elects ; not to leave their name or the option isn't set for them to do so. Default ; is the global default. ; -followme-options-prompt=>followme/options +options_prompt=>followme/options ; The 'Press 1 to accept this call or press 2 to decline it' message prompt. ; Default is the global default. ; -followme-pls-hold-prompt=>followme/pls-hold-while-try +pls_hold_prompt=>followme/pls-hold-while-try ; The 'Please hold while we try and connect your call' message prompt. ; Default is the global default. ; -followme-status-prompt=>followme/status +status_prompt=>followme/status ; The 'The party you're calling isn't at their desk' message prompt. ; Default is the global default. ; -followme-sorry-prompt=>followme/sorry +sorry_prompt=>followme/sorry ; The 'I'm sorry, but we were unable to locate your party' message prompt. Default ; is the global default.