diff --git a/agi.c b/agi.c index afa3344..a412a7f 100644 --- a/agi.c +++ b/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) ); diff --git a/teste.c b/teste.c index db08019..1204da0 100644 --- a/teste.c +++ b/teste.c @@ -5,10 +5,12 @@ #include #include +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; -} \ No newline at end of file +} +