@Override
  public void doProcess(ExecutorRequest req, ExecutorResponse resp, ExecutorContext execContext)
      throws Exception {
    executorType = req.getExecutorType();

    if (DSR_SIGNAL_TYPE.equals(executorType)) {
      String signal = (String) req.getAttributes().get(SIGNAL);

      if (END_AUDIO_SIGNAL.equals(signal)) {
        procObj.getProfile().netIOEnd();
        // tell the recognizer that it has all the audio
        proxy.endAudio();

        // Stop reading chunk data
        callback.doEnd();
      } else if (CANCEL_SIGNAL.equals(signal)) {
        // The user canceled, so tell the recognizer to stop processing
        proxy.release();
      } else if (INIT_RECOGNIZER_SIGNAL.equals(signal)) {

        // HARD CODE TNCONTEXT - REMOVE ONCE DONGHENG FIXES DSM RULES
        hardCodeTnContext(execContext, req.getUserProfile());

        procObj.profile.netIOBegin();
        procObj.profile.totalProcessBegin();
        RecContext rc = (RecContext) req.getAttributes().get(ProtocolConstants.REC_CONTEXT);

        rc.user = req.getUserProfile();
        rc.ttsFormat = rc.user.getAudioFormat();
        rc.tnContext = execContext.getTnContext();

        List<GpsData> gpsData = req.getGpsData();

        if (gpsData != null && gpsData.size() > 0) {
          // just use the first fix
          GpsData data = gpsData.get(0);
          rc.location = new Stop();
          rc.location.lat = data.lat;
          rc.location.lon = data.lon;
        } else {
          logger.log(Level.WARNING, "Unablet o get GPS data from request.");
          rc.location = new Stop();
          rc.location.lat = 0;
          rc.location.lon = 0;
        }

        // process the meta information
        processMetaInfo(rc);

        // Initialize the recognizer
        proxy.init(procObj);
      } else logger.log(Level.WARNING, "Unrecognized dsr signal: " + signal);
    } else if (DSR_AUDIO_TYPE.equals(executorType)) {
      // write audio packet to the recognizer
      byte[] audioData = (byte[]) req.getAttributes().get(ProtocolConstants.AUDIO);
      proxy.addAudioSeg(audioData);
    } else logger.log(Level.WARNING, "Did not recognize dsr packet type: " + executorType);
  }
  private void processMetaInfo(RecContext context) {
    profile.netIOBegin();
    profile.totalProcessBegin();

    CliTransaction cli = new CliTransaction(CliConstants.TYPE_MODULE);
    cli.setFunctionName("handleMeta");

    // handle meta information
    if (context == null) {
      String responseMsg = "Unable to parse request meta data.";
      handleError(ResourceConst.SERVER_ERROR, responseMsg);
      cli.setStatus("responseMsg");
      cli.complete();
    }

    logger.log(Level.INFO, "Meta handled successfully");
    // Set context obtained form meta
    procObj.setContext(context);

    // Set profiling data
    setProfileInfo();

    // Obtain processConfig for corresponding recType
    int configId = procObj.getContext().recType;
    processConfig = ProcessConfigurationFactory.getConfiguration("" + configId);
    logger.log(Level.INFO, "Obtained process config instance for config id : " + configId);

    // Obtain proxy object
    proxy = processConfig.getProxy();
    proxy.addResultListener(this);

    logger.log(Level.INFO, "Obtained proxy instance from process config");

    // proxy.init(procObj);
    cli.complete();
  }