sox tarotgama.wav -t ul -r 8000 -c 1 tarotgama.ulaw
sox tarotgama.wav -r 8000 -c 1 -e signed -b 16 -t wav tarotgama_asterisk.wav
sox tarotgama.wav -t ul -r 8000 -c 1 tarotgama.ulaw
sox tarotgama.wav -r 8000 -c 1 -e signed -b 16 -t wav tarotgama_asterisk.wav
exten => 100,1,Answer()
same => n,Set(i=1) ; counter
same => n,AGI(getTotal.php,${userID}) ; sets vmtotal, body, mdate, recipient, etc.
same => n,While($[${i} <= ${vmtotal}])
same => n,Playback(message-number)
same => n,SayDigits(${i})
same => n,Playback(from)
same => n,Playback(${recipient})
same => n,Playback(at)
same => n,SayTime(${mtime})
same => n,Playback(${body})
same => n,Set(i=$[${i} + 1])
same => n,EndWhile()
same => n,Playback(no-more-msg)
same => n,Hangup()
same => n,ExecIf($["${isyou}" != "1" || "${isyou}"!="2"]?Playback(${audio_path_general}/no-valid-option))
same=>n,ExecIf($["${LEN(${userPin})}" < "4" && "${userPin}"!="#"]?Playback(${audio_path_general}/4-digits-required))
same=>n,ExecIf($[${LEN(${opt})} ="0"]?playback(${audio_path_general}/no-valid-option))
database connection file
db_con.php
<?php
// Enable error reporting
//error_reporting(E_ALL); // Report all errors
error_reporting(E_ERROR | E_PARSE); // Show only errors and parse errors
ini_set('display_errors', 1); // Display errors on the web page
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
// Database connection parameters
$host = "172.18.0.3";
$user = "root";
$password = "7133";
$database = "fm";
$mysqli = new mysqli("$host", "$user", "$password", "$database");
// Check for connection errors
if ($mysqli->connect_error) {
die("Connection failed: " . $mysqli->connect_error);
}
?>
#!/usr/bin/php -q
<?php
require(__DIR__."/getInfo.php");
$PhoneNum="$argv[1]";
$query_val_phone = "SELECT count(phoneNumber) as phoneNumber_num FROM users where phoneNumber='$PhoneNum'";
$registered=select($query_val_phone)[0]['phoneNumber_num'];
if($registered>0){
echo "EXEC Verbose \"User PhoneNum already registered\"\n";
echo "EXEC Goto \"music,100,1\"";
}
else {
echo "EXEC Verbose \"Phone number $PhoneNum is not registered\"\n";
echo "EXEC Goto \"singup-en,sign-1,1\"";
}
?>
1 apt update && o apt update
2 apt-get install unixodbc odbcinst
3 apt-get install alembic
4 apt install mariadb-server -y
5 systemctl enable mariadb.service
6 systemctl status mariadb.service
Change root mysql pass
1. mysqladmin -u root -p password 'asterisk'
create the asterisk db
2. mysqladmin -u root -pasterisk create asterisk
3 check the db
mysql -u root -p -D asterisk
apt-get install alembic
# cd contrib/ast-db-manage/
sqlalchemy.url = mysql://root:asterisk@localhost/asterisk
# cp config.ini.sample config.ini
# alembic -c config.ini upgrade head
# alembic -c config.ini upgrade head INFO [alembic.migration] Context impl MySQLImpl. INFO [alembic.migration] Will assume non-transactional DDL. INFO [alembic.migration] Running upgrade None -> 4da0c5f79a9c, Create tables INFO [alembic.migration] Running upgrade 4da0c5f79a9c -> 43956d550a44, Add tables for pjsip #
mysql -u root -p -D asterisk mysql> show tables; +--------------------+ | Tables_in_asterisk | +--------------------+ | alembic_version | | iaxfriends | | meetme | | musiconhold | | ps_aors | | ps_auths | | ps_contacts | | ps_domain_aliases | | ps_endpoint_id_ips | | ps_endpoints | | sippeers | | voicemail | +--------------------+ 12 rows in set (0.00 sec) mysql> quit
https://www.asterisk.org/configuring-realtime-voicemail-on-debian/
odbcinst -q -d
echo “select 1” | isql -v asterisk
module reload res_odbc.so Check connection asterisk_realtime*CLI> odbc show all ODBC DSN Settings ----------------- Name: asterisk DSN: asterisk Number of active connections: 1 (out of 1) Logging: Disabled Asterisk relatime configuration /etc/asterisk/sorcery.conf [res_pjsip] ; Realtime PJSIP configuration wizard endpoint=realtime,ps_endpoints auth=realtime,ps_auths aor=realtime,ps_aors domain_alias=realtime,ps_domain_aliases contact=realtime,ps_contacts [res_pjsip_endpoint_identifier_ip] identify=realtime,ps_endpoint_id_ips [res_pjsip_outbound_registration] registration=realtime,ps_registrations /etc/asterisk/extconfig.conf ps_endpoints => odbc,asterisk ps_auths => odbc,asterisk ps_aors => odbc,asterisk ps_domain_aliases => odbc,asterisk ps_endpoint_id_ips => odbc,asterisk ps_contacts => odbc,asterisk ps_registrations = odbc,asterisk etc/asterisk/modules.conf
|
RESTART the asterisk service after add the transport
core restart now
ALTER TABLE ps_contacts
ADD COLUMN qualify_2xx_only VARCHAR(255) AFTER qualify_timeout;
https://hotkey404.com/fix-missing-asterisk-library-error-libasteriskssl-so-1-libasteriskpj-so-2-not-found/
https://docs.vultr.com/how-to-install-mariadb-on-debian-12
https://asterisk-rd.blogspot.com/search?q=rocky
sudo apt install apache2
sudo apt install php php-mysql php-cli
sudo systemctl status apache2
sudo systemctl enable apache2
sudo systemctl restart apache2
1. Disable UFW (Temporarily)
sudo ufw disable
2. Check UFW Statussudo ufw status
3. Remove UFW (Optional)sudo apt remove --purge ufw
https://www.rfc-editor.org/rfc/rfc3261.html#section-10.3
#!/usr/bin/php
<?php
// Send the Read command to capture user input
echo "EXEC Read opt,demo-thanks,1\n";
flush(); // Ensure the command is sent to Asterisk
// Capture the response for EXEC Read
while (!feof(STDIN)) {
$line = trim(fgets(STDIN));
if (strpos($line, '200 result=') === 0) {
break; // Stop reading after receiving the result
}
}
// Send the GET VARIABLE command to retrieve the value of 'opt'
echo "GET VARIABLE opt\n";
flush(); // Ensure the command is sent to Asterisk
// Initialize a variable to store the result
$userInput = null;
// Capture the response for GET VARIABLE
while (!feof(STDIN)) {
$line = trim(fgets(STDIN));
if (preg_match('/^200 result=1 \((.*)\)$/', $line, $matches)) {
$userInput = $matches[1]; // Store the captured value
break;
}
}
// Use the captured value
if ($userInput !== null) {
echo "VERBOSE \"Captured user input: $userInput\"\n"; // Debug output to Asterisk CLI
flush();
}
?>