/** @param call @Override */ public void onStatusChanged(Call call) { try { MgcpCallTerminal term = (MgcpCallTerminal) call; LOGGER.debug(" for CallControlProperties:" + props + " " + call.toString()); if ((Call.Status.COMPLETED == call.getStatus() || Call.Status.IN_PROGRESS == call.getStatus()) && term.getIVREndPointState() == MgcpIvrEndpoint.IDLE && (term.getIVREndPointOldState() == MgcpIvrEndpoint.PLAY || term.getIVREndPointOldState() == MgcpIvrEndpoint.PLAY_COLLECT || term.getIVREndPointOldState() == MgcpIvrEndpoint.PLAY_RECORD)) { JVoiceXmlRecordResult result = new JVoiceXmlRecordResult(); long duration = (long) props.getGenProperties(JVoiceXmlRecordResult.DURATION); result.setDuration(duration); if (duration >= JVoiceXmlRecordResult.DEFAULT_RECORDING_MAXTIME) result.setMAXTIME("true"); else result.setMAXTIME("false"); result.setTermchar((String) props.getGenProperties(JVoiceXmlRecordResult.TERMCHAR)); result.setSize(-1); final JVoiceXMLEvent event = new RecordingEvent(null); ((RecordingEvent) event).setInputResult(result); EventHandler handler = (EventHandler) props.getGenProperties("EventHandler"); handler.notifyEvent(event); } } catch (Exception ex) { ExLog.exception(LOGGER, ex); } }
/** {@inheritDoc} */ public void startRecording( final SpokenInput input, final OutputStream stream, final CallControlProperties props) throws NoresourceError, IOException { LOGGER.debug("with input:" + input + " stream:" + stream + " props:" + props); if (terminal == null) { throw new NoresourceError("No active telephony connection!"); } this.props = props; terminal.addObserver(this); // adding observer this terminal.recordAfterBeep((long) props.getGenProperties(JVoiceXmlRecordResult.DURATION)); }