[asterisk-dev] Doubts about interaction asterisk's app with
asterisk'res.
Mhayk Whandson da Silva Lima
eu at mhayk.com.br
Thu Mar 8 11:22:38 MST 2007
Can we help me ?
Well I want to do the communication app with res. I tested my simple
app and I added in the extensions.conf the rule exten => Genius(), it
is already ok, but now I want get just the function, get it one other
name and this is get in my res file, and when I called Genius() the
app menage to speak with res.
extensions.conf:
exten => 2007,1,Genius()
genius_hw.c
-----------------------------------------------------------------------------------------------------------------------------------
#include <stdio.h>
#include "asterisk.h"
#include "asterisk/pbx.h"
#include "asterisk/lock.h"
#include "asterisk/module.h"
int genius_premodule(void);
static char *app = "Genius";
static char *synopsis = "Communication test with pre-module by Genius";
static char *descrip =
"This module is just to do a conversation with pre-module genius_pm
and genius_hw!";
static int genius_exec(struct ast_channel *chan, void *data)
{
genius_premodule();
return 0;
}
static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
ast_module_user_hangup_all();
return res;
}
static int load_module(void)
{
int res;
res = ast_register_application(app, genius_exec, synopsis, descrip);
return res;
}
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Genius Speeach Recognizer")
----------------------------------------------------------------------------------------------------------------------------------
and now the res file:
genius_pm.c
----------------------------------------------------------------------------------------------------------------------------------
#include <stdio.h>
#include "asterisk.h"
int genius_premodule(void)
{
FILE *file;
char string[20];
int qtd;
if ((file = fopen("/home/mlima/asteriskfucked","a+")) == NULL )
{
printf("Problema ao tentar criado/abrir arquivo.\n");
}
sprintf(string,"Testando...\n");
qtd = fwrite(string, sizeof(char),20,file);
if(fclose(file) != 0)
{
printf("Impossibilitado de fechar arquivo!\n");
}
else{
printf("Arquivo criado com sucesso.\n");
}
return 0;
}
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Genius Speeach Recognizer");
-----------------------------------------------------------------------------------------------------------------------------------
so after, I will put in modules.conf
preload => genius_pm.so
so when I call to 2007 .. i will see the file :P. I would know what I
need to do ... Well while you are reading this I am continue studding
.
regards,
--
Mhayk Whandson
MSN: eu at mhayk.com.br
ICQ: 163967537
GoogleTalk: mhaykwhandson at gmail.com
Skype: mhaykwhandson
More information about the asterisk-dev
mailing list