Tutorial:Working as UAS

From Wesip

From Wesip

To generate a response to an incoming request UAS servlets simply have to invoke createResponse(statusCode,reasonPhrase) on the request object being processed, modify the SipServletResponse obtained if needed and invoke its send method.

protected void doInvite(SipServletRequest req) throws 
         javax.servlet.ServletException,  java.io.IOException{
  SipServletResponse resp = req.createResponse(486,"I'm so busy now. Sorry');

Retransmissions of 2xx responses to INVITEs are handled by the container so the developer doesn't need to care about. ACKs are passed to the servlet only if they are for a 2xx response to an INVITE (otherwise they are usually not of interest to the application).

When a CANCEL arrives for a request that has not been proxied or responded by the application the container itself responds to the original request with a 487 (Request Terminated) and to the CANCEL with a 200 OK. Then it passes the CANCEL to the application which in turn should abort the process of the incoming request.

<< Working as UAC | Working as B2BUA >>