From: spencer l. <spe...@gm...> - 2010-01-10 19:51:55
|
On Sat, Jan 9, 2010 at 1:37 PM, johny jj2 <joh...@gm...> wrote: > Thank you for your answer! > > I've got two major difficulties, one with adding action to recognizing > words which match the grammar and the other with running Parrot from > softphone. Please, answer at least first of these two. > > ---------------------------------------------------- > > May you tell me, please, how to add action to Parrot if the {WEATHER} > is recognized? I'd like the application to respond with wav file and > to follow some java code (e.g. write to file; in my case it would be > calculating sum and playing either 1.wav or 2.wav). > > I guess there must be change to both Parrot.java and parrot.vxml. > > For example to parrot.vxml (perhaps it is not good way) - to answer > the action with wav file: > > <filled> > > <prompt> <value expr="main"/> </prompt> > <if cond="main=='weather'"> //NEW CODE BEGINS HERE > <block> > <audio src="weather_wav_file_URL"/> > </block> > </if> //NEW CODE ENDS HERE > > <if cond="main=='quit'"> > > <exit/> > > <else/> > > <clear namelist="main"/> > > <reprompt/> > > </if> > > > > </filled> > Yes, i am not a jvoicexml expert either, but you can add conditional statements like you suggest. You can also have more than one tag. Another way to make things dymamic is create the vxml dynamically -- something like a servelet. > And Parrot.java - to add some action with java code, e.g. writing to file: > > if ((rule.getTag().equals("QUIT")) && (rule.getRule().equals("main"))) > { > > //... > > } > if ((rule.getTag().equals("WEATHER")) && > (rule.getRule().equals("main"))) { > > //here e.g. I perform calculations - according to their > result I'd like the application to say either "control sum correct" or > "control sum incorrect" - wav answer is DEPENDENT ON CALCULATIONS, not > only on recognized word (which is the case of using vxml file)!!! how > to specify playing either 1.wav or 2.wav here ?!?!? > > } > Yes. something like this should do what you want. You need to construct a grammar to recognize numbers. You can always try to parse and analyize the raw results, Or you can construct the grammar so that it contains rules/tags to indicate which numbers were said. If my memory serves me, a rule should be able to conatin an array of tags, which may be helpful in your case. Given a number like 1234, will your grammar allow for "one two three four" or "one thousand two hundred and thirty four" or "twelve thirtyfour" TIn any case, the code that analizes the results (either the raw results or the tags) can select the name of a wav file that will be passed into the next call to playAndRecognize(..) > > Some additional, minor, questions: > > 1. I don't get why in parrot.vxml there is "Would you like to hear the > weather, get sports news or hear a stock quote?" if the parrot > application is about repeating what somebody says. > It only repeats, it if it is in the grammar. Take a look at the grammar, it only is set up for sports news, weather and stock quotes. Everything else is out of grammar. > 2. Why is there > ~/cairo/zanzibar-0.1-src/src/resources/prompts/parrot.wav if this wav > is never used? > It should be used. I think I added fo testing and meant to include it in a second version of the parrot demo. It should be quite easy actually. Just change line 68 in parrot.java to this. String filename = "file:///<yourpath>/zanzibar-SNAPSHOT/demo/prompts/parrot.wav"; RecognitionResult r = sClient.playAndRecognizeBlocking(true, filename,grammar, false); > ---------------------------------------------------- > > May you also help me to run this Parrot from softphone, please? > > 1. I extracted zanzibar-0.1-bin.tar.bz2 to > /home/mainaccount/cairo/zanzibar-0.1-bin. Later I did all the stuff > connected with global variables for Java, extracting JSAPI etc. > 2. I run /home/mainaccount/cairo/zanzibar-0.1-bin/bin/rserver.sh from > Terminal. (There was error in sh file - I had to change from \ to / > because it couldn't find launch.sh). > Sorry about the bug, can you let me know what you fixed, so I can check it in of others. maybe send the fixed file? > 3. I copy config directory from ~/cairo/zanzibar-0.1-bin to > ~/cairo/zanzibar-0.1-bin/bin because one of those three sh couldn't > find config directory. > 4. OK, all three sh files from ~/cairo/zanzibar-0.1-bin/bin/cairo and > also ~/cairo/zanzibar-0.1-bin/bin/zanzibar/asteriskConnector.sh are > running. > Also do you remember which script had trouble? There should be no need to copy things around like that. I would like to fix it, so other s dont run into that same problem. > 5. I add to sip.conf: > > [Zanzibar] > type=peer > host=localhost //I wasn't sure what to write here > port=5090 > dtmfmode=info > canreinvite=no > > 6. I add to extensions.conf at the end of [mainmenu] section (is it > proper place?): > > exten => 1,n,SIPAddHeader(x-channel:${CHANNEL}) > exten => > 1,n,SIPAddHeader(x-application:basic|org.speechforge.apps.demos.Parrot) > exten => 1,n,Dial(SIP/Zanzibar) > > 7. I add to /etc/asterisk/manager.conf at the end of file: > > [twinkle] > secret=password > permit=0.0.0.0/0.0.0.0 > read=system,call,log,verbose,agent,command,user > write=system,call,log,verbose,agent,command,user<http://0.0.0.0/0.0.0.0%0Aread=system,call,log,verbose,agent,command,user%0Awrite=system,call,log,verbose,agent,command,user> > > 8. I cannot find context.xml file to do what is written here > http://www.spokentech.org/openivr/aik.html > I will improv the docs. I mean the config.xml file. it used to be named context.xml. The trick is you need to change the one you are using -- an there are moe than one. It is the one being used in zanzibar.sh file. But you are not going to need this (now) -- it is only needed if you want to transfer calls out -- back through asterisk. > 9. I run 'asterisk' in Terminal > > 10. I run 'twinkle'. I choos profile: 'twinkle', SIP service provider: > 'None (direct IP to IP calls), username: twinkle, domain: localhost, > system settings -> network -> SIP port: 5061. I write in call: > '1000@127.0.0.1'. It connects me to "Congratulations. You have > successfully installed and executed the Asterisk open source". So I > can connect to Asterisk but cannot connect to Parrot demo. I guess the > call is improper but there also may be something wrong with > configurations above. > It is good that you have twinkle calling asterisk. The issue is probably now with step 6. The asterisk dialplan (in extensions.conf). It is playing the weclcome message rather than transferring the call to zanzibar. Take a closer look at the dialplan, I bet all calls play the message, for a test change that to have all calls directed to zanzibar. if you can send the dialplan , I can take a look too? > > Regards! > > PS > > Are your acoustic models in jar files? > Yes, it contains two directories (etc and model_parameters) without > loaders (it needs sphinx3 loader to be specified in xml). > I am interested in building models too. Have you had much success yet? > > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and > easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ > cairo-user mailing list > cai...@li... > https://lists.sourceforge.net/lists/listinfo/cairo-user > |