Soporte & Consultoria

Soporte Remoto y Consultoria skype : ambiorixg12.
Nota no se brinda ningun tipo de consulta o soporte fuera del blog de forma gratuita

martes, 13 de septiembre de 2016

AMI alert event only for some extensions and events


$socket = fsockopen($host,"5038", $errno, $errstr,10);
      if (!$socket){
        echo "$errstr ($errno)\n";
            fputs($socket, "Action: Login\r\n");
            fputs($socket, "UserName: $username\r\n");
            fputs($socket, "Secret: $secret\r\n\r\n");
            fputs($socket, "Action: WaitEvent\r\n");
            fputs($socket, "Action: Logoff\r\n\r\n");


  $result.=date("Y-m-d H:i:s");


foreach($events as $value) {

if (preg_match("/\b$value\b/i", $result, $match)){

if (preg_match("/\bHangupRequest\b/i", $result, $match)){


foreach($elements as $key=>$value) {
echo "$key $value\n";
$message="You have  missed call from number $elements[5]\n to extension $elements[7] at $elements[17]";

$num=explode(" ",$elements[5]);


mail("","  You have a missed call from $num[1]",$message);









PHP setting file

nohup /usr/bin/php /var/www/monitor/alert.php &
root@asterisk-dominicana:/var/www/monitor# ps aux | grep -i aler | grep -v grep
root     28755  0.0  2.4 259320 12052 pts/0    S    00:05   0:00 /usr/bin/php /var/www/monitor/alert.php

No hay comentarios:

Publicar un comentario