Using Telephony Application Services
Telephony Application Services (TAS) is the client that renders telephony applications in a staging and production environment. In contrast, use Telephony Application Simulator to render telephony applications in the Microsoft Speech Application SDK (SASDK).
Use Telephony Application Simulator in the SASDK for unit testing. For information on Telephony Application Simulator, see Using Telephony Application Simulator as a Client. Before deploying a telephony application, test it on a staging server using TAS. For a general description of best practices in deploying .NET applications, see Deploying .NET Applications: Lifecycle Guide in the MSDN Library. For information on deploying SASDK applications, see Deploying Speech Applications.
Speech Control Rendering
TAS supports the following types of Speech Controls:
- Basic Speech Controls
- Dialog Speech Controls
- Application Speech Controls
Scripting Support
TAS provides the following HTML and scripting support:
- support for a subset of XHTML
- support for JScript .NET
It is a good practice to wrap the content of <script> tags in CDATA tags. This will avoid page load failures caused by special characters in the script content.
<script>
<![CDATA[
if (obj == null)
i = 0;
]]>
</script>
Speech Controls render inline grammars to TAS and Telephony Application Simulator wrapped into CDATA tags. This is done automatically by controls and does not require any effort from the developer.
Warning Microsoft JScript .NET issues a security exception when partially trusted code attempts to create a Function object using either the eval or function constructs. For instructions on how to work around this issue, see this Microsoft Knowledge Base article.
Accessing Call Results
Telephony Interface Manager sends XML-formatted call information to TAS contained in a document object model (DOM). When accessing the results DOM use a local variable to hold a reference to the object, rather than making multiple references directly to the object. Making multiple references to the DOM may result in building the DOM multiple times, which is inefficient. Use script to access the results DOM as in the following example.
function idSmex_OnReceive()
{
var receivedDOM = idSmex.received;
switch (receivedDOM.baseName)
{
case "DeliveredEvent":
connection = receivedDOM.selectSingleNode("/csta:DeliveredEvent/csta:connection/csta:callID").xml;
break;
default:
window.close();
break;
}
}
Using Static Data in JScript
Static variables in TAS JScript are not shared between different calls, or even different pages within the same call. Moreover, static constructors only execute the first time JScript is used for a particular page. This may lead to unexpected results. Microsoft recommends that authors not write any JScript that uses a static constructor. See the following code example.
<:script type="text/jscript">:
<:![CDATA[
class Tractor
{
static var EngineSize : int = 428;
}
LogMessage ( "INFORMATIONAL", "EngineSize = " + Tractor.EngineSize );
]]>:
<:/script>:
In this example the first time TAS loads the page, TAS will output the message "EngineSize = 428". If the page is loaded again, during the same call or by a different call, the message "EngineSize = 0" will be sent. Note also that if the class Tractor in this example had been declared in a cacheCompiled assembly, then the static constructor would not execute at all and Tractor.EngineSize would always equal zero.
Caching JScript
With applications containing TAS logic that is as complex as RunSpeech, use the cacheCompiled attribute in the script element. This causes the script file to be compiled as a separate assembly, allowing it to be cached.
In general, classic JScript will not compile in a cacheable manner. A file referenced by a script element that includes the cacheCompiled attribute must be compiled independently from other script and may only contain script and type declarations. It may not include static data or global code. To test whether JScript can be compiled into an assembly, compile it as shown in the following example.
jsc.exe /target:library /reference:"%programfiles%Microsoft Speech Server\TAS\Microsoft.TAS.dll" YourScriptFile.js
If the previous command yields no errors, referencing YourScriptFile.js as cacheCompiled="true" in the page will improve application performance. If the JScript can not be compiled, the following error is displayed.
YourScriptFile.js(line,pos) : error JS1234: Only type and package definitions are allowed inside a library
If the script won't compile without error then do not specify cacheCompiled="true" as this causes that script to be compiled twice; once when the attempt is made to compile it as an assembly, which fails, and then when it is compiled along with the rest of the script on the application page.
Security
TAS uses a list of Trusted Sites that, by default, includes only https://localhost. Telephony Application Simulator imposes no security restrictions, treating all sessions as trusted sessions.
Computer Telephony Integration (CTI) Support
TAS supports CTI data. Telephony Application Simulator does not support CTI data.
Prompt Database File References
To reference prompt databases on TAS, use a URL address. Telephony Application Simulator requires a local file path to reference prompt databases.
See Also
Adjusting for Differences Between Clients | Debugging Voice-only Applications | Avoiding Dynamic Scripts