在学MSPL时,为了能快速找到感觉,首先找了一个文档中的Example,如下:
<?xml version="1.0" ?>
<!-- Set the application URI, the namespace prefix, and the namespace name -->
<lc:applicationManifest
appUri="http://www.adatum.com/myApplicationLocation"
xmlns:lc="http://schemas.microsoft.com/lcs/2006/05">
<!-- Define properties of the application -->
<lc:requestFilter methodNames="INVITE,MESSAGE"
strictRoute="false"
registrarGenerated="true"
domainSupported="true"/ >
<lc:responseFilter reasonCodes="NONE" />
<lc:proxyByDefault action="true" />
<lc:scriptOnly />
<!-- The message filtering script -->
<lc:splScript><![CDATA[
if (sipRequest) {
if (sipRequest.Method == StandardMethod.Invite) {
Dispatch("NameOfInviteHandlerMethodInApplicationHere");
}
else if (sipRequest.Method == StandardMethod.Message) {
Dispatch("NameofMessageHandlerMethodInApplicationHere");
}
}
]]></lc:splScript>
</lc:applicationManifest>
接照说明,把这段内容保存成AM文件后在OCS的管理控制台中加载脚本,经反复偿试,均以失败告终。根据日志记录,才最终加载成功。
首先,这段代码由于一个地方的错误,导致不能正常地解析为XML文档,
在文档的第12行:
domainSupported="true"/ >
应该是:
domainSupported="true" />
其次,这个清单文件标记为scriptOnly ,可又包含了Dispatch,在介绍scriptOnly元素时,有这么一段Remarks,“If an application is script-only, calling the MSPL Dispatch function will generation a compiler error.”由此可见这个Example的失败了。
将文件内容修改如下,加载成功。由于没做什么动作,因此也看不到什么效果,至少,它加载成功了。进一步的学习可以进行了。
<?xml version="1.0" ?>
<!-- Set the application URI, the namespace prefix, and the namespace name -->
<lc:applicationManifest
appUri="http://www.adatum.com/myApplicationLocation"
xmlns:lc="http://schemas.microsoft.com/lcs/2006/05">
<!-- Define properties of the application -->
<lc:requestFilter methodNames="INVITE,MESSAGE"
strictRoute="false"
registrarGenerated="true"
domainSupported="true" />
<lc:responseFilter reasonCodes="NONE" />
<lc:proxyByDefault action="true" />
<lc:scriptOnly />
<!-- The message filtering script -->
<lc:splScript><![CDATA[
if (sipRequest) {
if (sipRequest.Method == StandardMethod.Invite) {
}
else if (sipRequest.Method == StandardMethod.Message) {
}
}
]]></lc:splScript>
</lc:applicationManifest>