Package javax.slee

Examples of javax.slee.ActivityContextInterface


    MsSignalGenerator generator = msProvider.getSignalGenerator(this
        .getUserEndpoint());

    try {
      ActivityContextInterface generatorActivity = msActivityFactory
          .getActivityContextInterface(generator);
      generatorActivity.attach(getSbbContext().getSbbLocalObject());

      generator.apply(Announcement.PLAY, new String[] { audioFileURL
          .toString() });

      // this.initDtmfDetector(getConnection(), this.getEndpointName());
View Full Code Here


        this.setMediaSession(mediaSession);
        MsConnection msConnection = mediaSession
            .createNetworkConnection(ENDPOINT_NAME);

        // Attaching session AC
        ActivityContextInterface msAci = null;
        try {
          msAci = msActivityFactory
              .getActivityContextInterface(msConnection);
          msAci.attach(this.getSbbLocalObject());
        } catch (Exception ex) {
          log.error("Internal server error", ex);
          getMessageFactory().createResponse(
              Response.SERVER_INTERNAL_ERROR, request);
          return;
        }

        // Attaching to SIP Dialog activity
        Dialog dial = getSipFactoryProvider().getSipProvider()
            .getNewDialog((Transaction) st);
        ActivityContextInterface dialogAci = sipACIF
            .getActivityContextInterface(dial);

        // attach this SBB object to the Dialog activity to receive
        // subsequent events on this Dialog
        dialogAci.attach(this.getSbbLocalObject());

        // Notify caller that we're TRYING to reach voice mail. Just a
        // formality, we know we can go further than TRYING at this
        // point
        response = getMessageFactory().createResponse(Response.TRYING,
View Full Code Here

      MsSignalGenerator generator = msProvider
          .getSignalGenerator(endpointName);

      try {
        ActivityContextInterface generatorActivity = msActivityFactory
            .getActivityContextInterface(generator);
        generatorActivity.attach(this.getSbbLocalObject());

        URL audioFileURL = getClass().getResource(waitingDTMF);

        generator.apply(Announcement.PLAY, new String[] { audioFileURL
            .toString() });

        this.initDtmfDetector(evt.getConnection(), endpointName);

      } catch (UnrecognizedActivityException e) {
        e.printStackTrace();
      }

    } else {
      log.debug("not the same user, start recording after announcement");
      System.out
          .println("not the same user, start recording after announcement");

      URL audioFileURL = getClass().getResource(recordAfterTone);

      ToHeader toHeader = (ToHeader) request.getHeader(ToHeader.NAME);
      String fileName = ((SipURI) toHeader.getAddress().getURI())
          .getUser()
          + WAV_EXT;
      String route = null;
      String recordFilePath = null;

      try {
        Context initCtx = new InitialContext();
        Context myEnv = (Context) initCtx.lookup("java:comp/env");

        route = (String) myEnv.lookup("filesRoute");
      } catch (NamingException nEx) {
        log.warn("Lookup of filesRoute env Variable failed", nEx);
      }

      if (route != null) {
        recordFilePath = route + fileName;
      } else {
        recordFilePath = fileName;
      }

      String[] params = new String[2];
      params[0] = audioFileURL.toString();
      params[1] = recordFilePath;

      MsSignalGenerator signalGenerator = msProvider
          .getSignalGenerator(endpointName);

      try {
        ActivityContextInterface dtmfAci = msActivityFactory
            .getActivityContextInterface(signalGenerator);
        dtmfAci.attach(this.getSbbLocalObject());
        signalGenerator.apply(AU.PLAY_RECORD, params);
      } catch (UnrecognizedActivityException e) {
        log.error(e.getMessage(), e);
      }
    }
View Full Code Here

  private void initDtmfDetector(MsConnection connection, String userEndPoint) {
    MsSignalDetector dtmfDetector = msProvider
        .getSignalDetector(userEndPoint);
    try {
      ActivityContextInterface dtmfAci = msActivityFactory
          .getActivityContextInterface(dtmfDetector);
      dtmfAci.attach(this.getSbbLocalObject());
      dtmfDetector.receive(Basic.DTMF, connection, new String[] {});
    } catch (UnrecognizedActivityException e) {
      log.error(e.getMessage(), e);
    }
  }
View Full Code Here

    public void playNext() {
        String url = (String) this.getSequence().get(this.getIndex());
        MsSignalGenerator generator = msProvider.getSignalGenerator(getAnnouncementEndpoint());
        try {
            ActivityContextInterface generatorActivity = mediaAcif.getActivityContextInterface(generator);
            generatorActivity.attach(sbbContext.getSbbLocalObject());
            generator.apply(Announcement.PLAY, new String[]{url});
            this.setIndex(getIndex() + 1);
        } catch (UnrecognizedActivityException e) {
        }
    }
View Full Code Here

        }
    }

    public void onLinkReleased(MsLinkEvent evt, ActivityContextInterface aci) {
        logger.info("Dialog completed, fire DIALOG_COMPLETE event");
        ActivityContextInterface connectionAci = this.getUserActivity();
        if (connectionAci != null && !connectionAci.isEnding()) {
            connectionAci.detach(sbbContext.getSbbLocalObject());
            this.fireLinkReleased(evt, connectionAci, null);
        }
    }
