Asrsql
![]() |
Allows you to create a custom grammar file from a SQL database used by your organization. For example, you might want to route customers based on an uttered part number or employee last name. Grammar files are in the .grxml format. Asrsql is not used in production scripts, but rather, in a special use script that is run on an occasional or as-needed basis. When the script is run, the action uses DB Connector to connect to your external database and pull a file of values based on the query you provide. This action is typically used in conjunction with Asrcompile to create a compiled grammar file from a database. ASR actions appear only if ASR is enabled for your |
Supported Script Types
![]() |
Phone |
Properties
Property | Details |
---|---|
GrammarFileName | The name of the grammar (GRXML) file you want to compile. You must upload this file in Studio prior to processing it with Asrcompile. The newly-compiled file will have the same name, but with a GRAM extension. After processing, the new file is stored with your other Studio files. |
SpellRuleItems | Formats the detected utterance to each individual character of what was spoken instead of the whole word. This would be used when pulling account numbers or part numbers so each character is individual. The formatting adds a space between each of the characters. For example, ABC12345 would be A B C 1 2 3 4 5. |
IsOutputFormatted | Formats the .grxml file so it is easier to read. It is formatted similarly to .xml. |
SQLQuery |
The SQL that would get the data to build the .grxml file. The first return of the SELECT statement would be the utterance that would be detected by the ASR engine to find a match. For example:
SELECT[Name] ,[Address] ,[Phone_Number] FROM [dbo].[User_Table] WHERE[ID]>0 In the example above, the first return in the SELECT is Name, so the grammar would be built to presumably detect a person's name. If a match exists, the corresponding Name, Address, and Phone Number would be returned with that record. |
TimeoutSec |
Determines how long the IVR The timer starts only when the prompt is completely finished. However, the system has a built-in limit of two minutes (120 seconds) that includes the duration of the prompt. If this limit is reached during an action, any active prompts are aborted and the OnError branch is taken. For this reason, you should know the duration of your prompts and set a value for this field that ensures the action is active for less than two minutes. |
Branches
Branch | Details |
---|---|
Default | Path taken unless the script meets a condition that requires it to take one of the other branches. It is also taken if the other branches are not defined. |
OnNoRecords | Path taken when the query submitted to the database does not return results. |
OnError | Path taken when there is an unexpected problem (for example, poor connectivity, syntax errors, and so forth). The _ERR variable should be populated with a condensed explanation of the problem. |
OnTimeout | Path taken if there is no response for the number of seconds specified. |
Tips & Tricks
You can pass the languageLocale variable from the Voiceparams action, which sets the language that the action will detect.