From ead1d43e34a4aeb5839c882d41304342093a62cf Mon Sep 17 00:00:00 2001 From: Danny Gershman Date: Mon, 22 Aug 2022 19:49:49 -0400 Subject: [PATCH] sms for incoming calls customizable #636 --- RELEASENOTES.md | 1 + lang/en-AU.php | 1 + lang/en-US.php | 1 + lang/es-US.php | 1 + lang/fr-CA.php | 1 + lang/it-IT.php | 1 + lang/pig-latin.php | 1 + lang/pt-BR.php | 1 + legacy/_includes/functions.php | 4 ++-- legacy/helpline-dialer.php | 2 +- 10 files changed, 11 insertions(+), 3 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 0e7f77cbb..26517bfb0 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -3,6 +3,7 @@ ### 4.2.0 (UNRELEASED) * Yap now requires PHP version 8.0 and higher. [#623] * Added support for downloading the list of volunteers in JSON format for a given service body. [#612] +* Added support for customizing SMS for incoming calls. [#636] * Show missed calls also as a percentage of total calls received. * Metric endpoint now returns volunteer missed and answered metrics, not exposed to UI yet. [#632] * Fixed an issue with reports not recursing more than one level. [#620] diff --git a/lang/en-AU.php b/lang/en-AU.php index 8f42c5436..c85efca98 100644 --- a/lang/en-AU.php +++ b/lang/en-AU.php @@ -105,3 +105,4 @@ $GLOBALS['to_speak_to_a_man'] = "to talk to a man"; $GLOBALS['to_speak_to_a_woman'] = "to talk to a woman"; $GLOBALS['speak_no_preference'] = "to speak to either"; +$GLOBALS['you_have_an_incoming_phoneline_call_from'] = "You have an incoming phoneline call from"; diff --git a/lang/en-US.php b/lang/en-US.php index 09217b8c1..9fc50cdb1 100644 --- a/lang/en-US.php +++ b/lang/en-US.php @@ -105,3 +105,4 @@ $GLOBALS['to_speak_to_a_man'] = "to talk to a man"; $GLOBALS['to_speak_to_a_woman'] = "to talk to a woman"; $GLOBALS['speak_no_preference'] = "to speak to either"; +$GLOBALS['you_have_an_incoming_phoneline_call_from'] = "You have an incoming phoneline call from"; diff --git a/lang/es-US.php b/lang/es-US.php index c3177f1b7..52c074bc0 100644 --- a/lang/es-US.php +++ b/lang/es-US.php @@ -105,3 +105,4 @@ $GLOBALS['to_speak_to_a_man'] = "to talk to a man"; $GLOBALS['to_speak_to_a_woman'] = "to talk to a woman"; $GLOBALS['speak_no_preference'] = "to speak to either"; +$GLOBALS['you_have_an_incoming_phoneline_call_from'] = "You have an incoming phoneline call from"; diff --git a/lang/fr-CA.php b/lang/fr-CA.php index 1a533e133..9880e9082 100644 --- a/lang/fr-CA.php +++ b/lang/fr-CA.php @@ -105,3 +105,4 @@ $GLOBALS['to_speak_to_a_man'] = "to talk to a man"; $GLOBALS['to_speak_to_a_woman'] = "to talk to a woman"; $GLOBALS['speak_no_preference'] = "to speak to either"; +$GLOBALS['you_have_an_incoming_phoneline_call_from'] = "You have an incoming phoneline call from"; diff --git a/lang/it-IT.php b/lang/it-IT.php index af611d4c1..183f03ef6 100644 --- a/lang/it-IT.php +++ b/lang/it-IT.php @@ -105,3 +105,4 @@ $GLOBALS['to_speak_to_a_man'] = "to talk to a man"; $GLOBALS['to_speak_to_a_woman'] = "to talk to a woman"; $GLOBALS['speak_no_preference'] = "to speak to either"; +$GLOBALS['you_have_an_incoming_phoneline_call_from'] = "You have an incoming phoneline call from"; diff --git a/lang/pig-latin.php b/lang/pig-latin.php index d0fa0bf5f..40ac12c3c 100644 --- a/lang/pig-latin.php +++ b/lang/pig-latin.php @@ -97,3 +97,4 @@ $GLOBALS['to_speak_to_a_man'] = "otay alktay otay ayay anmay"; $GLOBALS['to_speak_to_a_woman'] = "otay alktay otay ayay omanway"; $GLOBALS['speak_no_preference'] = "otay eakspay otay eitheryay"; +$GLOBALS['you_have_an_incoming_phoneline_call_from'] = "ouyay avehay anyay incomingyay onelinephay allcay omfray"; diff --git a/lang/pt-BR.php b/lang/pt-BR.php index edd7ab292..b9fc0952b 100644 --- a/lang/pt-BR.php +++ b/lang/pt-BR.php @@ -105,3 +105,4 @@ $GLOBALS['to_speak_to_a_man'] = "to talk to a man"; $GLOBALS['to_speak_to_a_woman'] = "to talk to a woman"; $GLOBALS['speak_no_preference'] = "to speak to either"; +$GLOBALS['you_have_an_incoming_phoneline_call_from'] = "You have an incoming phoneline call from"; diff --git a/legacy/_includes/functions.php b/legacy/_includes/functions.php index 52daa725b..25d7bcc93 100644 --- a/legacy/_includes/functions.php +++ b/legacy/_includes/functions.php @@ -1682,7 +1682,7 @@ function getHelplineSchedule($service_body_int) $finalSchedule = getVolunteerInfo($volunteers); usort($finalSchedule, function ($a, $b) { - return $a->sequence > $b->sequence; + return $a->sequence > $b->sequence ? 1 : -1; }); return json_encode($finalSchedule); @@ -1743,7 +1743,7 @@ function get_str_val($subject) } else { return "false"; } - } else if (is_array($subject)) { + } elseif (is_array($subject)) { return strval(json_encode($subject)); } diff --git a/legacy/helpline-dialer.php b/legacy/helpline-dialer.php index a1d283019..fb8a3c1f2 100644 --- a/legacy/helpline-dialer.php +++ b/legacy/helpline-dialer.php @@ -84,7 +84,7 @@ function getCallConfig($serviceBodyCallHandling, $tandem = VolunteerShadowOption $conferences = $twilioClient->conferences->read(array ("friendlyName" => $_REQUEST['FriendlyName'] )); if (count($conferences) > 0 && $conferences[0]->status != "completed") { $tandem = 0; - $sms_body = "You have an incoming phoneline call from "; + $sms_body = word('you_have_an_incoming_phoneline_call_from') . " "; if (isset($_REQUEST['StatusCallbackEvent']) && $_REQUEST['StatusCallbackEvent'] == 'participant-join' && ( isset($_REQUEST['SequenceNumber']) && intval($_REQUEST['SequenceNumber']) == 1 )) { setConferenceParticipant($_REQUEST['FriendlyName'], CallRole::CALLER);