The Mobicents SIP servlet container appears to handle error responses differently to other SIP containers I've used. The situation is that:
On receipt of an INVITE, app handles and proxies (supervised) downstream (so it may receive the responses to the invite).
On receipt of an error response from the initial target, app proxies to a new destination (in a non-supervised way).
This should prevent the initial error response from propagating upstream (since the transaction has a new target). However, with the Mobicents container, even though the INVITE is indeed proxied out to the new destination, the initially received error response still propagates upstream. I believe that this is a bug in the Mobicents implementation - but how does one work around this?
Code:
public void doInvite(SipServletRequest req) {
req.getProxy().proxyTo(req.getRequestURI());
}
public void doError(SipServletResponse res) {
Proxy p = res.getProxy();
p.setSupervised(false);
p.proxyTo(...);
// request is proxied, but the error response still passes
// upstream - the retargeting of the transaction (through
// proxying to a new destination ought to prevent that).
}