|
|
@ -34,7 +34,7 @@ |
|
|
|
#include <log/log.h> |
|
|
|
#include <log/log.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define CLIENT_MANAGER_CONF "/etc/client_ami.conf" // arquivo de configuração desse software
|
|
|
|
#define CLIENT_MANAGER_CONF "/etc/amid.conf" // arquivo de configuração desse software
|
|
|
|
#define NEW_LINE '\n' |
|
|
|
#define NEW_LINE '\n' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -129,7 +129,7 @@ void read_arguments( s_manager *smanager){ |
|
|
|
|
|
|
|
|
|
|
|
file = open( CLIENT_MANAGER_CONF, O_RDONLY ); |
|
|
|
file = open( CLIENT_MANAGER_CONF, O_RDONLY ); |
|
|
|
if( file == -1 ){ |
|
|
|
if( file == -1 ){ |
|
|
|
_EMERG("Arquivo /etc/client_manager/client_manager.conf não encontrado"); |
|
|
|
_EMERG("Arquivo /etc/client_manager/amid.conf não encontrado"); |
|
|
|
exit(-1); |
|
|
|
exit(-1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -374,7 +374,6 @@ int main (int argc, char **argv){ |
|
|
|
|
|
|
|
|
|
|
|
s_manager *smanager; |
|
|
|
s_manager *smanager; |
|
|
|
pthread_t thread; |
|
|
|
pthread_t thread; |
|
|
|
init_daemon(0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
smanager = alloc( 1, sizeof(s_manager) ); |
|
|
|
smanager = alloc( 1, sizeof(s_manager) ); |
|
|
|
|
|
|
|
|
|
|
@ -383,6 +382,7 @@ int main (int argc, char **argv){ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
read_arguments( smanager ); |
|
|
|
read_arguments( smanager ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
init_daemon(0); |
|
|
|
smanager->ami = ami_init(); // inicializar biblioteca ami
|
|
|
|
smanager->ami = ami_init(); // inicializar biblioteca ami
|
|
|
|
if(!smanager->ami){ |
|
|
|
if(!smanager->ami){ |
|
|
|
_CRIT("Não pode calloc - library_ami"); |
|
|
|
_CRIT("Não pode calloc - library_ami"); |
|
|
@ -398,14 +398,14 @@ int main (int argc, char **argv){ |
|
|
|
sleep(1); |
|
|
|
sleep(1); |
|
|
|
|
|
|
|
|
|
|
|
if(attempt == 2){ |
|
|
|
if(attempt == 2){ |
|
|
|
_CRIT("Sem Conexão coma AMI"); |
|
|
|
_CRIT("Não foi possível conectar ao asterisk"); |
|
|
|
} |
|
|
|
} |
|
|
|
else if(attempt > 10){ |
|
|
|
else if(attempt > 10){ |
|
|
|
attempt = 0; |
|
|
|
attempt = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
attempt++; |
|
|
|
attempt++; |
|
|
|
} |
|
|
|
} |
|
|
|
_NOTICE("conexão com AMI"); |
|
|
|
_NOTICE("conectado com asterisk"); |
|
|
|
|
|
|
|
|
|
|
|
/* Essa thread é do banco de dados */ |
|
|
|
/* Essa thread é do banco de dados */ |
|
|
|
pthread_create(&thread, NULL, init_thread, (void *)smanager); |
|
|
|
pthread_create(&thread, NULL, init_thread, (void *)smanager); |
|
|
|