#NEWLINE# def gatherSessionInformation( self , messages ) : #NEWLINE# #INDENT# dialogs = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# allDialogs = [ ] #NEWLINE# for ( i , dm ) in enumerate ( messages ) : #NEWLINE# #INDENT# m = SipMsg ( dm ) #NEWLINE# ( cid , fromTag ) = m . getCallIdAndFromTag ( ) #NEWLINE# d = ( '%s | %s' % ( cid , fromTag ) ) #NEWLINE# dialogs . setdefault ( d , SipDialog ( cid ) ) . addMessage ( m , i ) #NEWLINE# #UNINDENT# for k in dialogs . keys ( ) : #NEWLINE# #INDENT# if ( k in dialogs ) : #NEWLINE# #INDENT# d = dialogs [ k ] #NEWLINE# toTag = d . getToTag ( ) #NEWLINE# if ( toTag is not None ) : #NEWLINE# #INDENT# otherSide = ( '%s | %s' % ( d . getCallId ( ) , toTag ) ) #NEWLINE# if ( otherSide in dialogs ) : #NEWLINE# #INDENT# d . mergeDialogs ( dialogs [ otherSide ] ) #NEWLINE# del dialogs [ otherSide ] #NEWLINE# #UNINDENT# #UNINDENT# d . orderMessages ( ) #NEWLINE# d . determineType ( ) #NEWLINE# allDialogs . append ( d ) #NEWLINE# del dialogs [ k ] #NEWLINE# #UNINDENT# #UNINDENT# messageTuples = [ d . getMessageTuples ( ) for d in allDialogs ] #NEWLINE# allTuples = [ oneTuple for sublist in messageTuples for oneTuple in sublist ] #NEWLINE# allTuples . sort ( key = itemgetter ( 4 ) ) #NEWLINE# for ( index , tup ) in enumerate ( allTuples ) : #NEWLINE# #INDENT# ( sessionId , msgNumber , role , msgType , _ ) = tup #NEWLINE# self . addSessionInformation ( SessionInfo ( sessionId , msgNumber , role , msgType ) , index )