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);