/** * * @param req * @throws IOException */ private void notImplemented(SipServletRequest req) throws IOException { SipServletResponse resp = req.createResponse(501, "Request not implemented"); resp.send(); } }
/** * * @param req * @throws IOException */ private void notHandled(SipServletRequest req) throws IOException { SipServletResponse resp = req.createResponse(500, "Request not handled by app"); resp.send(); }
private void fail(int code) { final SipServletResponse fail = initialInvite.createResponse(code); try { fail.send(); } catch(final IOException exception) { logger.error(exception); } cleanup(); setState(FAILED); }
public synchronized void bye(final SipServletRequest request) throws IOException { final List<State> possibleStates = new ArrayList<State>(); possibleStates.add(QUEUED); possibleStates.add(RINGING); possibleStates.add(IN_PROGRESS); assertState(possibleStates); final SipServletResponse ok = request.createResponse(SipServletResponse.SC_OK); try { ok.send(); } finally { cleanup(); setState(COMPLETED); dateEnded = DateTime.now(); fireStatusChanged(); } }
public synchronized void cancel(final SipServletRequest request) throws IOException { final List<State> possibleStates = new ArrayList<State>(); possibleStates.add(QUEUED); possibleStates.add(RINGING); possibleStates.add(TRYING); assertState(possibleStates); final SipServletResponse ok = request.createResponse(SipServletResponse.SC_OK); try { ok.send(); } finally { cleanup(); setState(CANCELLED); fireStatusChanged(); } }
@Override public synchronized void reject() { assertState(RINGING); final SipServletResponse busy = initialInvite.createResponse(SipServletResponse.SC_BUSY_HERE); try { busy.send(); } catch(final IOException exception) { cleanup(); setState(FAILED); fireStatusChanged(); logger.error(exception); } }
response.send(); } catch (IOException e) { logger.error("Can not send error response", e);
originalRequest.createResponse(100); try { trying.send(); } catch (IOException e) { logger.error("Cannot send the 100 Trying",e);
private synchronized void alert(final SipServletRequest request) throws CallException { assertState(TRYING); final SipServletResponse ringing = request.createResponse(SipServletResponse.SC_RINGING); try { ringing.send(); setState(RINGING); fireStatusChanged(); } catch(final Exception exception) { cleanup(); setState(FAILED); fireStatusChanged(); logger.error(exception); throw new CallException(exception); } }
static void authenticate(final SipServletRequest request, String realm) throws IOException { final SipServletResponse response = request.createResponse(SC_PROXY_AUTHENTICATION_REQUIRED); final String nonce = nonce(); String algorithm = RestcommConfiguration.getInstance().getMain().getClientAlgorithm(); String qop = RestcommConfiguration.getInstance().getMain().getClientQOP(); final String header = header(nonce, realm, "Digest", algorithm, qop); response.addHeader("Proxy-Authenticate", header); response.send(); }
@Override public synchronized void answer() throws CallException { assertState(RINGING); try { // Establish the media path way. relayOutboundConnection = session.createConnection(relayEndpoint); relayOutboundConnection.addObserver(this); relayOutboundConnection.connect(ConnectionMode.SendRecv); block(6, RINGING); // Send the response back to the caller. final byte[] answer = patchMedia(server.getExternalAddress(), userAgentConnection.getLocalDescriptor().toString().getBytes()); final SipServletResponse ok = initialInvite.createResponse(SipServletResponse.SC_OK); ok.setContent(answer, "application/sdp"); ok.send(); } catch(final Exception exception) { fail(SipServletResponse.SC_SERVER_INTERNAL_ERROR); fireStatusChanged(); logger.error(exception); throw new CallException(exception); } }
if(mfHeader.getMaxForwards()<=0) { try { this.createResponse(Response.TOO_MANY_HOPS, "Too many hops").send(); } catch (IOException e) { throw new RuntimeException("could not send the Too many hops response out !", e);
this.cancel(); try { originalRequest.createResponse(403).send(); } catch (IOException e) { logger.error("couldn't send 403 response", e1);
request.createResponse(428, "P-Asserted-Idetity header is required!").send(); return false;
request.createResponse(428, "P-Asserted-Idetity header is required!").send(); return false;
request.createResponse(428, "P-Asserted-Identity header is required!").send(); return false;
request.createResponse(428, "P-Asserted-Identity header is required!").send(); return false;
this.cancel(); try { originalRequest.createResponse(403).send(); } catch (IOException e) { logger.error("couldn't send 403 response", e1);
request.createResponse(100).send();