private void terminate() { final SipSession sipSession = initialInvite.getSession(); final SipServletRequest bye = sipSession.createRequest("BYE"); try { bye.send(); } catch(final IOException exception) { logger.error(exception); } server.destroyMediaSession(session); }
public void onEvent(PlayerEvent event) { try { logger.info("ENDING CALL "); Player player = event.getSource(); MediaGroup mg = player.getContainer(); if (event.isSuccessful() && (PlayerEvent.PLAY_COMPLETED == event.getEventType())) { MediaSession session =(MediaSession)sipSession.getAttribute("mediaSession"); session.release(); Thread.sleep(1500); SipServletRequest byeRequest = sipSession.createRequest("BYE"); byeRequest.send(); } } catch (Exception e) { logger.error("Error", e); } }
cancelRequest.send(); } else {
@Override public synchronized void cancel() throws CallException { final List<State> possibleStates = new ArrayList<State>(); possibleStates.add(QUEUED); possibleStates.add(RINGING); assertState(possibleStates); if(Direction.OUTBOUND_DIAL == getDirection()) { final SipServletRequest cancel = initialInvite.createCancel(); try { cancel.send(); cleanup(); setState(CANCELLED); fireStatusChanged(); } catch(final IOException exception) { cleanup(); setState(FAILED); fireStatusChanged(); throw new CallException(exception); } } }
cancelRequest.send(); } catch (Exception e) { if(logger.isDebugEnabled()) {
public synchronized void established(final SipServletResponse successResponse) throws CallException, IOException { final List<State> possibleStates = new ArrayList<State>(); possibleStates.add(QUEUED); possibleStates.add(RINGING); assertState(possibleStates); byte[] answer = successResponse.getRawContent(); try { if(answer != null) { answer = patchMedia(successResponse.getInitialRemoteAddr(), successResponse.getRawContent()); final ConnectionDescriptor remoteDescriptor = new ConnectionDescriptor(new String(answer)); userAgentConnection.modify(remoteDescriptor); } else { terminate(); setState(FAILED); fireStatusChanged(); throw new CallException("The remote client did not send an SDP answer with their 200 OK response."); } } catch(final SdpException exception) { terminate(); setState(FAILED); fireStatusChanged(); throw new CallException(exception); } final SipServletRequest ack = successResponse.createAck(); ack.send(); }
bye.send(); } catch (IOException e) { logger.error("Couldn't send the BYE " + bye, e);
@Override public synchronized void dial() throws CallException { assertState(QUEUED); // Try to negotiate media with a packet relay end point. try { relayEndpoint = session.getPacketRelayEndpoint(); userAgentConnection = session.createConnection(relayEndpoint); userAgentConnection.addObserver(this); userAgentConnection.connect(ConnectionMode.SendRecv); block(1); if(!MgcpConnection.HALF_OPEN.equals(userAgentConnection.getState())) { throw new Exception(mmsTimedOutException()); } final byte[] offer = patchMedia(server.getExternalAddress(), userAgentConnection.getLocalDescriptor().toString().getBytes()); initialInvite.setContent(offer, "application/sdp"); initialInvite.send(); } catch(final Exception exception) { cleanup(); setState(FAILED); fireStatusChanged(); final StringBuilder buffer = new StringBuilder(); buffer.append("There was an error while dialing out from "); buffer.append(initialInvite.getFrom().toString()).append(" to "); buffer.append(initialInvite.getTo().toString()); throw new CallException(exception); } }
request.createCancel().send(); } catch (IOException e) { if(logger.isEnabledFor(Priority.WARN)) {
sipServletRequest.getSession().setAttribute("connection", conn); sipServletRequest.getSession().setAttribute("shipping", true); sipServletRequest.send(); mg.getSignalDetector().addListener(new DTMFListener(mg, sipServletRequest.getSession(), MMSUtil.audioFilePath)); conn.join(Direction.DUPLEX, mg);
outRequest.send(); Address originalFromAddress = request.getFrom(); SipURI originalFromUri = (SipURI) originalFromAddress.getURI();
sipServletRequest.getSession().setAttribute("callerDomain", (String)Contexts.getApplicationContext().get("caller.domain")); sipServletRequest.getSession().setAttribute("callerPassword", (String)Contexts.getApplicationContext().get("caller.password")); sipServletRequest.send(); mg.getSignalDetector().addListener(new DTMFListener(mg, sipServletRequest.getSession(), MMSUtil.audioFilePath)); conn.join(Direction.DUPLEX, mg);
((SipSessionExt) outRequest.getSession()).setBypassProxy(true); outRequest.send(); outRequest.getSession().setAttribute(FROM_INET_URI, from);
sipServletRequest.send();
sipServletRequest.getSession().setAttribute("callerDomain", (String)Contexts.getApplicationContext().get("caller.domain")); sipServletRequest.getSession().setAttribute("callerPassword", (String)Contexts.getApplicationContext().get("caller.password")); sipServletRequest.send(); mg.getSignalDetector().addListener(new DTMFListener(mg, sipServletRequest.getSession(), MMSUtil.audioFilePath)); conn.join(Direction.DUPLEX, mg);