From eae76a3d1ef5e8d8097e89b854abc565a2aa062e Mon Sep 17 00:00:00 2001 From: Jamie McClelland Date: Wed, 10 Mar 2021 08:30:36 -0500 Subject: [PATCH] ensure we get the mobile phone number The values array is indexed using the phone id, so values[0] is empty. --- CRM/Smsinbox/SmsSender.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CRM/Smsinbox/SmsSender.php b/CRM/Smsinbox/SmsSender.php index e580c2e..c546cf3 100644 --- a/CRM/Smsinbox/SmsSender.php +++ b/CRM/Smsinbox/SmsSender.php @@ -34,7 +34,8 @@ public function sendSmsMessage($recipientContactId, $messageText, $smsProviderId } // Select the first mobile phone for the recipient. - $phone = $result['values'][0]['phone_numeric']; + $phone_values = array_shift($result['values']); + $phone = $phone_values['phone_numeric']; if (!$phone) { throw new CRM_Core_Exception("Contact id has no mobile phone numbers.", self::EXCEPTION_CODE_SMS_FAILED_INTERNAL);