为什么我会收到 MSPL 异常 "ProxyRequest only valid for sipRequest"

Why do I get an MSPL exception "ProxyRequest only valid for sipRequest"

我正在使用清单和 windows 服务编写 Lync MSPL 应用程序。在我的 manifest.am 中,我有以下代码:

<?xml version="1.0"?>
<r:applicationManifest
 r:appUri="http://www.company.no/LyncServerFilter"
 xmlns:r="http://schemas.microsoft.com/lcs/2006/05">

<r:requestFilter methodNames="ALL"
             strictRoute="true"
             domainSupported="false"/>

<r:responseFilter reasonCodes="ALL"/>
<r:proxyByDefault action="true" />
<r:allowRegistrationBeforeUserServices action="true" />

<r:splScript>
    <![CDATA[

callId = GetHeaderValues("Call-ID"); 
cseq = GetHeaderValues("CSeq");
content = "";
sstate = GetHeaderValues("subscription-state");
xevent = GetHeaderValues("Event");
xdir = GetHeaderValues("Direction");
xexp = GetHeaderValues("Session-Expires");
referto = GetHeaderValues("Refer-To");

if (sipRequest)
{
    if (sipRequest.Method == "INVITE") {
        if (ContainsString(sipRequest.Content, "m=audio", true)) { 
            content = "audio";
        }
        else if (ContainsString(sipRequest.Content, "m=video", true)) { 
            content = "video";
        }
        else if (ContainsString(sipRequest.Content, "m=message", true)) { 
            content = "message";
        }
        else if (ContainsString(sipRequest.Content, "m=application", true)) { 
            content = "application";
        }
        else {
            content = "unknown";
        }

    }
    else if (sipRequest.Method == "NOTIFY" || sipRequest.Method == "BENOTIFY") {
        content = sipRequest.Content;
    }


    DispatchNotification("OnRequest", sipRequest.Method, sipMessage.From, sipMessage.To, callId, cseq, content, xdir, xevent, sstate, xexp, referto);
    if (sipRequest) {       
        ProxyRequest();
    }
}
else if(sipResponse) {
    DispatchNotification("OnResponse", sipResponse.StatusCode, sipResponse.StatusReasonPhrase, sipMessage.From, sipMessage.To, callId, cseq, content, xdir, xevent, sstate, xexp, referto);
    ProxyResponse();
}
]]></r:splScript>
</r:applicationManifest>

我在 Lync 前端服务器的事件日志中收到以下错误消息: Lync Server 应用程序 MSPL 脚本执行因错误而中止

http://www.company.no/LyncServerFilter”处的应用程序 URI,第 60 行 错误:0x80070057 - 参数不正确

附加信息:ProxyRequest 仅对 sipRequest 有效

第 60 行是我调用 ProxyRequest 的地方:

if (sipRequest) {       
ProxyRequest();
}

问题:

  1. 为什么错误消息说 ProxyRequest 仅对 sipRequest 有效?我正在检查它是 sipMessage 对吗?
  2. 我可以取消对 ProxyRequest() 的调用,因为我已经设置了 proxyByDefault=true 吗? DistpathNotification-method "handle" 是方法(吞下它),还是默认代理消息?当我删除对 ProxyRequest() 的调用时的代码 "works",但我不确定后果是什么......

ProxyRequest 方法采用 uri 参数,这就是您收到编译错误消息的原因。

所以你应该这样称呼它:

ProxyRequest(""); // send to the URI specified in the request itself

删除它的有效性与您的 proxyByDefault 设置设置为 true 的效果相同:

If true, the server automatically proxies any messages that are not handled by the application. If false, the message is dropped and applications that follow this application in the application execution order will not receive it. The default value is true.

作为旁注,您可以使用 compilespl.exe,它作为 Lync Server SDK 的一部分提供,以验证您的 MSPL 脚本是否正确,然后再尝试在 lync 服务器上启动它。

查看“单独编译 MSPL 应用程序”部分中的 link