Adhearsion + Unimrcp + ASR

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Adhearsion + Unimrcp + ASR

johnogara
Hello All,
   I'm using adhearsion (1.2) with unimrcp (1.0) and an ASR engine and
for the most part everything works fine (my asterisk version is
1.6.2).
My problem is with using ReadFile to assign an asterisk variable in
one command and then to access it in the next, code snippet is below

@call.execute("ReadFile", "URI_LIST=#{options[:grammar_file_location]}
#{@sep}#{File.size(options[:grammar_file_location])}")
@call.execute("MRCPRecog", "${URI_LIST}#{@sep}f=#{background}
&nb=#{options[:nbest]}&sit=false&p=default&b=1&t=#{options[:timeout] *
1000}&sl=.8&sct=500&sint=800&nit=#{options[:timeout] * 1000}&i=none")

In the first line I'm reading contents of the grammar file (its
actually a list of grammar locations) into the URI_LIST variable and
in the second I'm attempting to use this variable as a parameter to
the my MRCPRecog command, unfortunately the variable is always blank.
I have tried reading the file contents into a var on the ahn side and
passing it to the MRCPRecog cammon like my other vars
(options[:timeout] etc.) but this doesn't work as there are newline
characters in the file contents which result in the rest of the params
not being passed at all.
I've tried this exact sequence of commands in my dialplan and they
work fine.
Any help much appreciated
John

--
You received this message because you are subscribed to the Google Groups "Adhearsion" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/adhearsion?hl=en.

Reply | Threaded
Open this post in threaded view
|

Re: Adhearsion + Unimrcp + ASR

Ben Klang-2

Hello All,
  I'm using adhearsion (1.2) with unimrcp (1.0) and an ASR engine and
for the most part everything works fine (my asterisk version is
1.6.2).
My problem is with using ReadFile to assign an asterisk variable in
one command and then to access it in the next, code snippet is below

@call.execute("ReadFile", "URI_LIST=#{options[:grammar_file_location]}
#{@sep}#{File.size(options[:grammar_file_location])}")
@call.execute("MRCPRecog", "${URI_LIST}#{@sep}f=#{background}
&nb=#{options[:nbest]}&sit=false&p=default&b=1&t=#{options[:timeout] *
1000}&sl=.8&sct=500&sint=800&nit=#{options[:timeout] * 1000}&i=none")


I think your problem here is the use of ${URI_LIST}  I do not believe dialplan variables are expanded when invoked via AGI.  Try something like this

@call.execute("ReadFile", "URI_LIST=#{options[:grammar_file_location]}#{@sep}#{File.size(options[:grammar_file_location])}")

uri_list = @call.get_variable 'URI_LIST'

@call.execute("MRCPRecog", "#{uri_list}#{@sep}f=#{background}&nb=#{options[:nbest]}&sit=false&p=default&b=1&t=#{options[:timeout] * 1000}&sl=.8&sct=500&sint=800&nit=#options[:timeout] * 1000}&i=none")
 

That's a pretty long string so you might want to eventually provide a wrapper method to construct it and make it more readable.  But I think that will address the issue.

/BAK/
-- 
Ben Klang
404.475.4841

Mojo Lingo -- Voice applications that work like magic
Twitter: @MojoLingo

In the first line I'm reading contents of the grammar file (its
actually a list of grammar locations) into the URI_LIST variable and
in the second I'm attempting to use this variable as a parameter to
the my MRCPRecog command, unfortunately the variable is always blank.
I have tried reading the file contents into a var on the ahn side and
passing it to the MRCPRecog cammon like my other vars
(options[:timeout] etc.) but this doesn't work as there are newline
characters in the file contents which result in the rest of the params
not being passed at all.
I've tried this exact sequence of commands in my dialplan and they
work fine.
Any help much appreciated
John

--
You received this message because you are subscribed to the Google Groups "Adhearsion" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/adhearsion?hl=en.


--
You received this message because you are subscribed to the Google Groups "Adhearsion" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/adhearsion?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Adhearsion + Unimrcp + ASR

johnogara
This post has NOT been accepted by the mailing list yet.
Hi Ben,
    Thanks for the response, I tried that previously but it fails as the line breaks in the uri_list variable truncate the options being passed to MRCPRecog

Below is what I get in my adhearsion log, note that there is a line break after each grammar uri

DEBUG agi: >>> EXEC MRCPRecog "http://localhost/common/grammars/digits_ABNF-c33c6787105075eb964f845a3debc53b.gram
http://localhost/common/grammars/digits_dtmf_ABNF-dc6be8d27de34ea33adfbdb5b776b413.gram
,f=/var/lib/asterisk/sounds/generate-prompt-julie-1904f3b862f2eb065f5d0e875a1df503&nb=1&sit=false&p=default&b=1&t=5000&sl=.8&sct=500&sint=800&nit=5000&i=none"


This is what comes through on the asterisk console

AGI Script Executing Application: (MRCPRecog) Options: (http://localhost/common/grammars/digits_ABNF-c33c6787105075eb964f845a3debc53b.gram)


Any ideas?

John