In the below script, which was written by an unknown third party, the only changes I've made were changing the value of $to, $from, and $body from hard-coded strings to $_GET elements. The aim of the project is to pass some parameters to this script in a query string, and then compose and send and SMS message with it.
<?php
/**** **** **** **** **** **** **** **** **** **** ****
* sms.php
*
* sample PHP code to send an SMS message to a registered
* extension on a FreeBX 12 server
*
* version history
* 2015-09-22 version 0 by lgaetz@sangoma.com
**** **** **** **** **** **** **** **** **** **** ****/
// Load the FreeBPX bootstrap, requires FreePBX 12
if (!@include_once(getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) {
include_once('/etc/asterisk/freepbx.conf');
}
// The Asterisk Manager Class from the boostrap is $astman
// If using FreePBX 13+ must set asman with
// $astman = new AGI_AsteriskManager( );
if ($astman) {
// $to = "sip:#######";
// $from = '"Caller ID Name" <#######>';
// $body = "cats are yummy";
$to = $_GET['to'];
$from = $_GET['from'];
$body = $_GET['body'];
$result = $astman->MessageSend($to, $from, $body);
print_r($result); //debug
// the variable $result will be an array of the formats
// Array ( [Response] => Success [Message] => Message successfully sent )
// Array ( [Response] => Error [Message] => Message failed to send. )
} else {
echo "No Asterisk Manager Connection";
}
However, even though this script works fine with those commented-out hard-coded values, changing those values to $_GET elements results in this error message:
Array ( [Response] => Error [Message] => Message technology not found. )
I'm trying to find some sort of documentation to explain to me how this works... Any ideas from anyone else who's worked with FreePBX bootstrap?