que es

miércoles, 16 de julio de 2025

macro en la colas asterisk

 [contexto]
exten => 192,1,Answer
  same => n,Macro(user-callerid,)
  same => n,Set(CHANNEL(language)=es)
  same => n,NoOp(Llamada 192 # ${CALLERID(num)} #${FROM_DID} >> ${ANSWEREDTIME} >> ${HANGUPCAUSE}) )
  same => n,agi(ivr.php,${CALLERID(num)} )
   ;exten => 192,n,Goto(from-internal,190,1)
  same => n,Hangup()
   ;exten => 192,n,Hangup


;;cola de asterisk
;;;;
[macro-enviocolas]
exten => s,1,Macro(user-callerid,)
exten => s,n,NoOp(Envi_190 ${QAGENT} ${UNIQUEID} ${FROMEXTEN} ${HANGUPCAUSE}) )
;;;exten => s,n,System( echo "'$(date +'%D_Hora:_%T')  _Agente:_${CHANNEL}  _Tel_Cliente:_${FROMEXTEN}  _Troncal:_"${FROM_DID}"  '" >                        > /var/log/asterisk/ecus.txt )
;;ingresallamada Julio 16 de 2025 funciona.
;;
exten => s,n,System(php -f /var/lib/asterisk/agi-bin/llamada.php ${UNIQUEID} "${CHANNEL}" ${FROMEXTEN} )
;;;
;;;;escribe log de llamadas en cola.
;;;
exten => s,n,System( echo "'$(date +'Fecha:_%d_%m_%Y_Hora:_%T')  _Agente:_${CHANNEL} _"${CALLERID(number)}"  _Troncal:_"${FROM_DID}"                          _Tel_Cliente:_${FROMEXTEN}  '" >> /var/log/asterisk/cola.txt )
;;
;;
;exten => s,n,System(php -f /var/lib/asterisk/agi-bin/ingresallamada.php ${UNIQUEID} "${CHANNEL}" ${FROMEXTEN} )

viernes, 7 de julio de 2023

dns seguros publicos

 156.154.71.2

 156.154.70.2

lunes, 10 de abril de 2023

ps y averiguar número

comando ps y averiguando el número para realizar un kill -9   

echo "`ps -ef|grep -v grep | grep Hang_Ivr | awk '{print $2}'`"

viernes, 16 de diciembre de 2022

Disable bitlocker

 ver status bitlocker

Console power shell como administrador.

manage-bde -status

disable bitlocker.

disable-Bitlocker -Mountpoint "C"


con estos pasos se desactiva el bitlocker.



miércoles, 23 de noviembre de 2022

borrar directorio vacios y archivos

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


viernes, 4 de noviembre de 2022

ami php

 <?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);
            }



miércoles, 2 de noviembre de 2022

outcall asterisk

 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

*/

?>