[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Trouble with remote fetching and builtin grammars

You should intercept calls for things like builtin://<> in the recognizer
and do something appropriate.  All grammar management (and prompt
management) is delegate to the platform components: VXIrec, VXIprompt (and

-Brian Eberman
Director of Engineering
Open Speech and System Products
SpeechWorks International
695 Atlantic Ave
Boston, MA 02111
(617) 428 4444

-----Original Message-----
From: vxi-discuss@metronomicon.com
[mailto:vxi-discuss@metronomicon.com]On Behalf Of
Sent: Monday, March 12, 2001 6:53 PM
To: vxi-discuss@speechinfo.org
Subject: Trouble with remote fetching and builtin grammars

Greetings all.

I have implemented most of the PROMPT, REC and TEL APIs without
too much difficulty but the OS and builtin grammars have been
giving me a little trouble.

Are builtin grammars supported by openVXI in any way, or should
we intercept requests to load a grammar of type "builtin:..." and
load something appropriate ourselves?

Does the testVXI do any remote fetching for <grammar>, <audio>,
<submit> or anything?
I could not find any relevant code...

I therefore took advantage of the Xerces lib and, in the VXI OS
code, did something of the form:

	XMLURL theURL = XMLURL(theURI.c_str());
        XMLURL::Protocols protocol = theURL.getProtocol();

        switch (protocol) {
                case XMLURL::File:
		// Open file...

                case XMLURL::HTTP:

                    XMLByte buf[BUF_SIZE];
		// read in bytes ...


This works well for simple files.  In the case of CGIs, no
parameters are ever passed.  Is there a mechanism to accomplish this
that I have missed?

I added some code in VXIosOpenUrl to prepend the query arguments
("queryargs") retrieved from the urlInfo object to the URI.  I
am using a tag in the vxml file similar to :

<submit method="get" next="http://myhost.com/mycgi.cgi"; />

Which now causes openVXI to submit a URI to the Xerces code that looks


But the parameters are never passed to the cgi.  This is confirmed by
the apache logs :

[12/Mar/2001:14:27:17 -0800] "GET /cgi-bin/xfer.cgi HTTP/1.0" 200 189

I have made a modification to the xerces code - as far as I can tell it
simply ignores the query elements that are stored within the XMLURL object
it is passed during the call to the UnixHTTPURLInputStream constructor.
Were the modifications necessary or is there a better method?

I have included the diff between the original version of
and my own, for anyone interested.

<     char*               pathAsCharStar = XMLString::transcode(path);
<     ArrayJanitor<char>  janBuf2(pathAsCharStar);
>     char*               temppathAsCharStar = XMLString::transcode(path);
>     ArrayJanitor<char>  janBuf2(temppathAsCharStar);
>     // PAT'S HACK -- Add the query to the path if exists
>     const XMLCh*	query = urlSource.getQuery();
>     char*		queryAsCharStar = XMLString::transcode(query);
>     ArrayJanitor<char>  janBuf4(queryAsCharStar);
>     char* pathAsCharStar = new char[strlen(temppathAsCharStar) +
strlen(queryAsCharStar) + 2];
>     ArrayJanitor<char>  janBuf5(pathAsCharStar);
>     if (query)
>     {
> 	sprintf(pathAsCharStar, "%s?%s", temppathAsCharStar, queryAsCharStar);
> 	fprintf(stderr, "Full UnixHTTPURL is %s", pathAsCharStar);
>     }
>     else
>     {
> 	sprintf(pathAsCharStar, "%s", temppathAsCharStar);
>     }
>     // END Pat's hack.

Pat Deegan, TGFLinux

This page is maintained by Alan W Black (awb@cs.cmu.edu)
speechinfo.org is hosted on a machine donated by VA Linux Systems
VA Linux Systems