Browse Source

versão 0.0.1

master v0.0.1
Rodgger 2 years ago
parent
commit
2a7db4ca9b
  1. 2
      src/ami.c
  2. 2
      src/ami.h
  3. 6
      src/ami_c.h
  4. 7
      src/asterisk.c
  5. 2
      src/asterisk.h
  6. 2
      src/net.c
  7. 2
      src/net.h
  8. 8
      src/parse_action.c
  9. 2
      src/parse_action.h
  10. 6
      src/parse_event.c
  11. 2
      src/parse_event.h
  12. 2
      src/parse_string.c
  13. 2
      src/parse_string.h

2
src/ami.c

@ -1,6 +1,6 @@
/*
* Copyright (C) 2022 Simples IP.
* Author: Rodgger Bruno <rodgger.silva@simplesip.com>
* Maintainers: Rodgger Bruno <rodgger.silva@simplesip.com>
*/
#include <ami.h>

2
src/ami.h

@ -1,6 +1,6 @@
/*
* Copyright (C) 2022 Simples IP.
* Author: Rodgger Bruno <rodgger.silva@simplesip.com>
* Maintainers: Rodgger Bruno <rodgger.silva@simplesip.com>
*/
#ifndef AMI_H

6
src/ami_c.h

@ -1,11 +1,15 @@
/*
* Copyright (C) 2022 Simples IP.
* Author: Rodgger Bruno <rodgger.silva@simplesip.com>
* Maintainers: Rodgger Bruno <rodgger.silva@simplesip.com>
*/
#ifndef AMI_C_H
#define AMI_C_H 1
#define LIB_AMI_VERSION "0.0.1"
#define LIB_AMI_COMPANY "SIMPLES IP"
#define LIB_AMI_EMAIL "rodgger.silva@simplesip.com.br"
#define MAX_LEN_KEY_ACTION 0x32 /*!< maior comprimento permitido pelo chave no argumento */
#define MAX_LEN_VALUE_ACTION 0x100 /*!< maior comprimento permitido pelo valor da chave no argumento */
#define MAX_LEN_NAME_ACTION 0x32 /*!< maior comprimento permitido pelo nome de um action */

7
src/asterisk.c

