Fuck you, dark theme

This commit is contained in:
Christopher Cookman 2025-12-20 15:47:19 -07:00
parent d68345caa9
commit c5a5e5893b
2 changed files with 116 additions and 3 deletions

File diff suppressed because one or more lines are too long

107
usr/bin/ast_originate Normal file
View file

@ -0,0 +1,107 @@
#!/usr/bin/env php
<?php
/*
Arguments:
1- number to dial
2- context.exten.priority
3- optional delay in seconds
4- timeout (optional)
5- base64 callerid (optional)
6+ VAR=value pairs (optional)
Example:
callback.php 14032448089 ext-meetme.200.1 0 300 $(echo -n "Callback <1000>" | base64) \
CUSTOMER_ID=42 CAMPAIGN=meetme AUTOANSWER=yes
*/
if ($argc < 3) {
cb_fatal(
"Usage:\n".
"{$argv[0]} <number> <context.exten.priority> [delay] [timeout] [callerid_b64] [VAR=value ...]\n"
);
}
$callback_number = $argv[1];
$callback_destination = $argv[2];
$pause_seconds = isset($argv[3]) ? (int)$argv[3] : 0;
$callback_timeout = isset($argv[4]) ? (int)$argv[4] : 300;
$callback_callerid = isset($argv[5]) ? base64_decode($argv[5]) : "";
/*
* Collect remaining arguments as channel variables
*/
/*
* Collect remaining arguments as channel variables (ASSOCIATIVE ARRAY)
*/
$variable = [];
/*for ($i = 6; $i < $argc; $i++) {
if (strpos($argv[$i], '=') !== false) {
list($k, $v) = explode('=', $argv[$i], 2);
$variable[$k] = $v;
}
}*/
/*
* AMI expects variables as:
* VAR1=value|VAR2=value
*/
// Bootstrap FreePBX / AMI
$restrict_mods = true;
$bootstrap_settings['freepbx_auth'] = false;
include '/etc/freepbx.conf';
if ($pause_seconds > 0) {
sleep($pause_seconds);
}
// Parse destination
$dest = explode(".", $callback_destination);
if (count($dest) !== 3) {
cb_fatal("Destination must be context.exten.priority");
}
$callback_context = $dest[0];
$callback_exten = $dest[1];
$callback_priority = $dest[2];
// Originate parameters
$channel = "Local/{$callback_number}@from-internal";
$exten = $callback_exten;
$context = $callback_context;
$priority = $callback_priority;
$timeout = $callback_timeout;
$callerid = $callback_callerid;
$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);
}
?>