View Full Code Here

        }
        return null;
    }

    public ActivityContextInterface getUserActivity() {
        ActivityContextInterface activities[] = sbbContext.getActivities();
        for (int i = 0; i < activities.length; i++) {
            if (activities[i].getActivity() instanceof MsConnection) {
                return activities[i];
            }
        }
View Full Code Here

    }
   
    private void initDtmfDetector(MsConnection connection) {
        MsSignalDetector dtmfDetector = msProvider.getSignalDetector(this.getUserEndpoint());
        try {
            ActivityContextInterface dtmfAci =
                    mediaAcif.getActivityContextInterface(dtmfDetector);
            dtmfAci.attach(sbbContext.getSbbLocalObject());
            dtmfDetector.receive(Basic.DTMF, connection, new String[]{});
        } catch (UnrecognizedActivityException e) {
        }
    }
View Full Code Here

        logger.info("Incoming call " + from + " " + to.getName());
        this.setDestination(to.toString());

        //create Dialog and attach SBB to the Dialog Activity
        ActivityContextInterface daci = null;
        try {
            Dialog dialog = sipProvider.getNewDialog(evt.getServerTransaction());
            dialog.terminateOnBye(true);
            daci = acif.getActivityContextInterface(dialog);
            daci.attach(sbbContext.getSbbLocalObject());
        } catch (Exception e) {
            logger.error("Error during dialog creation", e);
            respond(evt, Response.SERVER_INTERNAL_ERROR);
            return;
        }

        respond(evt, Response.RINGING);
       
        MsSession session = msProvider.createSession();
        MsConnection msConnection = session.createNetworkConnection(ENDPOINT_NAME);

        ActivityContextInterface msAci = null;
        try {
            msAci = msActivityFactory.getActivityContextInterface(msConnection);
            msAci.attach(sbbContext.getSbbLocalObject());
        } catch (Exception ex) {
            logger.error("Internal server error", ex);
            respond(evt, Response.SERVER_INTERNAL_ERROR);
            return;
        }
View Full Code Here

       
        MsConnection connection = (MsConnection) getConnectionActivity().getActivity();
        MsSession session = connection.getSession();
        MsLink link = session.createLink(MsLink.MODE_FULL_DUPLEX);

        ActivityContextInterface linkActivity = null;
        try {
            linkActivity = mediaAcif.getActivityContextInterface(link);
        } catch (UnrecognizedActivityException ex) {
        }

        linkActivity.attach(sbbContext.getSbbLocalObject());
        link.join(endpointName, CNF_ENDPOINT);
    }
View Full Code Here

TOP

Related Classes of javax.slee.ActivityContextInterface

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.