protected final SbbLocalObject getSbbLocalObject() { return sbbContext.getSbbLocalObject(); }
public void onAppUsageAddedEvent(AppUsageAddedEvent event, ActivityContextInterface aci) { aci.detach(sbbContext.getSbbLocalObject()); if (!event.getAuid().equals(XCAPCapsAppUsage.ID)) { // update xcap caps global doc try { updateXCAPCapsGlobalDoc(); } catch (InternalServerErrorException e) { tracer.severe("failed to update xcap caps global doc", e); } } }
public void onAppUsageRemovedEvent(AppUsageRemovedEvent event, ActivityContextInterface aci) { aci.detach(sbbContext.getSbbLocalObject()); if (!event.getAuid().equals(XCAPCapsAppUsage.ID)) { // update xcap caps global doc try { updateXCAPCapsGlobalDoc(); } catch (InternalServerErrorException e) { tracer.severe("failed to update xcap caps global doc", e); } } }
public void onStartServiceEvent( javax.slee.serviceactivity.ServiceStartedEvent event, ActivityContextInterface aci) { tracer.info("Retreiving www.telestax.com..."); try { HttpClientNIORequestActivity activity = httpClientRA.execute( new HttpGet("http://www.telestax.com"), null, System.currentTimeMillis()); httpClientACIF.getActivityContextInterface(activity).attach( sbbContext.getSbbLocalObject()); } catch (Exception e) { tracer.severe("failed to retrieve webpage", e); } }
public void onOrderCancelled(CustomEvent event, ActivityContextInterface ac) { logger.info("======== OrderDeliverDateSbb ORDER_CANCELLED ========"); if (this.getTimerID() != null) { timerFacility.cancelTimer(this.getTimerID()); ac.detach(getSbbContext().getSbbLocalObject()); } }
/** * Init the xmpp connection to GOOGLE TALK when the service is activated by * SLEE * * @param event * @param aci */ public void onStartServiceEvent( javax.slee.serviceactivity.ServiceStartedEvent event, ActivityContextInterface aci) { try { // connect to google talk xmpp server XmppConnection connection = xmppSbbInterface.connectClient( connectionID, serviceHost, servicePort, serviceName, username, password, resource, Arrays .asList(packetsToListen)); xmppActivityContextInterfaceFactory.getActivityContextInterface( connection).attach(sbbContext.getSbbLocalObject()); } catch (XMPPException e) { tracer.severe("Connection to server failed!",e); } }
public void on4xxResponse(javax.sip.ResponseEvent event, ActivityContextInterface aci) { Response response = event.getResponse(); if(tracer.isInfoEnabled()) { tracer.info("Received SIP 4xx >> " + response.getStatusCode()); } // Is it a 404? if(response.getStatusCode() == 404) { // Let's see from whom to whom String to = ((ToHeader) response.getHeader("To")).getAddress().toString(); String from = ((FromHeader) response.getHeader("From")).getAddress().toString(); if(tracer.isInfoEnabled()) { tracer.info("From[" + from + "], To [" + to + "]"); } String toAddress = to.substring(to.indexOf("sip:"), to.indexOf(">")); // Create the MissedCall object MissedCall mC = new MissedCall(from, new Date()); Collection<MissedCall> mCs = missedCalls.get(toAddress); if(mCs == null) { mCs = new ArrayList<MissedCall>(); missedCalls.put(toAddress, mCs); } if(!mCs.contains(mC)) { mCs.add(mC); } } aci.detach(this.getSbbContext().getSbbLocalObject()); }
public void onInitMedia(InteropCustomEvent event, ActivityContextInterface ac) { logger.info("****** org.mobicents.slee.service.interopdemo.INIT_MEDIA ******* "); logger.info("InteropSbb: " + this + ": received an INIT_MEDIA event. username = " + event.getBoothNumber() + ". sdpContent = " + new String(event.getSdpContent())); this.setInteropCustomEvent(event); MsConnection msConnection = msProvider.createSession().createNetworkConnection(PR_ENDPOINT_NAME); try { ActivityContextInterface msAci = mediaAcif.getActivityContextInterface(msConnection); msAci.attach(this.getSbbContext().getSbbLocalObject()); } catch (Exception ex) { logger.error("Internal server error", ex); return; } msConnection.modify("$", new String(event.getSdpContent())); }
public void onCustomEvent(CustomEvent event, ActivityContextInterface aci) { // detach from ACI, it is created per call, its null activity ACI, it // wont be reclaimed // until this SBBE is attached. logger.info("Received event on activity: " + aci.getActivity()); // detach aci.detach(this.getSbbContext().getSbbLocalObject()); logger.info("Message received from event originator: " + event.getMessage()); }
/** * Starts dialog. * * @param endpointName the user's endpoint. * @param aci the user's activity context interface. */ public void startConversation(String endpointName) { logger.info("Joining " + endpointName + " with " + LOOP_ENDPOINT); MsConnection connection = (MsConnection) sbbContext.getActivities()[0].getActivity(); MsSession session = connection.getSession(); MsLink link = session.createLink(MsLinkMode.FULL_DUPLEX); ActivityContextInterface linkActivity = null; try { linkActivity = mediaAcif.getActivityContextInterface(link); } catch (UnrecognizedActivityException ex) { } linkActivity.attach(sbbContext.getSbbLocalObject()); link.join(endpointName, LOOP_ENDPOINT); }
private void initDtmfDetector(MsLink link, String endpointName) { MsEventFactory eventFactory = msProvider .getEventFactory(); try { ActivityContextInterface dtmfAci = mediaAcif .getActivityContextInterface(link.getSession()); dtmfAci.attach(getSbbContext().getSbbLocalObject()); MsDtmfRequestedEvent dtmf = (MsDtmfRequestedEvent) eventFactory.createRequestedEvent(DTMF.TONE); MsRequestedSignal[] signals = new MsRequestedSignal[] {}; MsRequestedEvent[] events = new MsRequestedEvent[] { dtmf }; link.getEndpoints()[1].execute(signals, events, link); } catch (UnrecognizedActivityException e) { logger.error("Internal Server Erro", e); } }
/** * */ private void terminateSipSession() { SbbLocalObject sbbLocalObject = sbbContext.getSbbLocalObject(); ActivityContextInterface dialogACI = getDialogACI(); if (dialogACI != null) { dialogACI.detach(sbbLocalObject); try { DialogActivity dialog = (DialogActivity) dialogACI .getActivity(); Request bye = dialog.createRequest(Request.BYE); dialog.sendRequest(bye); } catch (Exception e) { tracer.severe("failed to abort sip dialog.", e); } } }
/** * */ private void terminateSipSession() { SbbLocalObject sbbLocalObject = sbbContext.getSbbLocalObject(); ActivityContextInterface dialogACI = getDialogACI(); if (dialogACI != null) { dialogACI.detach(sbbLocalObject); try { DialogActivity dialog = (DialogActivity) dialogACI .getActivity(); Request bye = dialog.createRequest(Request.BYE); dialog.sendRequest(bye); } catch (Exception e) { tracer.severe("failed to abort sip dialog.", e); } } }
private void finishMediaSessionSetup( ActivityContextInterface networkConnectionAci) throws MsControlException { NetworkConnection connection = (NetworkConnection) networkConnectionAci .getActivity(); MediaSession session = connection.getMediaSession(); MediaGroup mediaGroup = session .createMediaGroup(MediaGroup.PLAYER_RECORDER_SIGNALDETECTOR); connection.joinInitiate(Direction.DUPLEX, mediaGroup, "context"); ActivityContextInterface mediaGroupACI = mscRaAciFactory .getActivityContextInterface(mediaGroup); mediaGroupACI.attach(sbbContext.getSbbLocalObject()); setMediaGroupACI(mediaGroupACI); }
private void finishMediaSessionSetup( ActivityContextInterface networkConnectionAci) throws MsControlException { NetworkConnection connection = (NetworkConnection) networkConnectionAci .getActivity(); MediaSession session = connection.getMediaSession(); MediaGroup mediaGroup = session .createMediaGroup(MediaGroup.PLAYER_RECORDER_SIGNALDETECTOR); connection.joinInitiate(Direction.DUPLEX, mediaGroup, "context"); ActivityContextInterface mediaGroupACI = mscRaAciFactory .getActivityContextInterface(mediaGroup); mediaGroupACI.attach(sbbContext.getSbbLocalObject()); setMediaGroupACI(mediaGroupACI); }
/** * Event handler from the timer event, which signals that a message must be * sent back to the UA * * @param event * @param aci */ public void onTimerEvent(TimerEvent event, ActivityContextInterface aci) { // detaching so the null AC is claimed after the event handling aci.detach(sbbContext.getSbbLocalObject()); try { DataSourceChildSbbLocalInterface child = (DataSourceChildSbbLocalInterface) getLocationChildRelation().create(); child.getBindings(getSender().getURI().toString()); } catch (Exception e) { tracer.severe("failed to create sip registrar child sbb, to lookup the sender's contacts",e); return; } }
public void onInviteEvent(javax.sip.RequestEvent requestEvent, ActivityContextInterface aci) { try { ServerTransaction serverTransaction = requestEvent.getServerTransaction(); // send 100 // serverTransaction.sendResponse(messageFactory.createResponse(100,requestEvent.getRequest())); // create dialog and attach this entity to it's aci DialogActivity dialog = (DialogActivity) sipFactoryProvider.getNewDialog(serverTransaction); sipActivityContextInterfaceFactory.getActivityContextInterface(dialog).attach(this.sbbContext.getSbbLocalObject()); // send 200 ok Response response = messageFactory .createResponse(Response.OK,requestEvent.getRequest()); response.addHeader(getContactHeader()); ((ToHeader)response.getHeader(ToHeader.NAME)).setTag(Utils.getInstance().generateTag()); serverTransaction.sendResponse(response); } catch (Exception ex) { ex.printStackTrace(); } }
private void initialSipSessionSetup(RequestEvent event, ActivityContextInterface aci) throws ParseException, SipException, InvalidArgumentException { // store the server tx aci in a cmp shortcut setServerTransactionACI(aci); // send trying response ServerTransaction serverTransaction = event.getServerTransaction(); Response response = sipRaSbbInterface .getMessageFactory() .createResponse(Response.TRYING, serverTransaction.getRequest()); serverTransaction.sendResponse(response); // create sip dialog and attach to its activity Dialog dialog = sipRaSbbInterface.getNewDialog(serverTransaction); ActivityContextInterface dialogAci = sipRaAciFactory .getActivityContextInterface((DialogActivity) dialog); dialogAci.attach(sbbContext.getSbbLocalObject()); // store the dialog aci in a cmp shortcut setDialogACI(dialogAci); }
private void initialSipSessionSetup(RequestEvent event, ActivityContextInterface aci) throws ParseException, SipException, InvalidArgumentException { // store the server tx aci in a cmp shortcut setServerTransactionACI(aci); // send trying response ServerTransaction serverTransaction = event.getServerTransaction(); Response response = sipRaSbbInterface .getMessageFactory() .createResponse(Response.TRYING, serverTransaction.getRequest()); serverTransaction.sendResponse(response); // create sip dialog and attach to its activity Dialog dialog = sipRaSbbInterface.getNewDialog(serverTransaction); ActivityContextInterface dialogAci = sipRaAciFactory .getActivityContextInterface((DialogActivity) dialog); dialogAci.attach(sbbContext.getSbbLocalObject()); // store the dialog aci in a cmp shortcut setDialogACI(dialogAci); }
private void releaseMediaConnectionAndDialog() { ActivityContextInterface[] activities = sbbContext.getActivities(); SbbLocalObject sbbLocalObject = getSbbContext().getSbbLocalObject(); MsConnection msConnection = null; for (ActivityContextInterface attachedAci : activities) { if (attachedAci.getActivity() instanceof Dialog) { attachedAci.detach(sbbLocalObject); attachedAci.detach(this.getParentCmp()); } if (attachedAci.getActivity() instanceof MsConnection) { attachedAci.detach(sbbLocalObject); msConnection = (MsConnection) attachedAci.getActivity(); attachedAci.detach(this.getParentCmp()); } } if (msConnection != null) { msConnection.release(); } }