diff --git a/OpenVBX/controllers/messages/message_text.php b/OpenVBX/controllers/messages/message_text.php index 4185efc8..e193ee8d 100644 --- a/OpenVBX/controllers/messages/message_text.php +++ b/OpenVBX/controllers/messages/message_text.php @@ -37,6 +37,7 @@ function index($message_id = false) $content = substr($this->input->post('content'), 0, 1600); $to = $this->input->post('to'); $from = $this->input->post('from'); + $mediaUrls = $this->input->post('media_urls'); $numbers = array(); if(empty($from)) @@ -75,7 +76,7 @@ function index($message_id = false) try { - $this->vbx_sms_message->send_message($from, $to, $content); + $this->vbx_sms_message->send_message($from, $to, $content, $mediaUrls); if($message_id) { $annotation_id = $this->vbx_message->annotate($message_id, diff --git a/OpenVBX/models/vbx_sms_message.php b/OpenVBX/models/vbx_sms_message.php index def28687..d3662b49 100644 --- a/OpenVBX/models/vbx_sms_message.php +++ b/OpenVBX/models/vbx_sms_message.php @@ -92,14 +92,15 @@ function get_messages($offset = 0, $page_size = 20) return $output; } - function send_message($from, $to, $message) + function send_message($from, $to, $message, $mediaUrls = null) { $from = PhoneNumber::normalizePhoneNumberToE164($from); $to = PhoneNumber::normalizePhoneNumberToE164($to); + $mediaUrls = ($mediaUrls==''?null:$mediaUrls); try { $account = OpenVBX::getAccount(); - $response = $account->messages->sendMessage($from, $to, $message); + $response = $account->messages->sendMessage($from, $to, $message, $mediaUrls); } catch (Exception $e) { throw new VBX_Sms_messageException($e->getMessage());