2

不明なサード パーティによって作成された以下のスクリプトで、私が行った変更は、$to、$from、および $body の値をハードコードされた文字列から $_GET 要素に変更したことだけです。プロジェクトの目的は、いくつかのパラメーターをクエリ文字列でこのスクリプトに渡し、作成して送信し、SMS メッセージを送信することです。

<?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";
}

ただし、このスクリプトはコメントアウトされたハードコードされた値で問題なく動作しますが、これらの値を $_GET 要素に変更すると、次のエラー メッセージが表示されます。

Array ( [Response] => Error [Message] => Message technology not found. )

これがどのように機能するかを説明するために、ある種のドキュメントを見つけようとしています... FreePBXブートストラップを使用したことがある他の人からのアイデアはありますか?

4

1 に答える 1