@ -1,6 +1,6 @@
/*
* Copyright (C) 2022 Simples IP.
* Author: Rodgger Bruno <rodgger.silva@simplesip.com>
* Maintainers: Rodgger Bruno <rodgger.silva@simplesip.com>
*/
#include <ami.h>
@ -94,7 +94,7 @@ int ami_actionid_remove( ACTIONID **list_actions, const char *actionid ){
if( !strcmp( (*list_actions)->actionid, actionid ) ){
drop_actionid = *list_actions;
*list_actions = (*list_actions)->next;
*list_actions = drop_actionid->next;
ami_actionid_free(drop_actionid);
return 0;
}
@ -154,6 +154,9 @@ int ami_event_redirect(AMI *ami, EVENT *event){
if(ami->asterisk.disable_events == 0){
ami_event_add(&ami->events, event);
}
else{
ami_event_free(event);
}
}
else{
if(ami_action_event_add(&ami->actions, event) == -1){

2
src/asterisk.h

@ -1,6 +1,6 @@
/*
* Copyright (C) 2022 Simples IP.
* Author: Rodgger Bruno <rodgger.silva@simplesip.com>
* Maintainers: Rodgger Bruno <rodgger.silva@simplesip.com>
*/
#ifndef ASTERISK_H

2
src/net.c

@ -1,6 +1,6 @@
/*
* Copyright (C) 2022 Simples IP.
* Author: Ródgger Bruno <rodgger.silva@simplesip.com>
* Maintainers: Ródgger Bruno <rodgger.silva@simplesip.com>
*/
#include <ami.h>

2
src/net.h

@ -1,6 +1,6 @@
/*
* Copyright (C) 2022 Simples IP.
* Author: Rodgger Bruno <rodgger.silva@simplesip.com>
* Maintainers: Rodgger Bruno <rodgger.silva@simplesip.com>
*/
#ifndef NET_H

8
src/parse_action.c

@ -1,6 +1,6 @@
/*
* Copyright (C) 2022 Simples IP.
* Author: Ródgger Bruno <rodgger.silva@simplesip.com>
* Maintainers: Ródgger Bruno <rodgger.silva@simplesip.com>
*/
#include <ami.h>
@ -20,6 +20,7 @@ void parse_response(AMI *ami, const char *buffer, int *incomplete){
ACTION *p_action = NULL;
size_t len_command = 0;
const char *privilege = NULL;
int count = 0;
p_end = strstr(buffer, end_response);
if( !p_end ){
@ -40,6 +41,7 @@ void parse_response(AMI *ami, const char *buffer, int *incomplete){
while(buffer < p_end){
count++;
ARGS *arg = ami_arg_create();
// argumento key
@ -78,7 +80,7 @@ void parse_response(AMI *ami, const char *buffer, int *incomplete){
arg->value = calloc(1, len_command + 1 );
strncpy(arg->value, buffer, len_command);
arg->value[len_command] = '\0';
ami_args_add(&p_response->args, arg);
ami_args_add( &p_response->args, arg );
break;
}
}
@ -88,6 +90,8 @@ void parse_response(AMI *ami, const char *buffer, int *incomplete){
return;
}
p_action->response->count = count;
pthread_mutex_lock(&ami->thread.mutex_actions);
if( !strcmp( p_action->actionid, "_LOGIN_" ) ) {
if( !strcasecmp(p_action->response->response, "Success") ) {

2
src/parse_action.h

@ -1,6 +1,6 @@
/*
* Copyright (C) 2022 Simples IP.
* Author: Rodgger Bruno <rodgger.silva@simplesip.com>
* Maintainers: Rodgger Bruno <rodgger.silva@simplesip.com>
*/
#ifndef PARSE_ACTION_H

6
src/parse_event.c

@ -1,6 +1,6 @@
/*
* Copyright (C) 2022 Simples IP.
* Author: Ródgger Bruno <rodgger.silva@simplesip.com>
* Maintainers: Ródgger Bruno <rodgger.silva@simplesip.com>
*/
#include <ami.h>
@ -17,6 +17,7 @@ void parse_event(AMI *ami, char *buffer, int *incomplete){
char *end_event = "\r\n\r";
char *p_end = NULL;
EVENT *p_event = NULL;
int count = 0;
p_end = strstr(buffer, end_event);
if( !p_end ){
@ -39,6 +40,7 @@ void parse_event(AMI *ami, char *buffer, int *incomplete){
buffer = buffer + len + 2;
while(buffer < p_end){
count ++;
ARGS *arg = ami_arg_create();
len = len_key_ami( buffer );
@ -66,6 +68,8 @@ void parse_event(AMI *ami, char *buffer, int *incomplete){
ami_args_add(&p_event->args, arg);
}
p_event->count = count;
pthread_mutex_lock(&ami->thread.mutex_events);
ami_event_redirect(ami, p_event);
pthread_mutex_unlock(&ami->thread.mutex_events);

2
src/parse_event.h

@ -1,6 +1,6 @@
/*
* Copyright (C) 2022 Simples IP.
* Author: Rodgger Bruno <rodgger.silva@simplesip.com>
* Maintainers: Rodgger Bruno <rodgger.silva@simplesip.com>
*/
#ifndef PARSE_EVENT_H

2
src/parse_string.c

@ -1,6 +1,6 @@
/*
* Copyright (C) 2022 Simples IP.
* Author: Rodgger Bruno <rodgger.silva@simplesip.com>
* Maintainers: Rodgger Bruno <rodgger.silva@simplesip.com>
*/
#include <ami.h>

2
src/parse_string.h

@ -1,6 +1,6 @@
/*
* Copyright (C) 2022 Simples IP.
* Author: Rodgger Bruno <rodgger.silva@simplesip.com>
* Maintainers: Rodgger Bruno <rodgger.silva@simplesip.com>
*/
#ifndef PARSE_STRING_H

Loading…
Cancel
Save