Поменял местами номера, но скрипт не отрабатывает. переменные $channel, $exten, $context.
БЫЛО
Код: Выделить всё
$channel = "Local/".$callback_number."@from-internal";
$exten = $callback_exten;
$contex = $callback_context;
Код: Выделить всё
$channel = "SIP/".$callback_exten."@".$callback_context;
$exten = "Local/".$callback_number;
$contex = "@from-internal";
Где я ошибся?
Полный код скрипта:
Код: Выделить всё
#!/usr/bin/php -q
<?php
/*
This Callback script takes 7 arguments:
1- number to dial
2- context.exten.priority to dump number into
3- optional time in seconds to sleep before calling back
eg: callback 14032448089 ext-meetme.200.1
*/
//Copyright (C) 2004 Coalescent Systems Inc. (info@coalescentsystems.ca)
//Copyright (C) 2010 Astrogen LLC
//This file is part of FreePBX.
//
// FreePBX is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
//
// FreePBX is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with FreePBX. If not, see <http://www.gnu.org/licenses/>.
?>
<?php
if ($argc < 3) {
cb_fatal("Wrong number of arguments, should be:\n".$argv[0]." callback_number callback_destination [delay_seconds]\n");
}
$callback_number = $argv[1];
$callback_destination = $argv[2];
$pause_seconds = isset($argv[3]) ? $argv[3] : 0;
// bootstrap the connection to get astman up
//
$restrict_mods = true;
$bootstrap_settings['freepbx_auth'] = false;
if (!@include_once(getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) {
include_once('/etc/asterisk/freepbx.conf');
}
if($pause_seconds) {
sleep($pause_seconds);
}
// figure out context, exten, priority
$dest = explode(".",$callback_destination);
$callback_context = $dest[0];
$callback_exten = $dest[1];
$callback_priority = $dest[2];
//define the args for Originate
$channel = "Local/".$callback_number."@from-internal";
$exten = $callback_exten;
$context = $callback_context;
$priority = $callback_priority;
$timeout = "15000";
$callerid = "Callback";
$variable = "";
$account = "";
$application = "";
$data = "";
if ($bootstrap_settings['astman_connected']) {
$astman->Originate($channel, $exten, $context, $priority, $timeout, $callerid, $variable, $account, $application, $data);
$astman->disconnect();
} else {
cb_fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]);
}
function cb_fatal($text) {
echo "[FATAL] ".$text."\n";
exit(1);
}
?>