Skip to content

Commit

Permalink
moving things to message because <Sms> is truncating already
Browse files Browse the repository at this point in the history
  • Loading branch information
dgershman committed Oct 2, 2018
1 parent 59c998f commit a8e3ce9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
11 changes: 9 additions & 2 deletions meeting-search.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
<?php
include 'config.php';
include 'functions.php';
require_once 'vendor/autoload.php';
use Twilio\Rest\Client;
header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";

$sid = $GLOBALS['twilio_account_sid'];
$token = $GLOBALS['twilio_auth_token'];
$client = new Client( $sid, $token );

$latitude = $_REQUEST['Latitude'];
$longitude = $_REQUEST['Longitude'];
Expand Down Expand Up @@ -57,12 +64,12 @@
}

if (json_decode(setting('include_map_link'))) $results[2] .= " https://google.com/maps?q=" . $filtered_list[$i]->latitude . "," . $filtered_list[$i]->longitude;
$message = "<Sms>" . $results[0] . $text_space . $results[1] . $text_space . $results[2] . "</Sms>";
$message = $results[0] . $text_space . $results[1] . $text_space . $results[2];
error_log($message);
if (json_decode(setting("sms_ask")) && !isset($_REQUEST["SmsSid"])) {
array_push($sms_messages, $message);
} else {
echo $message;
$client->messages->create($_REQUEST['From'], array("from" => $_REQUEST['To'], "body" => $message));
}

$results_counter++;
Expand Down
9 changes: 8 additions & 1 deletion post-call-action.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
<?php
include 'config.php';
include 'functions.php';
require_once 'vendor/autoload.php';
use Twilio\Rest\Client;
header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";

$sid = $GLOBALS['twilio_account_sid'];
$token = $GLOBALS['twilio_auth_token'];
$client = new Client( $sid, $token );

$sms_messages = isset($_REQUEST['Payload']) ? json_decode(urldecode($_REQUEST["Payload"])) : [];
$digits = getIvrResponse();

echo "<Response>";

if (($digits == 1 || $digits == 3) && count( $sms_messages ) > 0 ) {
for ( $i = 0; $i < count( $sms_messages ); $i ++ ) {
echo $sms_messages[ $i ];
$message = $client->messages->create($_REQUEST['From'], array("from" => $_REQUEST['To'], "body" => $sms_messages[$i]));
}
}

Expand Down

0 comments on commit a8e3ce9

Please sign in to comment.