public void readExternal(ObjectInput arg0) throws IOException, ClassNotFoundException { String sipApplicationSessionId = arg0.readUTF(); SipApplicationSessionKey key = null; try { key = SessionManagerUtil.parseSipApplicationSessionKey(sipApplicationSessionId); } catch (ParseException e) { logger.error("Couldn't parse the following sip application session key " + sipApplicationSessionId, e); throw new IllegalArgumentException("Couldn't parse the following sip application session key " + sipApplicationSessionId, e); } SipContext sipContext = StaticServiceHolder.sipStandardService .getSipApplicationDispatcher().findSipApplication(key.getApplicationName()); this.sipApplicationSession = sipContext.getSipManager().getSipApplicationSession( key, false); }
@Override public void scheduleAsynchronousWork(String sipApplicationSessionId, SipApplicationSessionAsynchronousWork work) { SipApplicationSessionKey applicationSessionKey; try { applicationSessionKey = SessionManagerUtil.parseSipApplicationSessionKey(sipApplicationSessionId ); } catch (ParseException e) { throw new IllegalArgumentException("the given application session id : " + sipApplicationSessionId + " couldn't be parsed correctly ",e); } sipContext.getSipApplicationDispatcher().getAsynchronousExecutor().execute(new SipApplicationSessionAsyncTask(applicationSessionKey, work, sipContext.getSipApplicationDispatcher().getSipFactory())); } }
public SipApplicationSession getApplicationSessionById(String applicationSessionId, boolean isContainerManaged) { if(applicationSessionId == null) { throw new NullPointerException("the given id is null !"); } SipApplicationSessionKey applicationSessionKey; try { applicationSessionKey = SessionManagerUtil.parseSipApplicationSessionKey(applicationSessionId); } catch (ParseException e) { logger.error("the given application session id : " + applicationSessionId + " couldn't be parsed correctly ",e); return null; } if(applicationSessionKey.getApplicationName().equals(sipContext.getApplicationName())) { MobicentsSipApplicationSession sipApplicationSession = sipContext.getSipManager().getSipApplicationSession(applicationSessionKey, false); if(sipApplicationSession == null) { return null; } else { // make sure to acquire this app session and add it to the set of app sessions we monitor in the context of the application // to release them all when we exit application code sipContext.enterSipApp(sipApplicationSession, null, true, isContainerManaged); return sipApplicationSession.getFacade(); } } else { logger.warn("the given application session id : " + applicationSessionId + " tried to be retrieved from incorret application " + sipContext.getApplicationName()); return null; } }
/** * Section 15.11.3 Encode URI Mechanism * The container MUST use the encoded URI to locate the targeted SipApplicationSession object. * If a valid SipApplicationSession is found, the container must determine * the name of the application that owns the SipApplicationSession object. * * @param targetedApplicationKey the encoded URI parameter * @return null if no corresponding SipApplicationSession could be found or * if the param is null, the SipTargetedRequestInfo completed otherwise */ private final MobicentsSipApplicationSession retrieveTargetedApplication( String targetedApplicationKey) { if( targetedApplicationKey != null && targetedApplicationKey.length() > 0) { targetedApplicationKey = RFC2396UrlDecoder.decode(targetedApplicationKey); SipApplicationSessionKey targetedApplicationSessionKey; try { targetedApplicationSessionKey = SessionManagerUtil.parseSipApplicationSessionKey(targetedApplicationKey); } catch (ParseException e) { logger.error("Couldn't parse the targeted application key " + targetedApplicationKey, e); return null; } SipContext sipContext = sipApplicationDispatcher.findSipApplication(targetedApplicationSessionKey.getApplicationName()); if(sipContext != null) { return sipContext.getSipManager().getSipApplicationSession(targetedApplicationSessionKey, false); } } return null; }
try { SipApplicationSessionKey sipApplicationSessionKey = SessionManagerUtil.parseSipApplicationSessionKey(sipApplicationKey); sipApplicationSessionImpl = ((SipManager)context.getManager()).getSipApplicationSession(sipApplicationSessionKey, false);
try { SipApplicationSessionKey sipApplicationSessionKey = SessionManagerUtil.parseSipApplicationSessionKey(sipApplicationKey); sipApplicationSessionImpl = ((SipManager)context.getManager()).getSipApplicationSession(sipApplicationSessionKey, false);
try { SipApplicationSessionKey sipApplicationSessionKey = SessionManagerUtil.parseSipApplicationSessionKey(sipApplicationKey); sipApplicationSessionImpl = context.getSipManager().getSipApplicationSession(sipApplicationSessionKey, false);