offtopic Script que avisa

327 views
Skip to first unread message

rfernandezmx

unread,
Nov 29, 2013, 12:37:23 PM11/29/13
to aster...@googlegroups.com
Saludos lsiteros!! pues bien hoy es viernes asi que hoy me "he soltado el pelo" y les comento la tragedia de la semana, un cliente que su mfcr2 por parte de telmex, entre que si telmex le cortaba el cable, o que si un vecino se qujaba de su linea y el contratista, les quitaba un par, osea un problema y el cliente me decia ¿es que tengo siempre que estar al pendiente?

pues bien me lié a hacer un script de monitor que les quiero compartir por si alguien tiene un cliente que tenga callcenter (el mio es de una hotline jejeje), le mando mi script que igual y puede ayudar. (el call file debe estar en el mismo folder que el script perl y no olviden chown asterisk:asterisk archivo.call

#!/usr/bin/perl

@comando = "/usr/sbin/asterisk -rx 'mfcr2 show channels' > resultado.txt";
system (@comando);

open(FILE,"resultado.txt");

if (grep{/BLOCK/} <FILE>){

   print "Se encontro el Bloqueo\n";
        system ("rm resultado.txt");
        system ("cp llama2.call /var/spool/asterisk/outgoing/");
}

elsif (grep{/0x/} <FILE>){

   print "Error en E1\n";
         system ("rm resultado.txt");
         system ("cp llama2.call /var/spool/asterisk/outgoing/");

}

else{

      system ("rm resultado.txt");
    
}

close FILE;

y el call file trae esto:

Channel: SIP/55********/0445513889354
CallerID: "Cobranza" <55******** >
Context: monitoreo-asterisk
Extension: 500
Priority: 1

contexto:

[monitoreo-asterisk]
exten => 500,1,Answer()
exten => 500,n,Wait(2)
exten => 500,n,Playback(alarma)
exten => 500,n,Playtones(congestion)
exten => 500,n,Congestion(3)
exten => 500,n,Hangup()


saludos!! (y recuerden ya es viernes!)


Emiliano Vazquez

unread,
Nov 29, 2013, 3:32:02 PM11/29/13
to aster...@googlegroups.com
El 29/11/13 14:37, rfernandezmx escribi�:
> Saludos lsiteros!! pues bien hoy es viernes asi que hoy me "he soltado
> el pelo" y les comento la tragedia de la semana, un cliente que su
> mfcr2 por parte de telmex, entre que si telmex le cortaba el cable, o
> que si un vecino se qujaba de su linea y el contratista, les quitaba
> un par, osea un problema y el cliente me decia �es que tengo siempre
> que estar al pendiente?
>
> pues bien me li� a hacer un script de monitor que les quiero compartir
> por si alguien tiene un cliente que tenga callcenter (el mio es de una
> hotline jejeje), le mando mi script que igual y puede ayudar. (el call
> file debe estar en el mismo folder que el script perl y no olviden
> chown asterisk:asterisk archivo.call
Gracias!!!!



--
Emiliano Vazquez | PcCentro Informatica & CCTV
Office: +54 (11) 4635-3218 y Rotativas
Movil: 011-15-6253-7165
Mail: emilian...@gmail.com
Web: http://www.pccentro.com.ar

El Ale...

unread,
Nov 30, 2013, 4:12:19 PM11/30/13
to aster...@googlegroups.com
buenisimo! otra hotline! jaj


El 29 de noviembre de 2013 17:32, Emiliano Vazquez <emilian...@gmail.com> escribió:
El 29/11/13 14:37, rfernandezmx escribió:

Saludos lsiteros!! pues bien hoy es viernes asi que hoy me "he soltado el pelo" y les comento la tragedia de la semana, un cliente que su mfcr2 por parte de telmex, entre que si telmex le cortaba el cable, o que si un vecino se qujaba de su linea y el contratista, les quitaba un par, osea un problema y el cliente me decia żes que tengo siempre que estar al pendiente?

pues bien me lié a hacer un script de monitor que les quiero compartir por si alguien tiene un cliente que tenga callcenter (el mio es de una hotline jejeje), le mando mi script que igual y puede ayudar. (el call file debe estar en el mismo folder que el script perl y no olviden chown asterisk:asterisk archivo.call
Gracias!!!!



--
Emiliano Vazquez | PcCentro Informatica & CCTV
Office: +54 (11) 4635-3218 y Rotativas
Movil: 011-15-6253-7165
Mail: emilian...@gmail.com
Web: http://www.pccentro.com.ar


--
Este email pertenece a la lista de Asterisk-ES (http://www.asterisk-es.org)
Normas de la lista Asterisk-ES: http://comunidad.asterisk-es.org/index.php?title=Lista:normas-asterisk-es
--- Has recibido este mensaje porque estás suscrito al grupo "asterisk-es" de Grupos de Google.
Para anular la suscripción a este grupo y dejar de recibir sus correos electrónicos, envía un correo electrónico a asterisk-es+unsubscribe@googlegroups.com.
Para publicar una entrada en este grupo, envía un correo electrónico a aster...@googlegroups.com.
Visita este grupo en http://groups.google.com/group/asterisk-es.
Para obtener más opciones, visita https://groups.google.com/groups/opt_out.

rfernandezmx

unread,
Dec 1, 2013, 2:47:01 PM12/1/13
to aster...@googlegroups.com
A ver, corrijo el script (si alguien se sabe mas codigos de error que los comparta, ya que el exito del programa es eso), lo correji hoy porque en la mañana me llamo el cliente porque la E1 se volvió a caer.

y no olviden ponr un crontab cada 2 mins asi:

0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,36,40,42,44,46,48,50,52,54,56,58 * * * * /scripts/revisa2.pl


#!/usr/bin/perl

@comando = "/usr/sbin/asterisk -rx 'mfcr2 show channels' > resultado.txt";
system (@comando);

open(FILE,"resultado.txt");
@log = <FILE>;

if (grep{/BLOCK/} @log){

   print "Se encontro en el E1 un Bloqueo\n";

        system ("rm resultado.txt");
        system ("cp llama2.call /var/spool/asterisk/outgoing/");
}


elsif (grep{/0x0C/} @log){


   print "Error en E1\n";
         system ("rm resultado.txt");
         system ("cp llama2.call /var/spool/asterisk/outgoing/");

}

elsif (grep{/0x08/} @log){


   print "Error en E1\n";
         system ("rm resultado.txt");
         system ("cp llama2.call /var/spool/asterisk/outgoing/");

}

else{

   print "Ningun Error\n";

        system ("rm resultado.txt");

}

close FILE;




El sábado, 30 de noviembre de 2013 15:12:19 UTC-6, El Ale... escribió:
buenisimo! otra hotline! jaj


El 29 de noviembre de 2013 17:32, Emiliano Vazquez <emilian...@gmail.com> escribió:
El 29/11/13 14:37, rfernandezmx escribió:

Saludos lsiteros!! pues bien hoy es viernes asi que hoy me "he soltado el pelo" y les comento la tragedia de la semana, un cliente que su mfcr2 por parte de telmex, entre que si telmex le cortaba el cable, o que si un vecino se qujaba de su linea y el contratista, les quitaba un par, osea un problema y el cliente me decia żes que tengo siempre que estar al pendiente?

pues bien me lié a hacer un script de monitor que les quiero compartir por si alguien tiene un cliente que tenga callcenter (el mio es de una hotline jejeje), le mando mi script que igual y puede ayudar. (el call file debe estar en el mismo folder que el script perl y no olviden chown asterisk:asterisk archivo.call
Gracias!!!!



--
Emiliano Vazquez | PcCentro Informatica & CCTV
Office: +54 (11) 4635-3218 y Rotativas
Movil: 011-15-6253-7165
Mail: emilian...@gmail.com
Web: http://www.pccentro.com.ar


--
Este email pertenece a la lista de Asterisk-ES (http://www.asterisk-es.org)
Normas de la lista Asterisk-ES: http://comunidad.asterisk-es.org/index.php?title=Lista:normas-asterisk-es
--- Has recibido este mensaje porque estás suscrito al grupo "asterisk-es" de Grupos de Google.
Para anular la suscripción a este grupo y dejar de recibir sus correos electrónicos, envía un correo electrónico a asterisk-es...@googlegroups.com.

rfernandezmx

unread,
Dec 1, 2013, 2:50:31 PM12/1/13
to aster...@googlegroups.com
los errores los saque de el log del cliente asi:

[2013-11-22 14:40:13] ERROR[15962] chan_dahdi.c: MFC/R2 protocol error on chan 2: Invalid CAS
[2013-11-22 14:40:13] ERROR[15962] chan_dahdi.c: Chan 3 - Protocol error. Reason = Invalid CAS, R2 State = Seize ACK Transmitted, MF state = Seize ACK Transmitted, MF Group = Backward MF init, CAS = 0x0C
[2013-11-22 14:40:13] ERROR[15962] chan_dahdi.c: MFC/R2 protocol error on chan 3: Invalid CAS
[2013-11-22 14:40:13] ERROR[15962] chan_dahdi.c: Chan 4 - Protocol error. Reason = Invalid CAS, R2 State = Seize ACK Transmitted, MF state = Seize ACK Transmitted, MF Group = Backward MF init, CAS = 0x0C
[2013-11-22 14:40:13] ERROR[15962] chan_dahdi.c: MFC/R2 protocol error on chan 4: Invalid CAS
[2013-11-22 14:40:13] ERROR[15962] chan_dahdi.c: Chan 5 - Protocol error. Reason = Invalid CAS, R2 State = Seize ACK Transmitted, MF state = Seize ACK Transmitted, MF Group = Backward MF init, CAS = 0x0C
[2013-11-22 14:40:13] ERROR[15962] chan_dahdi.c: MFC/R2 protocol error on chan 5: Invalid CAS
[2013-11-22 14:40:13] ERROR[15962] chan_dahdi.c: Chan 6 - Protocol error. Reason = Invalid CAS, R2 State = Seize ACK Transmitted, MF state = Seize ACK Transmitted, MF Group = Backward MF init, CAS = 0x0C
[2013-11-22 14:40:13] ERROR[15962] chan_dahdi.c: MFC/R2 protocol error on chan 6: Invalid CAS
[2013-11-22 14:40:13] ERROR[15962] chan_dahdi.c: Chan 7 - Protocol error. Reason = Invalid CAS, R2 State = Seize ACK Transmitted, MF state = Seize ACK Transmitted, MF Group = Backward MF init, CAS = 0x0C
[2013-11-22 14:40:13] ERROR[15962] chan_dahdi.c: MFC/R2 protocol error on chan 7: Invalid CAS
[2013-11-22 14:40:13] ERROR[15962] chan_dahdi.c: Chan 8 - Protocol error. Reason = Invalid CAS, R2 State = Seize ACK Transmitted, MF state = Seize ACK Transmitted, MF Group = Backward MF init, CAS = 0x0C
[2013-11-22 14:40:13] ERROR[15962] chan_dahdi.c: MFC/R2 protocol error on chan 8: Invalid CAS
[2013-11-22 14:40:13] ERROR[15962] chan_dahdi.c: Chan 9 - Protocol error. Reason = Invalid CAS, R2 State = Seize ACK Transmitted, MF state = Seize ACK Transmitted, MF Group = Backward MF init, CAS = 0x0C
[2013-11-22 14:40:13] ERROR[15962] chan_dahdi.c: MFC/R2 protocol error on chan 9: Invalid CAS
[2013-11-22 14:40:13] ERROR[15962] chan_dahdi.c: Chan 10 - Protocol error. Reason = Invalid CAS, R2 State = Seize ACK Transmitted, MF state = Seize ACK Transmitted, MF Group = Backward MF init, CAS = 0x0C
[2013-11-22 14:40:13] ERROR[15962] chan_dahdi.c: MFC/R2 protocol error on chan 10: Invalid CAS
[2013-11-22 23:21:03] ERROR[17367] chan_dahdi.c: Chan 1 - Protocol error. Reason = Forward Safety Timeout, R2 State = Seize ACK Received, MF state = Waiting Far End Timeout, MF Group = Forward Group I, CAS = 0x0C
[2013-11-23 23:22:40] ERROR[21131] chan_dahdi.c: Chan 1 - Protocol error. Reason = Forward Safety Timeout, R2 State = Seize ACK Received, MF state = Waiting Far End Timeout, MF Group = Forward Group I, CAS = 0x0C
[2013-11-23 23:23:26] ERROR[21135] chan_dahdi.c: Chan 1 - Protocol error. Reason = Forward Safety Timeout, R2 State = Seize ACK Received, MF state = Waiting Far End Timeout, MF Group = Forward Group I, CAS = 0x0C
[2013-11-25 11:35:01] ERROR[15962] chan_dahdi.c: Chan 8 - Protocol error. Reason = Multi Frequency Cycle Timeout, R2 State = Seize ACK Transmitted, MF state = ANI Request Transmitted, MF Group = Backward Group C, CAS = 0x00
[2013-11-25 13:30:46] ERROR[4730] chan_dahdi.c: Chan 2 - Protocol error. Reason = Forward Safety Timeout, R2 State = Seize ACK Received, MF state = Waiting Far End Timeout, MF Group = Forward Group I, CAS = 0x0C
[2013-11-25 19:48:26] ERROR[15962] chan_dahdi.c: Chan 5 - Protocol error. Reason = Multi Frequency Cycle Timeout, R2 State = Seize ACK Transmitted, MF state = ANI Request Transmitted, MF Group = Backward Group C, CAS = 0x00
[2013-11-27 20:05:20] ERROR[16070] chan_dahdi.c: Chan 1 - Protocol error. Reason = Invalid CAS, R2 State = Seize ACK Transmitted, MF state = Seize ACK Transmitted, MF Group = Backward MF init, CAS = 0x0C
[2013-11-27 20:05:20] ERROR[16070] chan_dahdi.c: MFC/R2 protocol error on chan 1: Invalid CAS
[2013-11-27 20:05:20] ERROR[16070] chan_dahdi.c: Chan 2 - Protocol error. Reason = Invalid CAS, R2 State = Seize ACK Transmitted, MF state = Seize ACK Transmitted, MF Group = Backward MF init, CAS = 0x0C
[2013-11-27 20:05:20] ERROR[16070] chan_dahdi.c: MFC/R2 protocol error on chan 2: Invalid CAS
[2013-11-27 20:05:20] ERROR[16070] chan_dahdi.c: Chan 3 - Protocol error. Reason = Invalid CAS, R2 State = Seize ACK Transmitted, MF state = Seize ACK Transmitted, MF Group = Backward MF init, CAS = 0x0C
[2013-11-27 20:05:20] ERROR[16070] chan_dahdi.c: MFC/R2 protocol error on chan 3: Invalid CAS
[2013-11-27 20:05:20] ERROR[16070] chan_dahdi.c: Chan 4 - Protocol error. Reason = Invalid CAS, R2 State = Seize ACK Transmitted, MF state = Seize ACK Transmitted, MF Group = Backward MF init, CAS = 0x0C
[2013-11-27 20:05:20] ERROR[16070] chan_dahdi.c: MFC/R2 protocol error on chan 4: Invalid CAS
[2013-11-27 20:05:20] ERROR[16070] chan_dahdi.c: Chan 5 - Protocol error. Reason = Invalid CAS, R2 State = Seize ACK Transmitted, MF state = Seize ACK Transmitted, MF Group = Backward MF init, CAS = 0x0C
[2013-11-27 20:05:20] ERROR[16070] chan_dahdi.c: MFC/R2 protocol error on chan 5: Invalid CAS
[2013-11-27 20:05:20] ERROR[16070] chan_dahdi.c: Chan 6 - Protocol error. Reason = Invalid CAS, R2 State = Seize ACK Transmitted, MF state = Seize ACK Transmitted, MF Group = Backward MF init, CAS = 0x0C
[2013-11-27 20:05:20] ERROR[16070] chan_dahdi.c: MFC/R2 protocol error on chan 6: Invalid CAS
[2013-11-27 20:05:20] ERROR[16070] chan_dahdi.c: Chan 7 - Protocol error. Reason = Invalid CAS, R2 State = Seize ACK Transmitted, MF state = Seize ACK Transmitted, MF Group = Backward MF init, CAS = 0x0C
[2013-11-27 20:05:20] ERROR[16070] chan_dahdi.c: MFC/R2 protocol error on chan 7: Invalid CAS
[2013-11-27 20:05:20] ERROR[16070] chan_dahdi.c: Chan 8 - Protocol error. Reason = Invalid CAS, R2 State = Seize ACK Transmitted, MF state = Seize ACK Transmitted, MF Group = Backward MF init, CAS = 0x0C
[2013-11-27 20:05:20] ERROR[16070] chan_dahdi.c: MFC/R2 protocol error on chan 8: Invalid CAS
[2013-11-27 22:27:29] ERROR[16269] chan_dahdi.c: Chan 4 - Protocol error. Reason = Invalid CAS, R2 State = Idle, MF state = MF Engine Off, MF Group = No Group, CAS = 0x04
[2013-11-27 22:27:29] ERROR[16269] chan_dahdi.c: MFC/R2 protocol error on chan 4: Invalid CAS
[2013-11-27 22:27:29] ERROR[16269] chan_dahdi.c: Chan 8 - Protocol error. Reason = Invalid CAS, R2 State = Idle, MF state = MF Engine Off, MF Group = No Group, CAS = 0x04
[2013-11-27 22:27:29] ERROR[16269] chan_dahdi.c: MFC/R2 protocol error on chan 8: Invalid CAS
[2013-11-27 22:53:04] ERROR[16269] chan_dahdi.c: Chan 1 - Protocol error. Reason = Invalid CAS, R2 State = Clear Forward Transmitted, MF state = MF Engine Off, MF Group = Forward Group II, CAS = 0x04
[2013-11-27 22:53:04] ERROR[16269] chan_dahdi.c: MFC/R2 protocol error on chan 1: Invalid CAS
[2013-11-29 09:39:47] ERROR[30116] chan_dahdi.c: Chan 2 - Protocol error. Reason = Forward Safety Timeout, R2 State = Seize ACK Received, MF state = Waiting Far End Timeout, MF Group = Forward Group I, CAS = 0x0C
[2013-11-29 09:43:55] ERROR[30195] chan_dahdi.c: Chan 2 - Protocol error. Reason = Forward Safety Timeout, R2 State = Seize ACK Received, MF state = Waiting Far End Timeout, MF Group = Forward Group I, CAS = 0x0C
[2013-11-30 15:02:25] ERROR[25616] chan_dahdi.c: Chan 1 - Protocol error. Reason = Forward Safety Timeout, R2 State = Seize ACK Received, MF state = Waiting Far End Timeout, MF Group = Forward Group I, CAS = 0x0C
[2013-11-30 15:03:01] ERROR[25623] chan_dahdi.c: Chan 1 - Protocol error. Reason = Forward Safety Timeout, R2 State = Seize ACK Received, MF state = Waiting Far End Timeout, MF Group = Forward Group I, CAS = 0x0C

[root@localhost scripts]# asterisk -vvvvvvvvr
Verbosity is at least 11
localhost*CLI> mfcr2 show channels
Chan Variant Max ANI Max DNIS ANI First Immediate Accept Tx CAS   Rx CAS
   1 MX      10      4        No        No               IDLE     IDLE
   2 MX      10      4        No        No               IDLE     IDLE
   3 MX      10      4        No        No               IDLE     IDLE
   4 MX      10      4        No        No               IDLE     IDLE
   5 MX      10      4        No        No               IDLE     IDLE
   6 MX      10      4        No        No               IDLE     IDLE
   7 MX      10      4        No        No               IDLE     IDLE
   8 MX      10      4        No        No               IDLE     IDLE
   9 MX      10      4        No        No               IDLE     IDLE
  10 MX      10      4        No        No               IDLE     IDLE
localhost*CLI>

cuando genera error en el CAS en vez de IDLE me marca: block o los 0x00 y cosas asi, por eso decidi usar el grep

angel jauregui

unread,
Dec 1, 2013, 3:37:22 PM12/1/13
to aster...@googlegroups.com
ese crontab esta muy largo, es mejor asi:

*/2 * * * * /scripts/revisa2.pl

Se ejecutara cada 2 minutos.

Saludos !

--
M.S.I. Angel Haniel Cantu Jauregui.

Celular: (011-52-1)-899-871-17-22
E-Mail: angel...@sie-group.net
Web: http://www.sie-group.net/
Cd. Reynosa Tamaulipas.
Reply all
Reply to author
Forward
0 new messages