public void notifySipSessionListeners ( SipSessionEventType sipSessionEventType ) { MobicentsSipApplicationSession sipApplicationSession = getSipApplicationSession ( ) ; if ( sipApplicationSession != null ) { SipContext sipContext = sipApplicationSession . getSipContext ( ) ; List < SipSessionListener > sipSessionListeners = sipContext . getListeners ( ) . getSipSessionListeners ( ) ; if ( sipSessionListeners . size ( ) > 0 ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "notifying sip session listeners of context " + sipContext . getApplicationName ( ) + " of following event " + sipSessionEventType ) ; } ClassLoader oldClassLoader = java . lang . Thread . currentThread ( ) . getContextClassLoader ( ) ; sipContext . enterSipContext ( ) ; SipSessionEvent sipSessionEvent = new SipSessionEvent ( this . getFacade ( ) ) ; for ( SipSessionListener sipSessionListener : sipSessionListeners ) { try { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "notifying sip session listener " + sipSessionListener . getClass ( ) . getName ( ) + " of context " + key . getApplicationName ( ) + " of following event " + sipSessionEventType ) ; } if ( SipSessionEventType . CREATION . equals ( sipSessionEventType ) ) { sipSessionListener . sessionCreated ( sipSessionEvent ) ; } else if ( SipSessionEventType . DELETION . equals ( sipSessionEventType ) ) { sipSessionListener . sessionDestroyed ( sipSessionEvent ) ; } else if ( SipSessionEventType . READYTOINVALIDATE . equals ( sipSessionEventType ) ) { sipSessionListener . sessionReadyToInvalidate ( sipSessionEvent ) ; } } catch ( Throwable t ) { logger . error ( "SipSessionListener threw exception" , t ) ; } } sipContext . exitSipContext ( oldClassLoader ) ; } } }
Notifies the listeners that a lifecycle event occured on that sip session