[asterisk-dev] How to get a pointer to the ast_speech struct from a Channel struct

Joshua Colp jcolp at digium.com
Thu May 5 13:36:45 CDT 2011


----- Original Message -----
> Hello,
> I'm new to this list so please forgive me if I break any nettiquete
> rules on the maillist, I tried posting on asterisk-speech-rec list but
> it seems it has been inactive for quite some time.
> 
> I wrote an Asterisk Connector to a in-house ASR Engine that works
> quite well. But to be able to tune up our recognition engine I added
> the feature to my connector so we can record the input audio signal on
> a temporary file.
> I would like to add a dialplan function on my connector to retrieve
> this filename to do aditional processing (for now logging request &
> reponses into an external DB). My problem resides that I don't know
> how to retrieve a pointer to the ast_speech structure from a Channel
> structure.
> I have tried invoking the find_speech helper function, but when I load
> the connector into Asterisk I get the error: undefined symbol
> `find_speech`.
> My guess is that find_speech is not exported by res_speech.so but I
> don't know how else to do it.
> For now I have kinda 'solved' the problem by appending the filename
> into the speech->results->text variable that I latter parse into the
> real speech result text and the filename, but I think thats kinda
> messy/hacky and I would like a clean implementation.
> Have anyone found themselves on a similar situation? Any suggestions?

You really can't. The way the speech structure is stored is for the app_speech_utils
applications themselves, not for usage by other applications/dialplan functions. The only options
you really have is to add your own dialplan function in app_speech_utils that then calls into
your engine or to do as you are already doing.

-- 
Joshua Colp
Digium, Inc. | Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at:  www.digium.com  & www.asterisk.org



More information about the asterisk-dev mailing list