public MobicentsSipApplicationSession getSipApplicationSession ( final SipApplicationSessionKey key , final boolean create ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "getSipApplicationSession with key=" + key ) ; } MobicentsSipApplicationSession sipApplicationSessionImpl = null ; //first we check if the app session can be found by its app generated key final String appGeneratedKey = key . getAppGeneratedKey ( ) ; if ( appGeneratedKey != null ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "trying to find sip application session with generated key " + appGeneratedKey ) ; } sipApplicationSessionImpl = sipApplicationSessionsByAppGeneratedKey . get ( appGeneratedKey ) ; } if ( sipApplicationSessionImpl == null ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "getSipApplicationSession - trying to find sip application session with key " + key ) ; logger . debug ( "getSipApplicationSession - sip application session keyset: " ) ; for ( SipApplicationSessionKey tmp : sipApplicationSessions . keySet ( ) ) { logger . debug ( "getSipApplicationSession - element=" + tmp ) ; } } sipApplicationSessionImpl = sipApplicationSessions . get ( key ) ; } if ( sipApplicationSessionImpl == null && create ) { sipApplicationSessionImpl = createSipApplicationSession ( key ) ; } return sipApplicationSessionImpl ; }
Retrieve a sip application session from its key . If none exists one can enforce the creation through the create parameter to true .