Пример #1
0
 /** @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);
   }
 }
Пример #2
0
 /** {@inheritDoc} */
 public void disconnect(final ConnectionInformation info) {
   LOGGER.info(".. with ConnectionInformation:" + info);
   final MobicentsConnectionInformation vnxivrInfo = (MobicentsConnectionInformation) info;
   terminal = vnxivrInfo.getTerminal();
   terminal.disconnect();
   terminal.removeListener(this);
 }
Пример #3
0
 /**
  * {@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);
   }
 }
Пример #4
0
 /** {@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));
 }
Пример #5
0
 /** {@inheritDoc} */
 public void stopRecording() throws NoresourceError {
   if (terminal == null) {
     throw new NoresourceError("No active telephony connection!");
   }
   LOGGER.debug(" ...");
   terminal.stopMedia();
 }
Пример #6
0
  /** {@inheritDoc} */
  public void stopPlay() throws NoresourceError {
    if (terminal == null) {
      throw new NoresourceError("No active telephony connection!");
    }
    LOGGER.info("hangup the terminal:" + terminal);
    terminal.stopMedia();
    //        terminal.hangup();

  }
Пример #7
0
 /** {@inheritDoc} */
 public void connect(final ConnectionInformation info) throws IOException {
   LOGGER.info(".. with ConnectionInformation:" + info);
   final MobicentsConnectionInformation vnxivrInfo = (MobicentsConnectionInformation) info;
   terminal = vnxivrInfo.getTerminal();
   terminal.addListener(this);
 }