#!/bin/bash . /var/lib/asterisk/scripts/callcenter/bd TBL_AGENTES="pbx_supervisor_agentes" if [ -z "$1" -o -z "$2" ] then exit fi export PGPASSWORD=$SENHA PAUSA=$(psql -Atc "select count(*) from $TBL_AGENTES where status = 'PAUSA' and matricula = '$2'" -h $HOST_DB -d $BASE_DB -U $USUARIO) echo 'Pausa = '$PAUSA if [ $PAUSA = 1 ] then exit fi psql -c "UPDATE $TBL_AGENTES SET status = '$1',duracao = now(),origem_destino = '',canal = '',tipo_ligacao = '' WHERE CANAL = '$2'" -h $HOST_DB -d $BASE_DB -U $USUARIO