Browse Source

teste agi_c

remotes/origin/master
Rodgger 2 years ago
parent
commit
1186bf0452
  1. 2
      agi.c
  2. 34
      teste.c

2
agi.c

@ -187,7 +187,7 @@ int agi_verbose_all_param(s_agi_parameter *param){
while(param != NULL){
char str[300];
snprintf( str, 300, "VERBOSE \"DEBUG (%s: %s)\" \n", (param->key == NULL ? "NULL" : param->key), (param->value == NULL ? "NULL" : param->value ) );
snprintf( str, 300, "VERBOSE \"DEBUG (%s: %s)\" \n", (param->key == NULL ? " " : param->key), (param->value == NULL ? "NULL" : param->value ) );
int n = 0;
agi_clear_response( agi_command(str) );

34
teste.c

@ -5,10 +5,12 @@
#include <string.h>
#include <fcntl.h>
int define_variable( char *variable, char *value );
int main(int argc, char **argv){
fcntl(0, F_SETFL, fcntl(0, F_GETFL) | O_NONBLOCK);
// fcntl(0, F_SETFL, fcntl(0, F_GETFL) | O_NONBLOCK);
s_agi_parameter *param_agi = NULL;
@ -16,6 +18,34 @@ int main(int argc, char **argv){
agi_verbose_all_param(param_agi);
define_variable( "utterance", "-1");
define_variable( "confidence", "-1");
return 0;
}
int define_variable( char *variable, char *value ){
char v[100];
snprintf(v, 100, "SET VARIABLE %s %s \n", variable, value);
s_agi_return *response = NULL;
response = agi_command(v);
if(response){
if(response->code != 200){
agi_command("VERBOSE \"erro para definir uma variavel dialplan\"\n");
exit(-1);
}
}
else{
agi_command("VERBOSE \"erro para definir uma variavel dialplan\"\n");
exit(-1);
}
agi_clear_response( response );
return 0;
}
}

Loading…
Cancel
Save