unispeech / unimrcp

Open source cross-platform implementation of MRCP protocol

Home Page:http://www.unimrcp.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

503 is never sent in response to OPTIONS while offline

ladenedge opened this issue · comments

When UniMRCP is offline and receives an OPTIONS request, we attempt to send a 503 response, but Sofia refuses to respond with the error, "Responding to a Non-Existing Request."

We attempt to send the response in the following way (mrcp_sofiasip_server_agent.c):

if (sofia_agent->online == FALSE) {
    apt_log(SIP_LOG_MARK, APT_PRIO_WARNING, "Cannot do Resource Discovery in Offline Mode");
    nua_respond(nh, SIP_503_SERVICE_UNAVAILABLE, TAG_END());
    return;
}

But nua_respond() expects the initial request be supplied for non-INVITE requests. This same issue was discussed on the sofia-sip list some time ago. The fix, which I have tested with Wireshark, is the same mentioned on that list. When it's in place, we get the response as expected:

Wireshark capture

A PR should be attached shortly.

Right, NUTAG_WITH_CURRENT(nua) has been used to send a regular SIP 200 response to SIP OPTIONS.

https://github.com/unispeech/unimrcp/blob/master/modules/mrcp-sofiasip/src/mrcp_sofiasip_server_agent.c#L573

And sending a SIP 503 should be no differ.