comando ps y averiguando el número para realizar un kill -9
echo "`ps -ef|grep -v grep | grep Hang_Ivr | awk '{print $2}'`"
Soporte,Configuración,sopore, venta de plantas pbx de voip con Asterisk, Issabelpbx, freepbx. Instalación cableado estructurado y eléctrico. Instalación y venta cámaras cctv.
comando ps y averiguando el número para realizar un kill -9
echo "`ps -ef|grep -v grep | grep Hang_Ivr | awk '{print $2}'`"
ver status bitlocker
Console power shell como administrador.
manage-bde -status
disable bitlocker.
disable-Bitlocker -Mountpoint "C"
con estos pasos se desactiva el bitlocker.
borrar archivos vacios (empty) y directorios.
/usr/bin/find /var/spool/asterisk/monitor/* -mtime +30 -type d -daystart -print | xargs rm -rf #-delete # |xargs rm -rf
find /var/spool/asterisk/monitor/ -empty -print
find /var/spool/asterisk/monitor/* -empty -type d -print -delete
find /var/spool/asterisk/monitor/* -empty -type f -print -delete
find /var/spool/asterisk/monitor/* -empty -type f -print | xargs rm -rf
<?php
#echo "ami";
#echo "ami22";
$command=$_GET["cmd"];
$socket = fsockopen("127.0.0.1","5038", $errno, $errstr, 10);
if (!$socket){
echo "$errstr ($errno)\n";
}else{
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: araña\r\n");
fputs($socket, "Secret: arañasos\r\n\r\n");
fputs($socket, "Action: Command\r\n");
fputs($socket, "Command: $command\r\n\r\n");
# fputs($socket, "Action: Logoff\r\n\r\n");
while (!feof($socket)){
echo fgets($socket); // .'<br>';
}
fclose($socket);
#}
}
/*
while(true) {
// read a line from the socket
$line = socket_read($socket, 1024, PHP_NORMAL_READ);
if(substr($line, -1) === "\r") {
// read/skip one byte from the socket
// we assume that the next byte in the stream must be a \n.
// this is actually bad in practice; the script is vulnerable to unexpected values
socket_read($socket, 1, PHP_BINARY_READ);
}
# $message = parseLine($line);
echo $line."<br>";
#if($message->type === "QUIT") break;
}
*/
?>
#!/usr/bin/php -q
<?php
// hangup call trunk
//
#$command=$_GET["cmd"];
$socket = fsockopen("127.0.0.1","5038", $errno, $errstr, 10);
if (!$socket){
echo "$errstr ($errno)\n";
}else{
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: Araña\r\n");
fputs($socket, "Secret: picadura*\r\n\r\n");
#fputs($socket, "Action: Command\r\n");
#fputs($socket, "Command: $command\r\n\r\n");
#fputs($socket, "Action: Logoff\r\n\r\n");
while(true){
while (!feof($socket)){
$read = trim( fgets($socket));
//if(str_contains('Event: Hangup',$read)){
if ($read == 'Event: Hangup') {
$show = true;
$send = '';
}
if(isset($show)){
if($show){
$send .= $read."\n";
}
}
if(empty($read)){
if(isset($show)){
if($show){
#echo $send;
$url = 'https://ami';
$data = array('ami' =>$send);
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) { /* Handle error */ }
}
}
$show = false;
}
}
sleep(1);
}
fclose($socket);
}
Creación de archivo bash para enviar archivo para realizar llamadas.
Send_client.sh
#!/bin/bash
llamar="$1"
copiar=$(cp -ap $llamar /tmp/)
mover=$(mv /tmp/$llamar /var/spool/asterisk/outgoing/)
#cp -ap outcall_cliente.call /tmp/ && mv /tmp/outcall_cliente.call /var/spool/asterisk/outgoing/
#cp -ap $llamar /tmp/ && mv /tmp/$llamar /var/spool/asterisk/outgoing/
$copiar && $mover
Fin de archivo bash.
Archivo que va outgoing
out_tax2.call
Channel: SIP/GWCOMCEL2/333676325
Context: cliente
Extension: 99
Priority: 1
Set: num=33332854356
Fin archivo outcall
archivo php para la creación de archivo y revisión de permisos.
<?php
##outcall
$troncal = "SIP/GW/";
$numCliente = 6028879020;
$context = "cliente";
$ext = 194;
$prioridad = "Priority: 1";
$numTaxi = 3333015633;
$file_handle = fopen("out_tax2.call", "w");
fwrite($file_handle, "Channel: ".$troncal.$numCliente."\n");
fwrite($file_handle, "Context: ".$context."\n");
fwrite($file_handle, "Extension: ".$ext."\n");
fwrite($file_handle, $prioridad."\n");
fwrite($file_handle, "Set: num=".$numTaxi."\n");
fclose($file_handle);
echo "archivo creado\n";
#echo ("out_tax2.call");
#echo fileperms('out_tax2.call')."\n";
#
$permisos = substr(sprintf("%o", fileperms("out_tax2.call")), -3)."\n";
$outCall_file = 'out_tax2.call';
#revisa usario y grupo asterisk
#
$usuario = posix_getpwuid(fileowner($outCall_file));
$grupo = posix_getgrgid(filegroup($outCall_file));
//extrae grupo usuario y grupo
//
$usrFile = $usuario["name"];
$grFile = $grupo["name"];
#print_r($grupo);
#print_r(array_keys($grupo, "name"));
#print_r(in_array('name', $grupo));
print_r($usuario["name"]."\n");
echo $grupo["name"]."\n\n";
echo $usrFile.":".$grFile."\n";
echo $permisos."\n";
//valida permisos, usuario y grupo
if ( $permisos != 755 ){
chmod($outCall_file, 0755);
#echo "archivo con permisos\n";
}
if ($usrFile != "asterisk" ){
chown($outCall_file, "asterisk");
}
if ($grFile != "asterisk" ){
chgrp($outCall_file, "asterisk");
}
#system("chown asterisk:asterisk out_tax2.call && chmod 755 out_tax2.call")
#system("cp -p out_tax2.call /tmp/ && mv /tmp/out_tax2.call /var/spool/asterisk/outgoing/");
/*
Channel: SIP/GWCOMCEL2/6028879020
Context: cliente
Extension: 999
Priority: 1
Set: num=333333333
*/
?>
Se genera un archivo .call para sacar la llamada.
Y se configura un contexto para conectar la segunda llamada.
Habilitar permisos de ejecución en el archivo, con propietario y usuario "asterisk" ; si el que se configura.
out.call
Channel: SIP/GWCOMCEL/6028879022
Context: app
Extension: 194
Priority: 1
Set: num=3123015689
contexto va en:
extensions_custom.conf
[cliente]
exten => 194,1,Answer()
same => n,DumpChan(3,)
same => n,NoOP("varible enviada ${num}")
;same => n,Playback(es/welcome&es/calls-waiting-for-rep)
;same => n,Dial(SIP/GWCOMCEL/${EXTEN:1})
;;
;same => n,Dial(SIP/GWCOMCEL/${num},,A(welcome)&L(10000))
;; 10 segundos L. 10 x 1000 msegundos.
;same => n,Dial(SIP/GWCOMCEL/${num},,A(es/calls-waiting-for-rep)&L(10000) )
;; 5 minutos 5 x 60 segundos.
same => n,Dial(SIP/GWCOMCEL/${num},,A(es/calls-waiting-for-rep)&S(300) )
same => n,Hangup()
grabación de llamadas pero debe estar activo el caller id en el archivo.
El script rsync se usa para copia directorios hacia otra particion.
se debe montar la partición realizar la copia.
después desmontar y montar con fstab.
#!/bin/bash
copia="/var/spool/asterisk/monitor/" #asi copia la carpeta monitor
destino="/mnt/audios"
#rsync -avzh --progress /var/spool/asterisk/monitor /mnt/audios
rsync -avzh --progress $copia $destino
tener en cuenta la barra slash "/" si esta con está barra copia solo los archivos y sin ella copia la carpeta.
#!/bin/bash
copia="/mnt/audios/monitor/*" # asi copia solo los archivos dentro de la carpeta monitor.
destino="/mnt/audios/"
#rsync -avzh --progress /var/spool/asterisk/monitor /mnt/audios
rsync -avzh --progress $copia $destino