/** * {@inheritDoc} * * <p>This implementation uses {@link SynthesizedOutput#getUriForNextSynthesisizedOutput()} to * obtain a URI that is being used to stream to the terminal. * * <p>Although this terminal is the source where to stream the audio this implementation makes no * assumptions about the URI. In most cases this will be related to the {@link SpokenInput} * implementation. In the simplest case this implementation <emph>invents</emph> a unique URI. */ public void play(final SynthesizedOutput output, final CallControlProperties props) throws NoresourceError, IOException { try { if (terminal == null) { throw new NoresourceError("No active telephony connection!"); } URI uri = null; try { LOGGER.debug("status of the terminal " + terminal); // checking termnal status before play if ((terminal.getIVREndPointState() == MgcpIvrEndpoint.PLAY || terminal.getIVREndPointState() == MgcpIvrEndpoint.PLAY_COLLECT || terminal.getIVREndPointState() == MgcpIvrEndpoint.PLAY_RECORD) && terminal.getIVREndPointState() != MgcpIvrEndpoint.STOP) { LOGGER.debug("canceling current playing.... "); // terminal.stopMedia(); } uri = output.getUriForNextSynthesisizedOutput(); } catch (URISyntaxException e) { throw new IOException(e.getMessage(), e); } LOGGER.debug("playing URI '" + uri + "'" + " CallControlProperties: " + props); terminal.play(uri, 1); terminal.addObserver((MobicentsSynthesizedOutput) output); // terminal.play(new // URI("http://192.168.146.146:8080/VNXIVR/audio/dtmf_welcome.wav"), 1); // Thread.sleep(10000); } 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)); }