Extension settings:
Soporte & Consultoria
lunes, 18 de noviembre de 2024
domingo, 10 de noviembre de 2024
agi commands
miércoles, 30 de octubre de 2024
Real Time Transcription
https://www.youtube.com/watch?v=ypcsB5Ld6zw&
https://community.asterisk.org/t/is-it-possible-to-transcribe-live-calls-with-asterisk/98992/7
https://platform.openai.com/docs/guides/audio/next-steps
https://platform.openai.com/docs/guides/realtime/quickstart
https://openai.com/index/introducing-the-realtime-api/
miércoles, 16 de octubre de 2024
pjsip example template
https://docs.asterisk.org/Configuration/Channel-Drivers/SIP/Configuring-res_pjsip/res_pjsip-Configuration-Examples/
lunes, 7 de octubre de 2024
calling script
<?php
//error_reporting(E_ALL);
//ini_set('display_errors', 1);
header('Content-Type: application/json');
echo json_encode($_REQUEST, JSON_PRETTY_PRINT);
$timeout=100;
$host="127.0.0.1";
$port=5038;
$src = preg_replace('/\s+/', '', $_GET['src']);
$dst = preg_replace('/\s+/', '', $_GET['dst']);
$trunk = preg_replace('/\s+/', '', $_GET['trunk']);
$cid = preg_replace('/\s+/', '', $_GET['cid']);
$id = preg_replace('/\s+/', '', $_GET['id']);
$socket = fsockopen("$host","$port", $errno, $errstr, 10);
if (!$socket){
echo "$errstr ($errno)\n";
}else{
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: admin\r\n");
fputs($socket, "Secret: oy13xtq7h\r\n\r\n");
$wrets=fgets($socket,128);
// echo $wrets;
fputs($socket, "Action: Originate\r\n" );
fputs($socket, "Channel: Local/$src@internal\r\n" );
fputs($socket, "Exten: $dst\r\n" );
fputs($socket, "Context: internal\r\n" );
fputs($socket, "Priority: 1\r\n" );
fputs($socket, "CallerID: $cid\r\n" );
fputs($socket, "Variable: __ext=$ext\r\n" );
fputs($socket, "Variable: __dest=$dest\r\n" );
fputs($socket, "Variable: __cid=$callerid\r\n" );
fputs($socket, "Async: yes\r\n\r\n" );
fputs($socket, "Action: Logoff\r\n\r\n");
while (!feof($socket)){
$result=fgets($socket);
$result= stristr($result,"$number");
$d=strlen($result);
}
fclose($socket);
}
?>
sábado, 28 de septiembre de 2024
Python delay script for asterisk
#!/usr/bin/env python
import subprocess
import time
import sys
# Check if the caller argument is provided
if len(sys.argv) < 2:
print("Usage: script.py <caller>")
sys.exit(1)
caller = sys.argv[1]
i = 0
while i < 30:
print(i)
time.sleep(1)
i += 1
# Run the command and capture the output
command = ['/usr/sbin/asterisk', '-x', 'channel redirect {} vc_lookup,100,play'.format(caller)]
try:
result = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, error = result.communicate()
# Print the output
print(output)
if error:
print("Error:", error)
except Exception as e:
print("An error occurred:", str(e))
lunes, 23 de septiembre de 2024
google tts asterisk using python virtual env
[vaccine-rev]
exten=>100,1,Answer()
same=>n,Set(fname=${CHANNEL})
same=>n,agi(/var/www/html/google_tts/tts.py,${fname:4},"Total number of students registered with this telephone number.")
same=>n,playback(/var/www/html/google_tts/audios/${fname:4})
same=>n,Saynumber(3)
same=>n,agi(/var/www/html/google_tts/tts.py,${fname:4},"David is missing the following vaccines:")
same=>n,playback(/var/www/html/google_tts/audios/${fname:4})
same=>n,hangup()