Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.

SMS Media Urls #366

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion OpenVBX/controllers/messages/message_text.php
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions OpenVBX/models/vbx_sms_message.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down